From 91377c3cde8e4e51cbeffce7f726f8976e04db46 Mon Sep 17 00:00:00 2001 From: Len Brown Date: Wed, 13 Jun 2012 21:31:46 -0400 Subject: [PATCH] --- yaml --- r: 318826 b: refs/heads/master c: c3ae331d1c2fe25edfbece73fda0bb312445b636 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/tools/power/x86/turbostat/turbostat.c | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/[refs] b/[refs] index 69b0d5f53cb5..efce81b7102d 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: c98d5d9444732a032bc55d1a496bfa8439da9199 +refs/heads/master: c3ae331d1c2fe25edfbece73fda0bb312445b636 diff --git a/trunk/tools/power/x86/turbostat/turbostat.c b/trunk/tools/power/x86/turbostat/turbostat.c index b815a12159b2..861d77190206 100644 --- a/trunk/tools/power/x86/turbostat/turbostat.c +++ b/trunk/tools/power/x86/turbostat/turbostat.c @@ -444,6 +444,9 @@ delta_core(struct core_data *new, struct core_data *old) old->c7 = new->c7 - old->c7; } +/* + * old = new - old + */ void delta_thread(struct thread_data *new, struct thread_data *old, struct core_data *core_delta) @@ -482,19 +485,20 @@ delta_thread(struct thread_data *new, struct thread_data *old, /* - * As mperf and tsc collection are not atomic, - * it is possible for mperf's non-halted cycles + * As counter collection is not atomic, + * it is possible for mperf's non-halted cycles + idle states * to exceed TSC's all cycles: show c1 = 0% in that case. */ - if (old->mperf > old->tsc) + if ((old->mperf + core_delta->c3 + core_delta->c6 + core_delta->c7) > old->tsc) old->c1 = 0; else { /* normal case, derive c1 */ old->c1 = old->tsc - old->mperf - core_delta->c3 - core_delta->c6 - core_delta->c7; } + if (old->mperf == 0) { - if (verbose) fprintf(stderr, "cpu%d MPERF 0!\n", old->cpu_id); + if (verbose > 1) fprintf(stderr, "cpu%d MPERF 0!\n", old->cpu_id); old->mperf = 1; /* divide by 0 protection */ }