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 <[email protected]>
Change-Id: I967bc4bddf5fc9ffbe61c276efdd95d69f7c4412
| | ${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}
| | ... | 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
duration: 1
programs:
- name: bundle_perf_stat
+ architecture: x86_64
metrics:
counter:
- name: cpu_cycles
- eventcode: 0x3C # cpu-cycles
umask: 0x00
- name: bundle_perf_stat
+ architecture: x86_64
metrics:
counter:
- name: instructions
- eventcode: 0xC0 # instructions
umask: 0x00
- name: bundle_perf_stat
+ architecture: x86_64
metrics:
counter:
- name: mem_load_uops_retired_l1_hit
- 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
- 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
- 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
- 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
- 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
--- /dev/null
+---
+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
-# 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:
"""
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
"""
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: