Commit 23cb4f5c authored by Artem Bityutskiy's avatar Artem Bityutskiy Committed by Len Brown
Browse files

tools/power turbostat: Fix incorrect format variable



In the perf thread, core, and package counter loops, an incorrect
'mp->format' variable is used instead of 'pp->format'.

[lenb: edit commit message]
Fixes: 696d15cb ("tools/power turbostat: Refactor floating point printout code")
Signed-off-by: default avatarArtem Bityutskiy <artem.bityutskiy@linux.intel.com>
Signed-off-by: default avatarLen Brown <len.brown@intel.com>
parent ed532d73
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -3468,7 +3468,7 @@ int format_counters(PER_THREAD_PARAMS)
	for (i = 0, pp = sys.perf_tp; pp; ++i, pp = pp->next) {
		if (pp->format == FORMAT_RAW)
			outp += print_hex_value(pp->width, &printed, delim, t->perf_counter[i]);
		else if (pp->format == FORMAT_DELTA || mp->format == FORMAT_AVERAGE)
		else if (pp->format == FORMAT_DELTA || pp->format == FORMAT_AVERAGE)
			outp += print_decimal_value(pp->width, &printed, delim, t->perf_counter[i]);
		else if (pp->format == FORMAT_PERCENT) {
			if (pp->type == COUNTER_USEC)
@@ -3538,7 +3538,7 @@ int format_counters(PER_THREAD_PARAMS)
	for (i = 0, pp = sys.perf_cp; pp; i++, pp = pp->next) {
		if (pp->format == FORMAT_RAW)
			outp += print_hex_value(pp->width, &printed, delim, c->perf_counter[i]);
		else if (pp->format == FORMAT_DELTA || mp->format == FORMAT_AVERAGE)
		else if (pp->format == FORMAT_DELTA || pp->format == FORMAT_AVERAGE)
			outp += print_decimal_value(pp->width, &printed, delim, c->perf_counter[i]);
		else if (pp->format == FORMAT_PERCENT)
			outp += print_float_value(&printed, delim, pct(c->perf_counter[i], tsc));
@@ -3694,7 +3694,7 @@ int format_counters(PER_THREAD_PARAMS)
			outp += print_hex_value(pp->width, &printed, delim, p->perf_counter[i]);
		else if (pp->type == COUNTER_K2M)
			outp += sprintf(outp, "%s%d", (printed++ ? delim : ""), (unsigned int)p->perf_counter[i] / 1000);
		else if (pp->format == FORMAT_DELTA || mp->format == FORMAT_AVERAGE)
		else if (pp->format == FORMAT_DELTA || pp->format == FORMAT_AVERAGE)
			outp += print_decimal_value(pp->width, &printed, delim, p->perf_counter[i]);
		else if (pp->format == FORMAT_PERCENT)
			outp += print_float_value(&printed, delim, pct(p->perf_counter[i], tsc));