2012-10-09 15:31:44 +00:00
|
|
|
CC = $(CROSS_COMPILE)gcc
|
|
|
|
BUILD_OUTPUT := $(PWD)
|
|
|
|
PREFIX := /usr
|
|
|
|
DESTDIR :=
|
|
|
|
|
2010-10-23 03:53:03 +00:00
|
|
|
turbostat : turbostat.c
|
tools/power: turbostat v2 - re-write for efficiency
Measuring large profoundly-idle configurations
requires turbostat to be more lightweight.
Otherwise, the operation of turbostat itself
can interfere with the measurements.
This re-write makes turbostat topology aware.
Hardware is accessed in "topology order".
Redundant hardware accesses are deleted.
Redundant output is deleted.
Also, output is buffered and
local RDTSC use replaces remote MSR access for TSC.
From a feature point of view, the output
looks different since redundant figures are absent.
Also, there are now -c and -p options -- to restrict
output to the 1st thread in each core, and the 1st
thread in each package, respectively. This is helpful
to reduce output on big systems, where more detail
than the "-s" system summary is desired.
Finally, periodic mode output is now on stdout, not stderr.
Turbostat v2 is also slightly more robust in
handling run-time CPU online/offline events,
as it now checks the actual map of on-line cpus rather
than just the total number of on-line cpus.
Signed-off-by: Len Brown <len.brown@intel.com>
2012-06-04 04:56:40 +00:00
|
|
|
CFLAGS += -Wall
|
turbostat: Don't put unprocessed uapi headers in the include path
turbostat's Makefile puts arch/x86/include/uapi/ in the include path, so
that it can include <asm/msr.h> from it. It isn't in general safe to
include even uapi headers directly from the kernel tree without
processing them through scripts/headers_install.sh, but asm/msr.h
happens to work.
However, that include path can break with some versions of system
headers, by overriding some system headers with the unprocessed versions
directly from the kernel source. For instance:
In file included from /build/x86-generic/usr/include/bits/sigcontext.h:28:0,
from /build/x86-generic/usr/include/signal.h:339,
from /build/x86-generic/usr/include/sys/wait.h:31,
from turbostat.c:27:
../../../../arch/x86/include/uapi/asm/sigcontext.h:4:28: fatal error: linux/compiler.h: No such file or directory
This occurs because the system bits/sigcontext.h on that build system
includes <asm/sigcontext.h>, and asm/sigcontext.h in the kernel source
includes <linux/compiler.h>, which scripts/headers_install.sh would have
filtered out.
Since turbostat really only wants a single header, just include that one
header rather than putting an entire directory of kernel headers on the
include path.
In the process, switch from msr.h to msr-index.h, since turbostat just
wants the MSR numbers.
Signed-off-by: Josh Triplett <josh@joshtriplett.org>
Cc: stable@vger.kernel.org
Signed-off-by: Len Brown <len.brown@intel.com>
2013-08-21 00:20:12 +00:00
|
|
|
CFLAGS += -DMSRHEADER='"../../../../arch/x86/include/uapi/asm/msr-index.h"'
|
2010-10-23 03:53:03 +00:00
|
|
|
|
2012-10-09 15:31:44 +00:00
|
|
|
%: %.c
|
|
|
|
@mkdir -p $(BUILD_OUTPUT)
|
|
|
|
$(CC) $(CFLAGS) $< -o $(BUILD_OUTPUT)/$@
|
2010-10-23 03:53:03 +00:00
|
|
|
|
2012-10-09 15:31:44 +00:00
|
|
|
.PHONY : clean
|
2010-10-23 03:53:03 +00:00
|
|
|
clean :
|
2012-10-09 15:31:44 +00:00
|
|
|
@rm -f $(BUILD_OUTPUT)/turbostat
|
2010-10-23 03:53:03 +00:00
|
|
|
|
2012-10-09 15:31:44 +00:00
|
|
|
install : turbostat
|
|
|
|
install -d $(DESTDIR)$(PREFIX)/bin
|
|
|
|
install $(BUILD_OUTPUT)/turbostat $(DESTDIR)$(PREFIX)/bin/turbostat
|
|
|
|
install -d $(DESTDIR)$(PREFIX)/share/man/man8
|
|
|
|
install turbostat.8 $(DESTDIR)$(PREFIX)/share/man/man8
|