cpupower: rapl monitor - shows the used power consumption in uj for each rapl domain
PATCH 2/2 cpupower: rapl monitor - shows the used power consumption in uj for each rapl domain
This CPU power monitor shows the power consumption as exposed by the powercap subsystem, cmp with:Documentation/power/powercap/powercap.rst
cpupower monitor -m RAPL
CPU| pack | core | unco 0|6853926|967832|442381 8|6853926|967832|442381 1|6853926|967832|442381 9|6853926|967832|442381
Unfortunately RAPL domains cannot be directly mapped to the corresponding CPU socket/package, core it belongs to.
Not sure this is possible at all with the current data exposed from the kernel.
Still it can be worthful information for developers trying to optimize power consumption of workloads or their system in general.
--- tools/power/cpupower/Makefile | 1 + .../utils/idle_monitor/cpupower-monitor.c | 7 +- .../utils/idle_monitor/idle_monitors.def | 1 + .../utils/idle_monitor/rapl_monitor.c | 147 ++++++++++++++++++ 4 files changed, 153 insertions(+), 3 deletions(-) create mode 100644 tools/power/cpupower/utils/idle_monitor/rapl_monitor.c
tools/power/cpupower/Makefile +1 -0
@@ -131,6 +131,7 @@ UTIL_OBJS = utils/helpers/amd.o utils/helpers/msr.o \ utils/idle_monitor/hsw_ext_idle.o \ utils/idle_monitor/amd_fam14h_idle.o utils/idle_monitor/cpuidle_sysfs.o \ utils/idle_monitor/mperf_monitor.o utils/idle_monitor/cpupower-monitor.o \ + utils/idle_monitor/rapl_monitor.o \ utils/cpupower.o utils/cpufreq-info.o utils/cpufreq-set.o \ utils/cpupower-set.o utils/cpupower-info.o utils/cpuidle-info.o \ utils/cpuidle-set.o utils/powercap-info.o
tools/power/cpupower/utils/idle_monitor/cpupower-monitor.c +4 -3
@@ -459,9 +459,10 @@ int cmd_monitor(int argc, char **argv)print_results (1 , cpu); } -for (num =0 ; num < avail_monitors; num++) - monitors[num]->unregister (); - +for (num =0 ; num < avail_monitors; num++) { +if (monitors[num]->unregister) + monitors[num]->unregister (); + }cpu_topology_release (cpu_top);return 0 ; }
tools/power/cpupower/utils/idle_monitor/idle_monitors.def +1 -0
@@ -4,5 +4,6 @@ DEF(intel_nhm) DEF(intel_snb) DEF(intel_hsw_ext) DEF(mperf) +DEF(rapl) #endif DEF(cpuidle_sysfs)
tools/power/cpupower/utils/idle_monitor/rapl_monitor.c new file +147 -0
147 lines not on this page · raw message
Signature · 1 line
2.37.1
Shuah Khan
maintainerQuoted 76 lines · Thomas Renninger
This CPU power monitor shows the power consumption as exposed by the powercap subsystem, cmp with:
Documentation/power/powercap/powercap.rstcpupower monitor -m RAPL
CPU| pack | core | unco 0|6853926|967832|442381 8|6853926|967832|442381 1|6853926|967832|442381 9|6853926|967832|442381Unfortunately RAPL domains cannot be directly mapped to the corresponding CPU socket/package, core it belongs to.
Not sure this is possible at all with the current data exposed from the kernel.Still it can be worthful information for developers trying to optimize power consumption of workloads or their system in general.
Signed-off-by Thomas Renninger <[email protected]>CC Zhang Rui <[email protected]>CC Shuah Khan <[email protected]>--- tools/power/cpupower/Makefile | 1 + .../utils/idle_monitor/cpupower-monitor.c | 7 +- .../utils/idle_monitor/idle_monitors.def | 1 + .../utils/idle_monitor/rapl_monitor.c | 147 ++++++++++++++++++ 4 files changed, 153 insertions(+), 3 deletions(-)create mode 100644
tools/power/cpupower/utils/idle_monitor/rapl_monitor.ctools/power/cpupower/Makefile +1
-0@@ -131,6 +131,7 @@ UTIL_OBJS = utils/helpers/amd.o utils/helpers/msr.o \ utils/idle_monitor/hsw_ext_idle.o \ utils/idle_monitor/amd_fam14h_idle.o utils/idle_monitor/cpuidle_sysfs.o \ utils/idle_monitor/mperf_monitor.o utils/idle_monitor/cpupower-monitor.o \ + utils/idle_monitor/rapl_monitor.o \ utils/cpupower.o utils/cpufreq-info.o utils/cpufreq-set.o \ utils/cpupower-set.o utils/cpupower-info.o utils/cpuidle-info.o \ utils/cpuidle-set.o utils/powercap-info.otools/power/cpupower/utils/idle_monitor/cpupower-monitor.c +4
-3@@ -459,9 +459,10 @@ int cmd_monitor(int argc, char **argv)print_results (1 , cpu); } -for (num =0 ; num < avail_monitors; num++) - monitors[num]->unregister (); - +for (num =0 ; num < avail_monitors; num++) { +if (monitors[num]->unregister) + monitors[num]->unregister (); + }cpu_topology_release (cpu_top);return 0 ; }tools/power/cpupower/utils/idle_monitor/idle_monitors.def +1
-0@@ -4,5 +4,6 @@ DEF(intel_nhm) DEF(intel_snb) DEF(intel_hsw_ext) DEF(mperf) +DEF(rapl) #endif DEF(cpuidle_sysfs)tools/power/cpupower/utils/idle_monitor/rapl_monitor.c new file +0
-0
tools/power/cpupower/utils/idle_monitor/rapl_monitor.c line 4
Quoted 4 lines
tools/power/cpupower/utils/idle_monitor/rapl_monitor.c new file +4
-0@@ -0,0 +1,147 @@ +/* +* (C) 2016 Thomas Renninger <[email protected]> +* +* Licensed under the terms of the GNU GPL License version 2.
Missing SPDX - please add
tools/power/cpupower/utils/idle_monitor/rapl_monitor.c line 8
Quoted 4 lines
tools/power/cpupower/utils/idle_monitor/rapl_monitor.c new file +4
-0+* +*/ + +#if defined(__i386__) || defined(__x86_64__)
I am seeing checpatch errors in this one as well in addition to missing SPDX.
Running checkpatch will show you some of the errors.
thanks,
-- Shuah