Skip to content

Commit d4a0587

Browse files
tebrandtlenb
authored andcommitted
tools/power turbostat: fix GCC9 build regression
Fix build regression seen when using old gcc-9 compiler. Signed-off-by: Todd Brandt <[email protected]> Reviewed-by: Chen Yu <[email protected]> Signed-off-by: Len Brown <[email protected]>
1 parent adc2186 commit d4a0587

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

tools/power/x86/turbostat/turbostat.c

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2788,6 +2788,8 @@ int format_counters(struct thread_data *t, struct core_data *c, struct pkg_data
27882788
}
27892789

27902790
for (i = 0, ppmt = sys.pmt_tp; ppmt; i++, ppmt = ppmt->next) {
2791+
const unsigned long value_raw = t->pmt_counter[i];
2792+
const double value_converted = 100.0 * value_raw / crystal_hz / interval_float;
27912793
switch (ppmt->type) {
27922794
case PMT_TYPE_RAW:
27932795
if (pmt_counter_get_width(ppmt) <= 32)
@@ -2799,9 +2801,6 @@ int format_counters(struct thread_data *t, struct core_data *c, struct pkg_data
27992801
break;
28002802

28012803
case PMT_TYPE_XTAL_TIME:
2802-
const unsigned long value_raw = t->pmt_counter[i];
2803-
const double value_converted = 100.0 * value_raw / crystal_hz / interval_float;
2804-
28052804
outp += sprintf(outp, "%s%.2f", (printed++ ? delim : ""), value_converted);
28062805
break;
28072806
}
@@ -2869,6 +2868,8 @@ int format_counters(struct thread_data *t, struct core_data *c, struct pkg_data
28692868
}
28702869

28712870
for (i = 0, ppmt = sys.pmt_cp; ppmt; i++, ppmt = ppmt->next) {
2871+
const unsigned long value_raw = c->pmt_counter[i];
2872+
const double value_converted = 100.0 * value_raw / crystal_hz / interval_float;
28722873
switch (ppmt->type) {
28732874
case PMT_TYPE_RAW:
28742875
if (pmt_counter_get_width(ppmt) <= 32)
@@ -2880,9 +2881,6 @@ int format_counters(struct thread_data *t, struct core_data *c, struct pkg_data
28802881
break;
28812882

28822883
case PMT_TYPE_XTAL_TIME:
2883-
const unsigned long value_raw = c->pmt_counter[i];
2884-
const double value_converted = 100.0 * value_raw / crystal_hz / interval_float;
2885-
28862884
outp += sprintf(outp, "%s%.2f", (printed++ ? delim : ""), value_converted);
28872885
break;
28882886
}
@@ -3068,6 +3066,8 @@ int format_counters(struct thread_data *t, struct core_data *c, struct pkg_data
30683066
}
30693067

30703068
for (i = 0, ppmt = sys.pmt_pp; ppmt; i++, ppmt = ppmt->next) {
3069+
const unsigned long value_raw = p->pmt_counter[i];
3070+
const double value_converted = 100.0 * value_raw / crystal_hz / interval_float;
30713071
switch (ppmt->type) {
30723072
case PMT_TYPE_RAW:
30733073
if (pmt_counter_get_width(ppmt) <= 32)
@@ -3079,9 +3079,6 @@ int format_counters(struct thread_data *t, struct core_data *c, struct pkg_data
30793079
break;
30803080

30813081
case PMT_TYPE_XTAL_TIME:
3082-
const unsigned long value_raw = p->pmt_counter[i];
3083-
const double value_converted = 100.0 * value_raw / crystal_hz / interval_float;
3084-
30853082
outp += sprintf(outp, "%s%.2f", (printed++ ? delim : ""), value_converted);
30863083
break;
30873084
}

0 commit comments

Comments
 (0)