aboutsummaryrefslogtreecommitdiffstats
path: root/tools/power/cpupower/utils/idle_monitor (follow)
AgeCommit message (Collapse)AuthorFilesLines
2019-05-30treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 166Thomas Gleixner9-22/+9
Based on 1 normalized pattern(s): licensed under the terms of the gnu gpl license version 2 extracted by the scancode license scanner the SPDX license identifier GPL-2.0-only has been chosen to replace the boilerplate/reference in 62 file(s). Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Allison Randal <allison@lohutok.net> Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org> Reviewed-by: Richard Fontana <rfontana@redhat.com> Cc: linux-spdx@vger.kernel.org Link: https://lkml.kernel.org/r/20190527070033.929121379@linutronix.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-10-04tools/cpupower: Add Hygon Dhyana supportPu Wen1-1/+2
The tool cpupower is useful to get CPU frequency information and monitor power stats on the Hygon Dhyana platform. So add Hygon Dhyana support to it by checking vendor and family to share the code path of AMD family 17h. Signed-off-by: Pu Wen <puwen@hygon.cn> Signed-off-by: Borislav Petkov <bp@suse.de> Acked-by: Shuah Khan (Samsung OSG) <shuah@kernel.org> CC: Prarit Bhargava <prarit@redhat.com> CC: Shuah Khan <shuah@kernel.org> CC: Thomas Gleixner <tglx@linutronix.de> CC: Thomas Renninger <trenn@suse.com> CC: linux-pm@vger.kernel.org Link: http://lkml.kernel.org/r/5ce86123a7b9dad925ac583d88d2f921040e859b.1538583282.git.puwen@hygon.cn
2018-05-29cpupower : Fix header name to read idle state nameAbhishek Goel3-15/+44
The names of the idle states in the output of cpupower monitor command are truncated to 4 characters. On POWER9, this creates ambiguity as the states are named "stop0", "stop1", etc. root:~# cpupower monitor |Idle_Stats PKG |CORE|CPU | snoo | stop | stop | stop | stop | stop | stop 0| 0| 0| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00| 1.90 0| 0| 1| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00 0| 0| 2| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00 0| 0| 3| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00 This patch modifies the output to print the state name that results in a legible output. The names will be printed with atmost 1 padding in left. root:~# cpupower monitor | Idle_Stats PKG|CORE| CPU|snooze|stop0L| stop0|stop1L| stop1|stop2L| stop2 0| 0| 0| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00| 0.72 0| 0| 1| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00 0| 0| 2| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00 0| 0| 3| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00 This patch does not affect the output for intel. Output for intel before applying the patch: root:~# cpupower monitor |Idle_Stats CPU | POLL | C1-S | C1E- | C3-S | C6-S | C7s- | C8-S | C9-S | C10- 0| 0.00| 0.14| 0.39| 0.35| 7.41| 0.00| 17.67| 1.01| 70.03 2| 0.00| 0.19| 0.47| 0.10| 6.50| 0.00| 29.66| 2.17| 58.07 1| 0.00| 0.11| 0.50| 1.50| 9.11| 0.18| 18.19| 0.40| 66.63 3| 0.00| 0.67| 0.42| 0.03| 5.84| 0.00| 12.58| 0.77| 77.14 Output for intel after applying the patch: root:~# cpupower monitor | Idle_Stats CPU| POLL | C1-S | C1E- | C3-S | C6-S | C7s- | C8-S | C9-S | C10- 0| 0.03| 0.33| 1.01| 0.27| 3.03| 0.00| 19.18| 0.00| 71.24 2| 0.00| 1.58| 0.58| 0.42| 8.55| 0.09| 21.11| 0.99| 63.32 1| 0.00| 1.26| 0.88| 0.43| 9.00| 0.02| 7.78| 4.65| 71.91 3| 0.00| 0.30| 0.42| 0.06| 13.62| 0.21| 30.29| 0.00| 52.45 Signed-off-by: Abhishek Goel <huntbag@linux.vnet.ibm.com> Signed-off-by: Shuah Khan (Samsung OSG) <shuah@kernel.org>
2017-11-15cpupower : Fix cpupower working when cpu0 is offlineAbhishek Goel1-3/+6
cpuidle_monitor used to assume that cpu0 is always online which is not a valid assumption on POWER machines. This patch fixes this by getting the cpu on which the current thread is running, instead of always using cpu0 for monitoring which may not be online. Signed-off-by: Abhishek Goel <huntbag@linux.vnet.ibm.com> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2017-07-31tools/power/cpupower: allow running without cpu0Prarit Bhargava4-9/+10
Linux-3.7 added CONFIG_BOOTPARAM_HOTPLUG_CPU0, allowing systems to offline cpu0. But when cpu0 is offline, cpupower monitor will not display all processor and Mperf information: [root@intel-skylake-dh-03 cpupower]# ./cpupower monitor WARNING: at least one cpu is offline |Idle_Stats CPU | POLL | C1-S | C1E- | C3-S | C6-S | C7s- | C8-S 4| 0.00| 0.00| 0.00| 0.00| 0.90| 0.00| 96.13 1| 0.00| 0.00| 5.49| 0.00| 0.01| 0.00| 92.26 5| 0.00| 0.00| 0.00| 0.00| 0.46| 0.00| 99.50 2| 45.42| 0.00| 0.00| 0.00| 22.94| 0.00| 28.84 6| 0.00| 37.54| 0.00| 0.00| 0.00| 0.00| 0.00 3| 0.00| 0.00| 0.00| 0.00| 0.30| 0.00| 91.99 7| 0.00| 0.00| 0.00| 0.00| 4.70| 0.00| 0.70 This patch replaces the hard-coded use of cpu0 in cpupower with the current cpu, allowing it to run without a cpu0. After the patch is applied, [root@intel-skylake-dh-03 cpupower]# ./cpupower monitor WARNING: at least one cpu is offline |Nehalem || Mperf || Idle_Stats CPU | C3 | C6 | PC3 | PC6 || C0 | Cx | Freq || POLL | C1-S | C1E- | C3-S | C6-S | C7s- | C8-S 4| 0.01| 1.27| 0.00| 0.00|| 0.04| 99.96| 3957|| 0.00| 0.00| 0.00| 0.00| 1.43| 0.00| 98.52 1| 0.00| 98.82| 0.00| 0.00|| 0.05| 99.95| 3361|| 0.00| 0.00| 0.01| 0.00| 0.03| 0.00| 99.88 5| 0.00| 98.82| 0.00| 0.00|| 0.09| 99.91| 3917|| 0.00| 0.00| 0.00| 0.00| 99.38| 0.00| 0.50 2| 0.33| 0.00| 0.00| 0.00|| 0.00|100.00| 3890|| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00|100.00 6| 0.33| 0.00| 0.00| 0.00|| 0.01| 99.99| 3903|| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00| 99.99 3| 0.01| 0.71| 0.00| 0.00|| 0.06| 99.94| 3678|| 0.00| 0.00| 0.00| 0.00| 0.80| 0.00| 99.13 7| 0.01| 0.71| 0.00| 0.00|| 0.03| 99.97| 3538|| 0.00| 0.69| 11.70| 0.00| 0.00| 0.00| 87.57 There are some minor cleanups included in this patch. Signed-off-by: Prarit Bhargava <prarit@redhat.com> Signed-off-by: Thomas Renninger <trenn@suse.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2016-04-28cpupower: Add cpuidle parts into libraryThomas Renninger1-6/+6
This more or less is a renaming and moving of functions and should not introduce any functional change. cpupower was built from cpufrequtils (which had a C library providing easy access to cpu frequency platform info). In the meantime it got enhanced by quite some neat cpuidle userspace tools. Now the cpu idle functions have been separated and added to the cpupower.so library. So beside an already existing public header file: cpufreq.h cpupower now also exports these cpu idle functions in: cpuidle.h Here again pasted for better review of the interfaces: ====================================== int cpuidle_is_state_disabled(unsigned int cpu, unsigned int idlestate); int cpuidle_state_disable(unsigned int cpu, unsigned int idlestate, unsigned int disable); unsigned long cpuidle_state_latency(unsigned int cpu, unsigned int idlestate); unsigned long cpuidle_state_usage(unsigned int cpu, unsigned int idlestate); unsigned long long cpuidle_state_time(unsigned int cpu, unsigned int idlestate); char *cpuidle_state_name(unsigned int cpu, unsigned int idlestate); char *cpuidle_state_desc(unsigned int cpu, unsigned int idlestate); unsigned int cpuidle_state_count(unsigned int cpu); char *cpuidle_get_governor(void); char *cpuidle_get_driver(void); ====================================== Signed-off-by: Thomas Renninger <trenn@suse.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2015-11-02cpupower: cpupower monitor reports uninitialized values for offline cpusJacob Tanenbaum1-1/+8
[root@hp-dl980g7-02 linux]# cpupower monitor ... 5472| 0| 1|******|******|******|******|| 0.00| 0.00| 0.00| 0.00| 0.00 *is offline 10567| 0| 159|******|******|******|******|| 0.00| 0.00| 0.00| 0.00| 0.00 *is offline 1661206560|859272560| 150|******|******|******|******|| 0.00| 0.00| 0.00| 0.00| 0.00 *is offline 1661206560|943093104| 140|******|******|******|******|| 0.00| 0.00| 0.00| 0.00| 0.00 *is offline because of this cpupower also holds the incorrect value for the number of physical packages in the machine Changed cpupower to initialize the values of an offline cpu's socket and core to -1, warn the user that one or more cpus is/are offline and not print statistics for offline cpus. This fix hides offlined cores where topology cannot be accessed. With a recent kernel patch suggested from Prarit Bhargava it may be possible that soft offlined cores' topology can still be parsed. This patch would then show which cores in which package/socket are offline, when sane toplogoy information is available. Signed-off-by: Jacob Tanenbaum <jtanenba@redhat.com> Signed-off-by: Thomas Renninger <trenn@suse.de> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2015-05-30cpupower: mperf monitor: fix output in MAX_FREQ_SYSFS modeHerton R. Krzesinski1-2/+3
There is clearly wrong output when mperf monitor runs in MAX_FREQ_SYSFS mode: average frequency shows in kHz unit (despite the intended output to be in MHz), and percentages for C state information are all wrong (including high/negative values shown). The problem is that the max_frequency read on initialization isn't used where it should have been used on mperf_get_count_percent (to estimate the number of ticks in the given time period), and the value we read from sysfs is in kHz, so we must divide it to get the MHz value to use in current calculations. While at it, also I fixed another small issues in the debug output of max_frequency value in mperf_get_count_freq. Signed-off-by: Herton R. Krzesinski <herton@redhat.com> Acked-by: Thomas Renninger <trenn@suse.de> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2014-07-30cpupower: mperf monitor: Correct use of ! and &Himangi Saraogi1-1/+1
In commit ae91d60ba88ef0bdb1b5e9b2363bd52fc45d2af7, a bug was fixed that involved converting !x & y to !(x & y). The code below shows the same pattern, and thus should perhaps be fixed in the same way. The Coccinelle semantic patch that makes this change is as follows: // <smpl> @@ expression E1,E2; @@ ( !E1 & !E2 | - !E1 & E2 + !(E1 & E2) ) // </smpl> Signed-off-by: Himangi Saraogi <himangi774@gmail.com> Signed-off-by: Thomas Renninger <trenn@suse.de> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2013-07-05cpupower: Add Haswell family 0x45 specific idle monitor to show PC8,9,10 statesThomas Renninger2-0/+197
This specific processor supports 3 new package sleep states. Provide a monitor, so that the user can see their usage. Signed-off-by: Thomas Renninger <trenn@suse.de> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2013-07-05cpupower: Haswell also supports the C-states introduced with SandyBridgeThomas Renninger1-0/+4
Add Haswell model numbers to snb_register() as it also supports the C-states introduced in SandyBridge processors. [rjw: Changelog] Signed-off-by: Thomas Renninger <trenn@suse.de> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2012-11-27cpupower: IvyBridge (0x3a and 0x3e models) supportThomas Renninger1-2/+8
Signed-off-by: Thomas Renninger <trenn@suse.de> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2012-11-27cpupower: Provide -c param for cpupower monitor to schedule process on all coresThomas Renninger2-1/+34
If an MSR based monitor is run in parallel this is not needed. This is the default case on all/most Intel machines. But when only sysfs info is read via cpupower monitor -m Idle_Stats (typically the case for non root users) or when other monitors are PCI based (AMD), Idle_Stats, read from sysfs can be totally bogus: cpupower monitor -m Idle_Stats PKG |CORE|CPU | POLL | C1-N | C3-N | C6-N 0| 0| 0| 0.00| 0.00| 0.24| 99.81 0| 0| 32| 0.00| 0.00| 0.00| 100.7 ... 0| 17| 20| 0.00| 0.00| 0.00| 173.1 0| 17| 52| 0.00| 0.00| 0.07| 173.0 0| 18| 68| 0.00| 0.00| 0.00| 0.00 0| 18| 76| 0.00| 0.00| 0.00| 0.00 ... With the -c option all cores are woken up and the kernel did update cpuidle statistics before reading out sysfs. This causes some overhead. Therefore avoid if possible, use if needed: cpupower monitor -c -m Idle_Stats PKG |CORE|CPU | POLL | C1-N | C3-N | C6-N 0| 0| 0| 0.00| 0.00| 0.00| 100.2 0| 0| 32| 0.00| 0.00| 0.00| 100.2 ... 0| 8| 8| 0.00| 0.00| 0.00| 99.82 0| 8| 40| 0.00| 0.00| 0.00| 99.81 0| 9| 24| 0.00| 0.00| 0.00| 100.3 0| 9| 56| 0.00| 0.00| 0.00| 100.2 0| 16| 4| 0.00| 0.00| 0.00| 99.75 0| 16| 36| 0.00| 0.00| 0.00| 99.38 ... Signed-off-by: Thomas Renninger <trenn@suse.de> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2012-11-27cpupower tools: Fix minor warningsPalmer Cox1-2/+1
Fix minor warnings reported with GCC 4.6: * The sysfs_write_file function is unused - remove it. * The pr_mon_len in the print_header function is unsed - remove it. Signed-off-by: Palmer Cox <p@lmercox.com> Signed-off-by: Thomas Renninger <trenn@suse.de> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2012-03-03cpupower: AMD fam14h/Ontario monitor can also be used by fam12h cpusThomas Renninger1-8/+8
The name of the monitor is updated at runtime to the name of the CPU type. Signed-off-by: Thomas Renninger <trenn@suse.de> CC: Andreas Herrmann <herrmann.der.user@googlemail.com> Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
2012-03-03cpupower: Better interface for accessing AMD pci registersThomas Renninger1-6/+3
AMD's BKDG (Bios and Kernel Developers Guide) talks in the CPU spec of their CPU families about PCI registers defined by "device" (slot) and func(tion). Assuming that CPU specific configuration PCI devices are always on domain and bus zero a pci_slot_func_init() func which gets the slot and func of the desired PCI device passed looks like the most convenient way. This also obsoletes the PCI device id maintenance. Signed-off-by: Thomas Renninger <trenn@suse.de> CC: Andreas Herrmann <herrmann.der.user@googlemail.com> Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
2011-08-19cpupower: use man(1) when calling "cpupower help subcommand"Dominik Brodowski1-34/+14
Instead of printing something non-formatted to stdout, call man(1) to show the man page for the proper subcommand. Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
2011-08-15cpupower: Make monitor command -c/--cpu awareThomas Renninger1-0/+8
This allows for example: cpupower -c 2-4,6 monitor -m Mperf |Mperf PKG |CORE|CPU | C0 | Cx | Freq 0| 8| 4| 2.42| 97.58| 1353 0| 16| 2| 14.38| 85.62| 1928 0| 24| 6| 1.76| 98.24| 1442 1| 16| 3| 15.53| 84.47| 1650 CPUs always get resorted for package, core then cpu id if it could get read out (or however you name these topology levels...). Still this is a nice way to keep the overview if a test binary is bound to a specific CPU or if one wants to show all CPUs inside a package or similar. Still missing: Do not measure not available cores to reduce the overhead and achieve better results. Signed-off-by: Thomas Renninger <trenn@suse.de> Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
2011-08-15cpupower: Better detect offlined CPUsThomas Renninger1-3/+7
Before, checking for offlined CPUs was done dirty and it was checked whether topology parsing returned -1 values. But this is a valid case on a Xen (and possibly other) kernels. Do proper online/offline checking, also take CONFIG_HOTPLUG_CPU option into account (no /sys/devices/../cpuX/online file). Signed-off-by: Thomas Renninger <trenn@suse.de> Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
2011-08-15cpupower: Do not show an empty Idle_Stats monitor if no idle driver is availableThomas Renninger1-1/+1
By taking error values of: sysfs_get_idlestate_count(..); into account. Signed-off-by: Thomas Renninger <trenn@suse.de> Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
2011-08-15cpupower: mperf monitor - Use TSC to calculate max frequency if possibleThomas Renninger1-47/+130
Which makes the implementation independent from cpufreq drivers. Therefore this would also work on a Xen kernel where the hypervisor is doing frequency switching and idle entering. Signed-off-by: Thomas Renninger <trenn@suse.de> Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
2011-07-29cpupowerutils: idle_monitor - ConfigStyle bugfixesDominik Brodowski6-115/+128
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
2011-07-29cpupowerutils - cpufrequtils extended with quite some featuresDominik Brodowski9-0/+1723
CPU power consumption vs performance tuning is no longer limited to CPU frequency switching anymore: deep sleep states, traditional dynamic frequency scaling and hidden turbo/boost frequencies are tied close together and depend on each other. The first two exist on different architectures like PPC, Itanium and ARM, the latter (so far) only on X86. On X86 the APU (CPU+GPU) will only run most efficiently if CPU and GPU has proper power management in place. Users and Developers want to have *one* tool to get an overview what their system supports and to monitor and debug CPU power management in detail. The tool should compile and work on as many architectures as possible. Once this tool stabilizes a bit, it is intended to replace the Intel-specific tools in tools/power/x86 Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>