Skip to content

Commit 5c557e4

Browse files
committed
Merge: Update turbostat to include support for new processors as well as bug fixes
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-9/-/merge_requests/4630 JIRA: https://issues.redhat.com/browse/RHEL-33321 JIRA: https://issues.redhat.com/browse/RHEL-36084 Signed-off-by: David Arcari <darcari@redhat.com> Approved-by: Steve Best <sbest@redhat.com> Approved-by: Tony Camuso <tcamuso@redhat.com> Approved-by: CKI KWF Bot <cki-ci-bot+kwf-gitlab-com@redhat.com> Merged-by: Lucas Zampieri <lzampier@redhat.com>
2 parents fb313eb + 15be48e commit 5c557e4

File tree

3 files changed

+906
-304
lines changed

3 files changed

+906
-304
lines changed

tools/power/x86/turbostat/Makefile

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ CC = $(CROSS_COMPILE)gcc
33
BUILD_OUTPUT := $(CURDIR)
44
PREFIX ?= /usr
55
DESTDIR ?=
6+
DAY := $(shell date +%Y.%m.%d)
7+
SNAPSHOT = turbostat-$(DAY)
68

79
ifeq ("$(origin O)", "command line")
810
BUILD_OUTPUT := $(O)
@@ -12,6 +14,7 @@ turbostat : turbostat.c
1214
override CFLAGS += -O2 -Wall -Wextra -I../../../include
1315
override CFLAGS += -DMSRHEADER='"../../../../arch/x86/include/asm/msr-index.h"'
1416
override CFLAGS += -DINTEL_FAMILY_HEADER='"../../../../arch/x86/include/asm/intel-family.h"'
17+
override CFLAGS += -DBUILD_BUG_HEADER='"../../../../include/linux/build_bug.h"'
1518
override CFLAGS += -D_FILE_OFFSET_BITS=64
1619
override CFLAGS += -D_FORTIFY_SOURCE=2
1720

@@ -22,9 +25,33 @@ override CFLAGS += -D_FORTIFY_SOURCE=2
2225
.PHONY : clean
2326
clean :
2427
@rm -f $(BUILD_OUTPUT)/turbostat
28+
@rm -f $(SNAPSHOT).tar.gz
2529

2630
install : turbostat
27-
install -d $(DESTDIR)$(PREFIX)/bin
31+
install -d $(DESTDIR)$(PREFIX)/bin
2832
install $(BUILD_OUTPUT)/turbostat $(DESTDIR)$(PREFIX)/bin/turbostat
29-
install -d $(DESTDIR)$(PREFIX)/share/man/man8
33+
install -d $(DESTDIR)$(PREFIX)/share/man/man8
3034
install -m 644 turbostat.8 $(DESTDIR)$(PREFIX)/share/man/man8
35+
36+
snapshot: turbostat
37+
@rm -rf $(SNAPSHOT)
38+
@mkdir $(SNAPSHOT)
39+
@cp turbostat Makefile turbostat.c turbostat.8 ../../../../arch/x86/include/asm/intel-family.h $(SNAPSHOT)
40+
41+
@sed -e 's/^#include <linux\/bits.h>/#include "bits.h"/' ../../../../arch/x86/include/asm/msr-index.h > $(SNAPSHOT)/msr-index.h
42+
@echo '#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))' >> $(SNAPSHOT)/msr-index.h
43+
@echo "#define BIT(x) (1 << (x))" > $(SNAPSHOT)/bits.h
44+
@echo "#define BIT_ULL(nr) (1ULL << (nr))" >> $(SNAPSHOT)/bits.h
45+
@echo "#define GENMASK(h, l) (((~0UL) << (l)) & (~0UL >> (sizeof(long) * 8 - 1 - (h))))" >> $(SNAPSHOT)/bits.h
46+
@echo "#define GENMASK_ULL(h, l) (((~0ULL) << (l)) & (~0ULL >> (sizeof(long long) * 8 - 1 - (h))))" >> $(SNAPSHOT)/bits.h
47+
48+
@echo '#define BUILD_BUG_ON(cond) do { enum { compile_time_check ## __COUNTER__ = 1/(!(cond)) }; } while (0)' > $(SNAPSHOT)/build_bug.h
49+
50+
@echo PWD=. > $(SNAPSHOT)/Makefile
51+
@echo "CFLAGS += -DMSRHEADER='\"msr-index.h\"'" >> $(SNAPSHOT)/Makefile
52+
@echo "CFLAGS += -DINTEL_FAMILY_HEADER='\"intel-family.h\"'" >> $(SNAPSHOT)/Makefile
53+
@echo "CFLAGS += -DBUILD_BUG_HEADER='\"build_bug.h\"'" >> $(SNAPSHOT)/Makefile
54+
@sed -e's/.*MSRHEADER.*//' -e's/.*INTEL_FAMILY_HEADER.*//' -e's/.*BUILD_BUG_HEADER.*//' Makefile >> $(SNAPSHOT)/Makefile
55+
56+
@rm -f $(SNAPSHOT).tar.gz
57+
tar cvzf $(SNAPSHOT).tar.gz $(SNAPSHOT)

tools/power/x86/turbostat/turbostat.8

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,9 @@ The system configuration dump (if --quiet is not used) is followed by statistics
155155
.PP
156156
\fBRAM_%\fP percent of the interval that RAPL throttling was active on DRAM.
157157
.PP
158-
\fBUncMHz\fP uncore MHz, instantaneous sample.
158+
\fBUncMHz\fP per-package uncore MHz, instantaneous sample.
159+
.PP
160+
\fBUMHz1.0\fP per-package uncore MHz for domain=1 and fabric_cluster=0, instantaneous sample. System summary is the average of all packages.
159161
.SH TOO MUCH INFORMATION EXAMPLE
160162
By default, turbostat dumps all possible information -- a system configuration header, followed by columns for all counters.
161163
This is ideal for remote debugging, use the "--out" option to save everything to a text file, and get that file to the expert helping you debug.

0 commit comments

Comments
 (0)