Skip to content

Comments

fix: address Ampere1 event processing issues#645

Merged
harp-intel merged 2 commits intomainfrom
ampere1-event-handling
Feb 21, 2026
Merged

fix: address Ampere1 event processing issues#645
harp-intel merged 2 commits intomainfrom
ampere1-event-handling

Conversation

@harp-intel
Copy link
Contributor

This pull request introduces several enhancements and fixes to the metrics loading and evaluation logic, with a focus on improving event handling, metric expression parsing, and support for new metadata fields. The main themes are improved event definition handling, enhanced metric expression parsing, and expanded metadata support.

Event definition and group formation improvements:

  • Added new fields to the ComponentEvent struct (EventCode, EventName, BriefDescription, Errata) to support richer event definitions.
  • Updated logic in formEventGroups to prefer EventName over ArchStdEvent when available, and to generate perf event strings using EventCode if needed. Also added robust error handling when events are missing or unsupported.
  • Introduced the findEventByName helper function to search events by either EventName or ArchStdEvent.

Metric expression parsing enhancements:

  • Added support for skipping scientific notation (e.g., 1eN) tokens in metric variable initialization and implemented the isExp helper function. [1] [2]
  • Improved metric expression compilation to transform scientific notation constants (e.g., 1eN) into their integer equivalents for compatibility with govaluate.
  • Added support for the duration_time constant in metric expressions, replacing it with the actual collection interval from metadata. [1] [2]

Metadata and configuration support:

  • Added a new CollectionInterval field to the Metadata struct to track the interval between metric collections.
  • Ensured CollectionInterval is set from the flagPerfPrintInterval before loading metrics, so metric expressions using duration_time are compiled correctly.

CPU identification update:

  • Added support for Ampere-1a CPU identification in ARM CPU detection logic, specifically for "Not Specified" Dmidecode part (VM.Standard.A4.Flex on OCI).

Signed-off-by: Harper, Jason M <jason.m.harper@intel.com>
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request enhances ARM CPU event processing and metric expression handling to address issues with Ampere1 and similar ARM architectures. The changes improve event definition support, metric expression parsing for scientific notation and time-based constants, and CPU identification for cloud platforms.

Changes:

  • Added support for richer event definitions with EventCode, EventName, BriefDescription, and Errata fields
  • Enhanced metric expression parsing to handle scientific notation (1eN format) and the duration_time constant
  • Added Ampere-1a CPU identification for OCI cloud environments

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

File Description
internal/cpus/cpus.go Adds Ampere-1a CPU identification for "Not Specified" Dmidecode part on OCI
cmd/metrics/metadata.go Adds CollectionInterval field to Metadata struct for tracking metric collection intervals
cmd/metrics/metrics.go Sets CollectionInterval before loading metrics to support duration_time in expressions
cmd/metrics/loader_component.go Adds ComponentEvent fields, implements findEventByName helper, enhances event group formation with fallback logic for EventCode, adds support for duration_time and scientific notation (1eN) in metric expressions

Signed-off-by: Harper, Jason M <jason.m.harper@intel.com>
@harp-intel harp-intel merged commit 5379c33 into main Feb 21, 2026
5 checks passed
@harp-intel harp-intel deleted the ampere1-event-handling branch February 21, 2026 00:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant