Skip to content

Commit

Permalink
tools/power turbostat: remove blank lines
Browse files Browse the repository at this point in the history
When the user reuests to collect and show columns
that are not present on every row (eg. for every CPU)
turbostat still prints an (empty) line for every CPU.
Update so no blank lines are printed.

old:
	# turbostat --quiet --show Pkg%pc6
	Pkg%pc6
	9.12
	9.12

	Pkg%pc6
	9.12
	9.12

new:
	# turbostat --quiet --show Pkg%pc6
	Pkg%pc6
	9.12
	9.12
	Pkg%pc6
	9.12
	9.12

Reported-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
  • Loading branch information
Len Brown committed Jun 1, 2018
1 parent 3e8b62b commit 94d6ab4
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion tools/power/x86/turbostat/turbostat.c
Original file line number Diff line number Diff line change
Expand Up @@ -1028,7 +1028,8 @@ int format_counters(struct thread_data *t, struct core_data *c,
}

done:
outp += sprintf(outp, "\n");
if (*(outp - 1) != '\n')
outp += sprintf(outp, "\n");

return 0;
}
Expand Down

0 comments on commit 94d6ab4

Please sign in to comment.