Skip to content

Commit b2e4a5d

Browse files
Patryk Wlazlynlenb
authored andcommitted
tools/power turbostat: Move verbose counter messages to level 2
Printing information about the source and value during initialization and reading of the counter for each cpu, while useful when debugging, results in too verbose output. Signed-off-by: Patryk Wlazlyn <patryk.wlazlyn@linux.intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
1 parent 52e1307 commit b2e4a5d

File tree

1 file changed

+11
-13
lines changed

1 file changed

+11
-13
lines changed

tools/power/x86/turbostat/turbostat.c

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3797,7 +3797,7 @@ int get_rapl_counters(int cpu, unsigned int domain, struct core_data *c, struct
37973797
unsigned long long perf_data[NUM_RAPL_COUNTERS + 1];
37983798
struct rapl_counter_info_t *rci;
37993799

3800-
if (debug)
3800+
if (debug >= 2)
38013801
fprintf(stderr, "%s: cpu%d domain%d\n", __func__, cpu, domain);
38023802

38033803
assert(rapl_counter_info_perdomain);
@@ -3827,7 +3827,7 @@ int get_rapl_counters(int cpu, unsigned int domain, struct core_data *c, struct
38273827
assert(pi < ARRAY_SIZE(perf_data));
38283828
assert(rci->fd_perf != -1);
38293829

3830-
if (debug)
3830+
if (debug >= 2)
38313831
fprintf(stderr, "Reading rapl counter via perf at %u (%llu %e %lf)\n",
38323832
i, perf_data[pi], rci->scale[i], perf_data[pi] * rci->scale[i]);
38333833

@@ -3837,7 +3837,7 @@ int get_rapl_counters(int cpu, unsigned int domain, struct core_data *c, struct
38373837
break;
38383838

38393839
case COUNTER_SOURCE_MSR:
3840-
if (debug)
3840+
if (debug >= 2)
38413841
fprintf(stderr, "Reading rapl counter via msr at %u\n", i);
38423842

38433843
assert(!no_msr);
@@ -3895,7 +3895,7 @@ int get_cstate_counters(unsigned int cpu, struct thread_data *t, struct core_dat
38953895

38963896
struct cstate_counter_info_t *cci;
38973897

3898-
if (debug)
3898+
if (debug >= 2)
38993899
fprintf(stderr, "%s: cpu%d\n", __func__, cpu);
39003900

39013901
assert(ccstate_counter_info);
@@ -3965,9 +3965,8 @@ int get_cstate_counters(unsigned int cpu, struct thread_data *t, struct core_dat
39653965
assert(pi < ARRAY_SIZE(perf_data));
39663966
assert(cci->fd_perf_core != -1 || cci->fd_perf_pkg != -1);
39673967

3968-
if (debug) {
3968+
if (debug >= 2)
39693969
fprintf(stderr, "cstate via %s %u: %llu\n", "perf", i, perf_data[pi]);
3970-
}
39713970

39723971
cci->data[i] = perf_data[pi];
39733972

@@ -3979,9 +3978,8 @@ int get_cstate_counters(unsigned int cpu, struct thread_data *t, struct core_dat
39793978
if (get_msr(cpu, cci->msr[i], &cci->data[i]))
39803979
return -13 - i;
39813980

3982-
if (debug) {
3981+
if (debug >= 2)
39833982
fprintf(stderr, "cstate via %s0x%llx %u: %llu\n", "msr", cci->msr[i], i, cci->data[i]);
3984-
}
39853983

39863984
break;
39873985
}
@@ -4036,7 +4034,7 @@ int get_smi_aperf_mperf(unsigned int cpu, struct thread_data *t)
40364034

40374035
struct msr_counter_info_t *mci;
40384036

4039-
if (debug)
4037+
if (debug >= 2)
40404038
fprintf(stderr, "%s: cpu%d\n", __func__, cpu);
40414039

40424040
assert(msr_counter_info);
@@ -4066,7 +4064,7 @@ int get_smi_aperf_mperf(unsigned int cpu, struct thread_data *t)
40664064
assert(pi < ARRAY_SIZE(perf_data));
40674065
assert(mci->fd_perf != -1);
40684066

4069-
if (debug)
4067+
if (debug >= 2)
40704068
fprintf(stderr, "Reading msr counter via perf at %u: %llu\n", i, perf_data[pi]);
40714069

40724070
mci->data[i] = perf_data[pi];
@@ -4082,7 +4080,7 @@ int get_smi_aperf_mperf(unsigned int cpu, struct thread_data *t)
40824080

40834081
mci->data[i] &= mci->msr_mask[i];
40844082

4085-
if (debug)
4083+
if (debug >= 2)
40864084
fprintf(stderr, "Reading msr counter via msr at %u: %llu\n", i, mci->data[i]);
40874085

40884086
break;
@@ -7125,7 +7123,7 @@ int add_rapl_perf_counter(int cpu, struct rapl_counter_info_t *rci, const struct
71257123
{
71267124
int ret = add_rapl_perf_counter_(cpu, rci, cai, scale, unit);
71277125

7128-
if (debug)
7126+
if (debug >= 2)
71297127
fprintf(stderr, "%s: %d (cpu: %d)\n", __func__, ret, cpu);
71307128

71317129
return ret;
@@ -7284,7 +7282,7 @@ int add_cstate_perf_counter(int cpu, struct cstate_counter_info_t *cci, const st
72847282
{
72857283
int ret = add_cstate_perf_counter_(cpu, cci, cai);
72867284

7287-
if (debug)
7285+
if (debug >= 2)
72887286
fprintf(stderr, "%s: %d (cpu: %d)\n", __func__, ret, cpu);
72897287

72907288
return ret;

0 commit comments

Comments
 (0)