Skip to content

Commit 361b8fc

Browse files
Patryk Wlazlynlenb
authored andcommitted
tools/power turbostat: Extend --add option with perf counters
User can now read perf counters using "--add perf/<device>/<event>". Other details work similarly to how --add works with MSRs. Signed-off-by: Patryk Wlazlyn <[email protected]> Signed-off-by: Len Brown <[email protected]>
1 parent 67bab43 commit 361b8fc

File tree

3 files changed

+557
-11
lines changed

3 files changed

+557
-11
lines changed

tools/power/x86/turbostat/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ snapshot: turbostat
4646
@echo "#define GENMASK_ULL(h, l) (((~0ULL) << (l)) & (~0ULL >> (sizeof(long long) * 8 - 1 - (h))))" >> $(SNAPSHOT)/bits.h
4747

4848
@echo '#define BUILD_BUG_ON(cond) do { enum { compile_time_check ## __COUNTER__ = 1/(!(cond)) }; } while (0)' > $(SNAPSHOT)/build_bug.h
49+
@echo '#define __must_be_array(arr) 0' >> $(SNAPSHOT)/build_bug.h
4950

5051
@echo PWD=. > $(SNAPSHOT)/Makefile
5152
@echo "CFLAGS += -DMSRHEADER='\"msr-index.h\"'" >> $(SNAPSHOT)/Makefile

tools/power/x86/turbostat/turbostat.8

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,13 @@ name as necessary to disambiguate it from others is necessary. Note that option
2828
.PP
2929
\fB--add attributes\fP add column with counter having specified 'attributes'. The 'location' attribute is required, all others are optional.
3030
.nf
31-
location: {\fBmsrDDD\fP | \fBmsr0xXXX\fP | \fB/sys/path...\fP}
31+
location: {\fBmsrDDD\fP | \fBmsr0xXXX\fP | \fB/sys/path...\fP | \fBperf/<device>/<event>\fP}
3232
msrDDD is a decimal offset, eg. msr16
3333
msr0xXXX is a hex offset, eg. msr0x10
3434
/sys/path... is an absolute path to a sysfs attribute
35+
<device> is a perf device from /sys/bus/event_source/devices/<device> eg. cstate_core
36+
<event> is a perf event for given device from /sys/bus/event_source/devices/<device>/events/<event> eg. c1-residency
37+
perf/cstate_core/c1-residency would then use /sys/bus/event_source/devices/cstate_core/events/c1-residency
3538

3639
scope: {\fBcpu\fP | \fBcore\fP | \fBpackage\fP}
3740
sample and print the counter for every cpu, core, or package.

0 commit comments

Comments
 (0)