summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 8892d5b)
raw | patch | inline | side by side (parent: 8892d5b)
author | Vincent Brillault <git@lerya.net> | |
Sat, 23 Aug 2014 13:53:12 +0000 (15:53 +0200) | ||
committer | Vincent Brillault <git@lerya.net> | |
Sat, 28 Feb 2015 06:35:41 +0000 (07:35 +0100) |
src/turbostat.c | patch | blob | history |
diff --git a/src/turbostat.c b/src/turbostat.c
index ecc23757903bd78163b82cdba571ac7aaf9c8771..03ffaf5e8d0e9a8c5b85337a3ae3ed119bfa556a 100644 (file)
--- a/src/turbostat.c
+++ b/src/turbostat.c
#define PLUGIN_NAME "turbostat"
static const char *proc_stat = "/proc/stat";
-static unsigned int skip_c0;
-static unsigned int skip_c1;
+
+/*
+ * If set, aperf_mperf_unstable disables a/mperf based stats.
+ * This includes: C0 & C1 states, frequency
+ *
+ * This value is automatically set if mperf or aperf decreases
+ */
+static _Bool aperf_mperf_unstable;
+
static unsigned int do_core_cstate;
static unsigned int do_pkg_cstate;
static unsigned int do_rapl;
/* 0x642 MSR_PP1_POLICY */
#define TJMAX_DEFAULT 100
-int aperf_mperf_unstable;
int backwards_count;
cpu_set_t *cpu_present_set, *cpu_affinity_set, *cpu_saved_affinity_set;
old->aperf = new->aperf - old->aperf;
old->mperf = new->mperf - old->mperf;
} else {
-
if (!aperf_mperf_unstable) {
WARNING(" APERF or MPERF went backwards * ");
WARNING("* Frequency results do not cover entire interval *");
aperf_mperf_unstable = 1;
}
- /*
- * mperf delta is likely a huge "positive" number
- * can not use it for calculating c0 time
- */
- skip_c0 = 1;
- skip_c1 = 1;
}
ssnprintf(name, sizeof(name), "cpu%02d", t->cpu_id);
- if (!skip_c0)
+ if (!aperf_mperf_unstable)
turbostat_submit(name, "percent", "c0", 100.0 * t->mperf/t->tsc);
- if (!skip_c1)
+ if (!aperf_mperf_unstable)
turbostat_submit(name, "percent", "c1", 100.0 * t->c1/t->tsc);
/* GHz */