Skip to content

Commit a574afd

Browse files
committed
kernel utilization metrics on EC2 AL2023 w/ 6.1 kernel
Signed-off-by: Harper, Jason M <[email protected]>
1 parent c065003 commit a574afd

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

cmd/metrics/loader_perfmon_group_core.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,17 @@ func (group *CoreGroup) AddEvent(event CoreEvent, reorder bool, metadata Metadat
241241
validCounters += fmt.Sprintf("%d,", i)
242242
}
243243
}
244+
// When the fixed ref cycles counter is not supported, we cannot put CPU_CLK_UNHALTED.REF_TSC (ref-cycles) and
245+
// CPU_CLK_UNHALTED.REF_TSC_P:SUP (ref-cycles:k) in the same group.
246+
// Note: this was discovered through testing on AWS m7i.8xlarge instances with Amazon Linux 2023 w/ kernel
247+
// 6.1. The same platform but with kernel 6.12 supports the fixed ref cycles counter and doesn't have this limitation.
248+
if !metadata.SupportsFixedRefCycles && strings.HasPrefix(event.EventName, "CPU_CLK_UNHALTED.REF_TSC") {
249+
for _, existingEvent := range group.GeneralPurposeCounters {
250+
if strings.HasPrefix(existingEvent.EventName, "CPU_CLK_UNHALTED.REF_TSC") {
251+
return fmt.Errorf("cannot add %s to group as it contains %s and fixed reference cycles are not supported", event.EventName, existingEvent.EventName)
252+
}
253+
}
254+
}
244255
// otherwise, it is a general purpose event, check if we can place it in one of the general purpose counters
245256
for i := range group.GeneralPurposeCounters {
246257
if counter := group.GeneralPurposeCounters[i]; counter.IsEmpty() {

0 commit comments

Comments
 (0)