Skip to contentSkip to conversation

perf stat: Print out all arguments

tip:perfcounters/core tip-bot for Ingo Molnar 1 participant 1 message Jun 3, 2009 Documentation

lore
Share & tools
lore
#0 lore raw
Commit-ID:  44db76c8553c328f4ae02481d77bb3a88ca17645
Gitweb:     http://git.kernel.org/tip/44db76c8553c328f4ae02481d77bb3a88ca17645
Author:     Ingo Molnar <[email protected]>
AuthorDate: Wed, 3 Jun 2009 19:36:07 +0200
Committer:  Ingo Molnar <[email protected]>
CommitDate: Wed, 3 Jun 2009 19:36:07 +0200

perf stat: Print out all arguments

Before:

Performance counter stats for '/home/mingo/hackbench':

After:

Performance counter stats for '/home/mingo/hackbench 10':

Cc: Peter Zijlstra <[email protected]>
Cc: Mike Galbraith <[email protected]>
Cc: Paul Mackerras <[email protected]>
Cc: Corey Ashford <[email protected]>
Cc: Marcelo Tosatti <[email protected]>
Cc: Arnaldo Carvalho de Melo <[email protected]>
Cc: Thomas Gleixner <[email protected]>
LKML-Reference: <new-submission>

---
 Documentation/perf_counter/builtin-stat.c |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)
Documentation/perf_counter/builtin-stat.c +10 -2
index 2357a66..4fc0d80 100644
@@ -228,6 +228,7 @@ static int do_perfstat(int argc, const char **argv)
 	int counter;
 	int status;
 	int pid;
+	int i;
 
 	if (!system_wide)
 		nr_cpus = 1;
@@ -243,14 +244,17 @@ static int do_perfstat(int argc, const char **argv)
 
 	if ((pid = fork()) < 0)
 		perror("failed to fork");
+
 	if (!pid) {
 		if (execvp(argv[0], (char **)argv)) {
 			perror(argv[0]);
 			exit(-1);
 		}
 	}
+
 	while (wait(&status) >= 0)
 		;
+
 	prctl(PR_TASK_PERF_COUNTERS_DISABLE);
 	t1 = rdclock();
 
@@ -259,8 +263,12 @@ static int do_perfstat(int argc, const char **argv)
 	fflush(stdout);
 
 	fprintf(stderr, "\n");
-	fprintf(stderr, " Performance counter stats for \'%s\':\n",
-		argv[0]);
+	fprintf(stderr, " Performance counter stats for \'%s", argv[0]);
+
+	for (i = 1; i < argc; i++)
+		fprintf(stderr, " %s", argv[i]);
+
+	fprintf(stderr, "\':\n");
 	fprintf(stderr, "\n");
 
 	for (counter = 0; counter < nr_counters; counter++)