Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3ae9a34d authored by Zhengyu He's avatar Zhengyu He Committed by Ingo Molnar
Browse files

perf stat: Add noise output for csv mode



Previously, when you want perf-stat to output the statistics in
csv mode, no information of the noise will be printed out.

For example right now we output this --repeat information:

 ./perf stat -r3 -x, sleep 1
 1.164789,task-clock
 8,context-switches
 0,CPU-migrations
 219,page-faults
 3337800,cycles

With this patch, the output will be appended with an additional
entry for the noise value:

 ./perf stat -r3 -x, sleep 1
 1.164789,task-clock,3.75%
 8,context-switches,75.00%
 0,CPU-migrations,100.00%
 219,page-faults,0.00%
 3337800,cycles,3.36%

Signed-off-by: default avatarZhengyu He <zhengyuh@google.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Cc: Stephane Eranian <eranian@google.com>
Cc: Venkatesh Pallipadi <venki@google.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Link: http://lkml.kernel.org/r/1308861942-4945-1-git-send-email-zhengyuh@google.com


Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent 343a031f
Loading
Loading
Loading
Loading
+6 −3
Original line number Original line Diff line number Diff line
@@ -517,6 +517,9 @@ static void print_noise_pct(double total, double avg)
	if (avg)
	if (avg)
		pct = 100.0*total/avg;
		pct = 100.0*total/avg;


	if (csv_output)
		fprintf(stderr, "%s%.2f%%", csv_sep, pct);
	else
		fprintf(stderr, "  ( +-%6.2f%% )", pct);
		fprintf(stderr, "  ( +-%6.2f%% )", pct);
}
}


@@ -882,13 +885,13 @@ static void print_counter_aggr(struct perf_evsel *counter)
	else
	else
		abs_printout(-1, counter, avg);
		abs_printout(-1, counter, avg);


	print_noise(counter, avg);

	if (csv_output) {
	if (csv_output) {
		fputc('\n', stderr);
		fputc('\n', stderr);
		return;
		return;
	}
	}


	print_noise(counter, avg);

	if (scaled) {
	if (scaled) {
		double avg_enabled, avg_running;
		double avg_enabled, avg_running;