aboutsummaryrefslogtreecommitdiffstats
path: root/resources
diff options
context:
space:
mode:
authorJay Wang <jay.wang2@arm.com>2025-01-03 15:41:22 +0000
committerPeter Mikus <peter.mikus@icloud.com>2025-01-21 08:51:00 +0000
commite088b65415a5b766374d08d3dbbbf493dd810b57 (patch)
tree31d902d31a7257ff8a6fc3535235e5d4de021b04 /resources
parent4c4d9c232cc3951d3242095c7b39b8cf8f8d61e0 (diff)
fix(telemetry): fix perf stat issue on Arm
VPP CSIT utilises perf stat command to monitor the perf events defined in perf_stat_runtime.yaml file. However, the raw event specification format(cpu/event=0xXXX,umask=0xXXX/u) is specific to x86 platforms(Intel/AMD). On ARM platforms, we stick to the symbolic names of the perf events. Signed-off-by: Jay Wang <jay.wang2@arm.com> Change-Id: I967bc4bddf5fc9ffbe61c276efdd95d69f7c4412
Diffstat (limited to 'resources')
-rw-r--r--resources/libraries/robot/performance/performance_actions.robot5
-rw-r--r--resources/templates/telemetry/perf_stat_runtime.yaml8
-rw-r--r--resources/templates/telemetry/perf_stat_runtime_arm.yaml104
-rw-r--r--resources/tools/telemetry/bundle_perf_stat.py35
4 files changed, 141 insertions, 11 deletions
diff --git a/resources/libraries/robot/performance/performance_actions.robot b/resources/libraries/robot/performance/performance_actions.robot
index df520e0757..de7c63200a 100644
--- a/resources/libraries/robot/performance/performance_actions.robot
+++ b/resources/libraries/robot/performance/performance_actions.robot
@@ -187,6 +187,9 @@
| | ${transaction_scale} = | Get Transaction Scale
| | ${transaction_type} = | Get Transaction Type
| | ${use_latency} = | Get Use Latency
+| | ${node_arch} = | Get Node Arch | ${nodes[u'DUT1']}
+| | ${profile} = | Set Variable If | "${node_arch}" == "aarch64"
+| | ... | perf_stat_runtime_arm.yaml | perf_stat_runtime.yaml
| | Send traffic on tg
| | ... | duration=${-1}
| | ... | rate=${runtime_rate}
@@ -203,7 +206,7 @@
| | ... | ramp_up_duration=${ramp_up_duration}
| | ... | ramp_up_rate=${ramp_up_rate}
| | Run Telemetry On All DUTs
-| | ... | ${nodes} | profile=perf_stat_runtime.yaml
+| | ... | ${nodes} | profile=${profile}
| | ... | rate=${telemetry_rate} | export=${False}
| | Stop traffic on tg
diff --git a/resources/templates/telemetry/perf_stat_runtime.yaml b/resources/templates/telemetry/perf_stat_runtime.yaml
index ae0f804945..1e07c2d482 100644
--- a/resources/templates/telemetry/perf_stat_runtime.yaml
+++ b/resources/templates/telemetry/perf_stat_runtime.yaml
@@ -37,6 +37,7 @@ scheduler:
duration: 1
programs:
- name: bundle_perf_stat
+ architecture: x86_64
metrics:
counter:
- name: cpu_cycles
@@ -49,6 +50,7 @@ programs:
- eventcode: 0x3C # cpu-cycles
umask: 0x00
- name: bundle_perf_stat
+ architecture: x86_64
metrics:
counter:
- name: instructions
@@ -61,6 +63,7 @@ programs:
- eventcode: 0xC0 # instructions
umask: 0x00
- name: bundle_perf_stat
+ architecture: x86_64
metrics:
counter:
- name: mem_load_uops_retired_l1_hit
@@ -73,6 +76,7 @@ programs:
- eventcode: 0xD1 # MEM_LOAD_UOPS_RETIRED.L1_HIT
umask: 0x01
- name: bundle_perf_stat
+ architecture: x86_64
metrics:
counter:
- name: mem_load_uops_retired_l2_hit
@@ -85,6 +89,7 @@ programs:
- eventcode: 0xD1 # MEM_LOAD_UOPS_RETIRED.L2_HIT
umask: 0x02
- name: bundle_perf_stat
+ architecture: x86_64
metrics:
counter:
- name: mem_load_uops_retired_l3_hit
@@ -97,6 +102,7 @@ programs:
- eventcode: 0xD1 # MEM_LOAD_UOPS_RETIRED.L3_HIT
umask: 0x04
- name: bundle_perf_stat
+ architecture: x86_64
metrics:
counter:
- name: mem_load_uops_retired_l1_miss
@@ -109,6 +115,7 @@ programs:
- eventcode: 0xD1 # MEM_LOAD_UOPS_RETIRED.L1_MISS
umask: 0x08
- name: bundle_perf_stat
+ architecture: x86_64
metrics:
counter:
- name: mem_load_uops_retired_l2_miss
@@ -121,6 +128,7 @@ programs:
- eventcode: 0xD1 # MEM_LOAD_UOPS_RETIRED.L2_MISS
umask: 0x10
- name: bundle_perf_stat
+ architecture: x86_64
metrics:
counter:
- name: mem_load_uops_retired_l3_miss
diff --git a/resources/templates/telemetry/perf_stat_runtime_arm.yaml b/resources/templates/telemetry/perf_stat_runtime_arm.yaml
new file mode 100644
index 0000000000..ae1e4aa329
--- /dev/null
+++ b/resources/templates/telemetry/perf_stat_runtime_arm.yaml
@@ -0,0 +1,104 @@
+---
+logging:
+ version: 1
+ formatters:
+ console_stdout:
+ format: '%(asctime)s - %(name)s - %(message)s'
+ console_stderr:
+ format: '%(message)s'
+ prom:
+ format: '%(message)s'
+ handlers:
+ console_stdout:
+ class: logging.StreamHandler
+ level: INFO
+ formatter: console_stdout
+ stream: ext://sys.stdout
+ console_stderr:
+ class: logging.StreamHandler
+ level: ERROR
+ formatter: console_stderr
+ stream: ext://sys.stderr
+ prom:
+ class: logging.handlers.RotatingFileHandler
+ level: INFO
+ formatter: prom
+ filename: /tmp/metric.prom
+ mode: w
+ loggers:
+ prom:
+ handlers: [prom]
+ level: INFO
+ propagate: False
+ root:
+ level: INFO
+ handlers: [console_stdout, console_stderr]
+scheduler:
+ duration: 1
+programs:
+ - name: bundle_perf_stat
+ architecture: aarch64
+ metrics:
+ counter:
+ - name: cpu_cycles
+ documentation: Cycles processed by CPUs
+ namespace: perf_stat
+ labelnames:
+ - thread
+ - pid
+ events: cpu-cycles
+ - name: bundle_perf_stat
+ architecture: aarch64
+ metrics:
+ counter:
+ - name: instructions
+ documentation: Instructions retired by CPUs
+ namespace: perf_stat
+ labelnames:
+ - thread
+ - pid
+ events: instructions
+ - name: bundle_perf_stat
+ architecture: aarch64
+ metrics:
+ counter:
+ - name: l1d_cache
+ documentation: Level 1 data cache access
+ namespace: perf_stat
+ labelnames:
+ - thread
+ - pid
+ events: l1d_cache
+ - name: bundle_perf_stat
+ architecture: aarch64
+ metrics:
+ counter:
+ - name: l1d_cache_refill
+ documentation: Level 1 data cache refill
+ namespace: perf_stat
+ labelnames:
+ - thread
+ - pid
+ events: l1d_cache_refill
+ - name: bundle_perf_stat
+ architecture: aarch64
+ metrics:
+ counter:
+ - name: l2d_cache
+ documentation: Level 2 data cache access
+ namespace: perf_stat
+ labelnames:
+ - thread
+ - pid
+ events: l2d_cache
+ - name: bundle_perf_stat
+ architecture: aarch64
+ metrics:
+ counter:
+ - name: l2d_cache_refill
+ documentation: Level 2 data cache refill
+ namespace: perf_stat
+ labelnames:
+ - thread
+ - pid
+ events: l2d_cache_refill
diff --git a/resources/tools/telemetry/bundle_perf_stat.py b/resources/tools/telemetry/bundle_perf_stat.py
index 471dd07b18..7f64eda2c5 100644
--- a/resources/tools/telemetry/bundle_perf_stat.py
+++ b/resources/tools/telemetry/bundle_perf_stat.py
@@ -1,4 +1,4 @@
-# Copyright (c) 2022 Cisco and/or its affiliates.
+# Copyright (c) 2025 Cisco and/or its affiliates.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at:
@@ -39,6 +39,7 @@ class BundlePerfStat:
"""
self.metrics = program[u"metrics"]
self.events = program[u"events"]
+ self.architecture = program[u"architecture"]
self.api_replies_list = list()
self.serializer = serializer
self.hook = hook
@@ -53,21 +54,35 @@ class BundlePerfStat:
"""
try:
self.serializer.create(metrics=self.metrics)
- event = self.events[0]
- text = subprocess.getoutput(
- f"""sudo perf stat -x\; -e\
- '{{cpu/event={hex(event[u"eventcode"])},\
- umask={hex(event[u"umask"])}/u}}'\
- -a --per-thread\
- sleep {duration}"""
- )
+ # The following PMU event format is specific to x86_64 systems.
+ if self.architecture == "x86_64":
+ event = self.events[0]
+ text = subprocess.getoutput(
+ f"""sudo perf stat -x';' -e\
+ '{{cpu/event={hex(event[u"eventcode"])},\
+ umask={hex(event[u"umask"])}/u}}'\
+ -a --per-thread\
+ sleep {duration}"""
+ )
+ # We select the symbolic event name instead on AArch64.
+ else:
+ event = self.events
+ text = subprocess.getoutput(
+ f"""sudo perf stat -x';' -e\
+ {event}\
+ -a --per-thread\
+ sleep {duration}"""
+ )
except subprocess.CalledProcessError:
getLogger("console_stderr").error(f"Could not successfully run "
f"perf stat command.")
sys.exit(Constants.err_linux_perf_stat)
if text == u"":
- getLogger("console_stdout").info(event[u"eventcode"])
+ if self.architecture == "x86_64":
+ getLogger("console_stdout").info(event[u"eventcode"])
+ else:
+ getLogger("console_stdout").info(event)
else:
for line in text.splitlines():
if line.count(u";") < 6: