Commit b1092465 authored by Rafael J. Wysocki's avatar Rafael J. Wysocki
Browse files

Merge tag 'linux-cpupower-6.17-rc1-fixed' of...

Merge tag 'linux-cpupower-6.17-rc1-fixed' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux

Merge cpupower utility changes for 6.17-rc1 from Shuah Khan:

"Fixes
  - snapshot-order of tsc,mperf, clock in mperf_stop()
  - printing of CORE, CPU fields in cpupower-monitor

 Improves Python binding's Makefile"

* tag 'linux-cpupower-6.17-rc1-fixed' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux:
  cpupower: Improve Python binding's Makefile
  pm: cpupower: Fix printing of CORE, CPU fields in cpupower-monitor
  pm: cpupower: Fix the snapshot-order of tsc,mperf, clock in mperf_stop()
parents d7b8f8e2 b74710ea
Loading
Loading
Loading
Loading
+7 −5
Original line number Diff line number Diff line
@@ -4,20 +4,22 @@
# This Makefile expects you have already run `make install-lib` in the lib
# directory for the bindings to be created.

CC := gcc
CC ?= gcc
# CFLAGS ?=
LDFLAGS ?= -lcpupower
HAVE_SWIG := $(shell if which swig >/dev/null 2>&1; then echo 1; else echo 0; fi)
HAVE_PYCONFIG := $(shell if which python-config >/dev/null 2>&1; then echo 1; else echo 0; fi)

PY_INCLUDE = $(firstword $(shell python-config --includes))
INSTALL_DIR = $(shell python3 -c "import site; print(site.getsitepackages()[0])")
PY_INCLUDE ?= $(firstword $(shell python-config --includes))
INSTALL_DIR ?= $(shell python3 -c "import site; print(site.getsitepackages()[0])")

all: _raw_pylibcpupower.so

_raw_pylibcpupower.so: raw_pylibcpupower_wrap.o
	$(CC) -shared -lcpupower raw_pylibcpupower_wrap.o -o _raw_pylibcpupower.so
	$(CC) -shared $(LDFLAGS) raw_pylibcpupower_wrap.o -o _raw_pylibcpupower.so

raw_pylibcpupower_wrap.o: raw_pylibcpupower_wrap.c
	$(CC) -fPIC -c raw_pylibcpupower_wrap.c $(PY_INCLUDE)
	$(CC) $(CFLAGS) $(PY_INCLUDE) -fPIC -c raw_pylibcpupower_wrap.c

raw_pylibcpupower_wrap.c: raw_pylibcpupower.swg
ifeq ($(HAVE_SWIG),0)
+0 −4
Original line number Diff line number Diff line
@@ -121,10 +121,8 @@ void print_header(int topology_depth)
	switch (topology_depth) {
	case TOPOLOGY_DEPTH_PKG:
		printf(" PKG|");
		break;
	case TOPOLOGY_DEPTH_CORE:
		printf("CORE|");
		break;
	case	TOPOLOGY_DEPTH_CPU:
		printf(" CPU|");
		break;
@@ -167,10 +165,8 @@ void print_results(int topology_depth, int cpu)
	switch (topology_depth) {
	case TOPOLOGY_DEPTH_PKG:
		printf("%4d|", cpu_top.core_info[cpu].pkg);
		break;
	case TOPOLOGY_DEPTH_CORE:
		printf("%4d|", cpu_top.core_info[cpu].core);
		break;
	case TOPOLOGY_DEPTH_CPU:
		printf("%4d|", cpu_top.core_info[cpu].cpu);
		break;
+2 −2
Original line number Diff line number Diff line
@@ -240,9 +240,9 @@ static int mperf_stop(void)
	int cpu;

	for (cpu = 0; cpu < cpu_count; cpu++) {
		mperf_measure_stats(cpu);
		mperf_get_tsc(&tsc_at_measure_end[cpu]);
		clock_gettime(CLOCK_REALTIME, &time_end[cpu]);
		mperf_get_tsc(&tsc_at_measure_end[cpu]);
		mperf_measure_stats(cpu);
	}

	return 0;