* [PATCH v2 09/10] tools/power turbostat: Print cpuidle information [not found] <081c54323b27d8d4b40df6b2375b9e1f6846d827.1584766216.git.len.brown@intel.com> @ 2020-03-21 4:54 ` Len Brown 2020-03-25 0:50 ` Doug Smythies 0 siblings, 1 reply; 3+ messages in thread From: Len Brown @ 2020-03-21 4:54 UTC (permalink / raw) To: linux-pm; +Cc: Len Brown, Antti Laakso From: Len Brown <len.brown@intel.com> Print cpuidle driver and governor. Originally-by: Antti Laakso <antti.laakso@linux.intel.com> Signed-off-by: Len Brown <len.brown@intel.com> --- tools/power/x86/turbostat/turbostat.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/tools/power/x86/turbostat/turbostat.c b/tools/power/x86/turbostat/turbostat.c index 77f89371ec5f..05dbe23570d4 100644 --- a/tools/power/x86/turbostat/turbostat.c +++ b/tools/power/x86/turbostat/turbostat.c @@ -3503,6 +3503,23 @@ dump_cstate_pstate_config_info(unsigned int family, unsigned int model) dump_nhm_cst_cfg(); } +static void dump_sysfs_file(char *path) +{ + FILE *input; + char cpuidle_buf[64]; + + input = fopen(path, "r"); + if (input == NULL) { + if (debug) + fprintf(outf, "NSFOD %s\n", path); + return; + } + if (!fgets(cpuidle_buf, sizeof(cpuidle_buf), input)) + err(1, "%s: failed to read file", path); + fclose(input); + + fprintf(outf, "%s: %s", strrchr(path, '/') + 1, cpuidle_buf); +} static void dump_sysfs_cstate_config(void) { @@ -3516,6 +3533,15 @@ dump_sysfs_cstate_config(void) if (!DO_BIC(BIC_sysfs)) return; + if (access("/sys/devices/system/cpu/cpuidle", R_OK)) { + fprintf(outf, "cpuidle not loaded\n"); + return; + } + + dump_sysfs_file("/sys/devices/system/cpu/cpuidle/current_driver"); + dump_sysfs_file("/sys/devices/system/cpu/cpuidle/current_governor"); + dump_sysfs_file("/sys/devices/system/cpu/cpuidle/current_governor_ro"); + for (state = 0; state < 10; ++state) { sprintf(path, "/sys/devices/system/cpu/cpu%d/cpuidle/state%d/name", -- 2.20.1 ^ permalink raw reply related [flat|nested] 3+ messages in thread
* RE: [PATCH v2 09/10] tools/power turbostat: Print cpuidle information 2020-03-21 4:54 ` [PATCH v2 09/10] tools/power turbostat: Print cpuidle information Len Brown @ 2020-03-25 0:50 ` Doug Smythies 2020-08-13 21:14 ` Len Brown 0 siblings, 1 reply; 3+ messages in thread From: Doug Smythies @ 2020-03-25 0:50 UTC (permalink / raw) To: 'Len Brown', linux-pm; +Cc: 'Len Brown', 'Antti Laakso' Hi Len, On 2020.03.20 21:55 Len Brown wrote: > From: Len Brown <len.brown@intel.com> > > Print cpuidle driver and governor. > > Originally-by: Antti Laakso <antti.laakso@linux.intel.com> > Signed-off-by: Len Brown <len.brown@intel.com> > --- > tools/power/x86/turbostat/turbostat.c | 26 ++++++++++++++++++++++++++ > 1 file changed, 26 insertions(+) > > diff --git a/tools/power/x86/turbostat/turbostat.c b/tools/power/x86/turbostat/turbostat.c > index 77f89371ec5f..05dbe23570d4 100644 > --- a/tools/power/x86/turbostat/turbostat.c > +++ b/tools/power/x86/turbostat/turbostat.c ... > > static void > dump_sysfs_cstate_config(void) > { > @@ -3516,6 +3533,15 @@ dump_sysfs_cstate_config(void) > if (!DO_BIC(BIC_sysfs)) > return; I do not understand why this information needs to be a function of the --show options and not solely a function of the --quiet option. My reasoning is that I almost always want all the information possible in the start spew of stuff, and if I don't I'll use --quiet option. However, I rarely show more than about 6 columns at a time resulting in intermittent inclusion of this information. > > + if (access("/sys/devices/system/cpu/cpuidle", R_OK)) { > + fprintf(outf, "cpuidle not loaded\n"); > + return; > + } > + > + dump_sysfs_file("/sys/devices/system/cpu/cpuidle/current_driver"); > + dump_sysfs_file("/sys/devices/system/cpu/cpuidle/current_governor"); > + dump_sysfs_file("/sys/devices/system/cpu/cpuidle/current_governor_ro"); > + > for (state = 0; state < 10; ++state) { > > sprintf(path, "/sys/devices/system/cpu/cpu%d/cpuidle/state%d/name", ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2 09/10] tools/power turbostat: Print cpuidle information 2020-03-25 0:50 ` Doug Smythies @ 2020-08-13 21:14 ` Len Brown 0 siblings, 0 replies; 3+ messages in thread From: Len Brown @ 2020-08-13 21:14 UTC (permalink / raw) To: Doug Smythies; +Cc: Linux PM list, Len Brown, Antti Laakso Doug, I agree with you. Looks like an oversight -- will fix. thanks! -Len On Tue, Mar 24, 2020 at 8:50 PM Doug Smythies <dsmythies@telus.net> wrote: > > Hi Len, > > On 2020.03.20 21:55 Len Brown wrote: > > > From: Len Brown <len.brown@intel.com> > > > > Print cpuidle driver and governor. > > > > Originally-by: Antti Laakso <antti.laakso@linux.intel.com> > > Signed-off-by: Len Brown <len.brown@intel.com> > > --- > > tools/power/x86/turbostat/turbostat.c | 26 ++++++++++++++++++++++++++ > > 1 file changed, 26 insertions(+) > > > > diff --git a/tools/power/x86/turbostat/turbostat.c b/tools/power/x86/turbostat/turbostat.c > > index 77f89371ec5f..05dbe23570d4 100644 > > --- a/tools/power/x86/turbostat/turbostat.c > > +++ b/tools/power/x86/turbostat/turbostat.c > > > ... > > > > > static void > > dump_sysfs_cstate_config(void) > > { > > @@ -3516,6 +3533,15 @@ dump_sysfs_cstate_config(void) > > if (!DO_BIC(BIC_sysfs)) > > return; > > I do not understand why this information needs to be > a function of the --show options and not solely a > function of the --quiet option. > > My reasoning is that I almost always want all the information > possible in the start spew of stuff, and if I don't I'll > use --quiet option. However, I rarely show more than > about 6 columns at a time resulting in intermittent inclusion > of this information. > > > > > + if (access("/sys/devices/system/cpu/cpuidle", R_OK)) { > > + fprintf(outf, "cpuidle not loaded\n"); > > + return; > > + } > > + > > + dump_sysfs_file("/sys/devices/system/cpu/cpuidle/current_driver"); > > + dump_sysfs_file("/sys/devices/system/cpu/cpuidle/current_governor"); > > + dump_sysfs_file("/sys/devices/system/cpu/cpuidle/current_governor_ro"); > > + > > for (state = 0; state < 10; ++state) { > > > > sprintf(path, "/sys/devices/system/cpu/cpu%d/cpuidle/state%d/name", > > -- Len Brown, Intel Open Source Technology Center ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-08-13 21:14 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <081c54323b27d8d4b40df6b2375b9e1f6846d827.1584766216.git.len.brown@intel.com>
2020-03-21 4:54 ` [PATCH v2 09/10] tools/power turbostat: Print cpuidle information Len Brown
2020-03-25 0:50 ` Doug Smythies
2020-08-13 21:14 ` Len Brown
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox