Re: [PATCH] perf/x86: Unify format of events sysfs show

From: Yang Jihong
Date: Thu Mar 24 2022 - 21:42:39 EST


Hi Peter,

On 2022/3/24 18:11, Peter Zijlstra wrote:
On Thu, Mar 24, 2022 at 11:19:57AM +0800, Yang Jihong wrote:
Sysfs show formats of files in /sys/devices/cpu/events/ are not unified,
some end with "\n", and some do not. Modify sysfs show format of events
defined by EVENT_ATTR_STR to end with "\n".

Did you test all the userspace that consumes these fields to make sure
none of them break? I suppose it's mostly perf tool, but I'm fairly sure
there's others out there as well.

Yes, I tested "perf record" and "perf stat" commands on my machine against the modified events, and the results are as follows:

$ perf stat -e topdown-fetch-bubbles,topdown-recovery-bubbles,topdown-slots-issued,topdown-slots-retired,topdown-total-slots -a sleep 1

Performance counter stats for 'system wide':

2356235 topdown-fetch-bubbles # 1211.9% frontend bound
226132 topdown-recovery-bubbles # 182.9% bad speculation
1073595 topdown-slots-issued # -1780.4% backend bound
944133 topdown-slots-retired # 485.6% retiring
194420 topdown-total-slots

0.987394388 seconds time elapsed


$ perf record -e topdown-fetch-bubbles,topdown-recovery-bubbles,topdown-slots-issued,topdown-slots-retired,topdown-total-slots -a sleep 1
Lowering default frequency rate from 4000 to 3000.
Please consider tweaking /proc/sys/kernel/perf_event_max_sample_rate.
Couldn't synthesize bpf events.
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.300 MB perf.data (2620 samples) ]

$ perf evlist
topdown-fetch-bubbles
topdown-recovery-bubbles
topdown-slots-issued
topdown-slots-retired
topdown-total-slots
dummy:HG

.


Thanks,
Jihong
.