Skip to content

Commit

Permalink
tools/power turbostat: add POLL and POLL% column
Browse files Browse the repository at this point in the history
Like the "C1" and "C1%" column, the new POLL and POLL% columns
show invocations and residency% during the measurement interval.

While it didn't seem important to track in the past,
we've recently found some Linux cpuidle bugs related to POLL%.

Signed-off-by: Len Brown <len.brown@intel.com>
  • Loading branch information
Len Brown committed Jun 2, 2018
1 parent 4bd1f8f commit 0748eaf
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions tools/power/x86/turbostat/turbostat.c
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,8 @@ char *progname;
#define CPU_SUBSET_MAXCPUS 1024 /* need to use before probe... */
cpu_set_t *cpu_present_set, *cpu_affinity_set, *cpu_subset;
size_t cpu_present_setsize, cpu_affinity_setsize, cpu_subset_size;
#define MAX_ADDED_COUNTERS 16
#define MAX_ADDED_COUNTERS 8
#define MAX_ADDED_THREAD_COUNTERS 24

struct thread_data {
struct timeval tv_begin;
Expand All @@ -169,7 +170,7 @@ struct thread_data {
unsigned int flags;
#define CPU_IS_FIRST_THREAD_IN_CORE 0x2
#define CPU_IS_FIRST_CORE_IN_PACKAGE 0x4
unsigned long long counter[MAX_ADDED_COUNTERS];
unsigned long long counter[MAX_ADDED_THREAD_COUNTERS];
} *thread_even, *thread_odd;

struct core_data {
Expand Down Expand Up @@ -4882,7 +4883,7 @@ int add_counter(unsigned int msr_num, char *path, char *name,
msrp->next = sys.tp;
sys.tp = msrp;
sys.added_thread_counters++;
if (sys.added_thread_counters > MAX_ADDED_COUNTERS) {
if (sys.added_thread_counters > MAX_ADDED_THREAD_COUNTERS) {
fprintf(stderr, "exceeded max %d added thread counters\n",
MAX_ADDED_COUNTERS);
exit(-1);
Expand Down Expand Up @@ -5041,7 +5042,7 @@ void probe_sysfs(void)
if (!DO_BIC(BIC_sysfs))
return;

for (state = 10; state > 0; --state) {
for (state = 10; state >= 0; --state) {

sprintf(path, "/sys/devices/system/cpu/cpu%d/cpuidle/state%d/name",
base_cpu, state);
Expand All @@ -5068,7 +5069,7 @@ void probe_sysfs(void)
FORMAT_PERCENT, SYSFS_PERCPU);
}

for (state = 10; state > 0; --state) {
for (state = 10; state >= 0; --state) {

sprintf(path, "/sys/devices/system/cpu/cpu%d/cpuidle/state%d/name",
base_cpu, state);
Expand Down

0 comments on commit 0748eaf

Please sign in to comment.