Skip to content

Commit

Permalink
perf stat: Print out all arguments
Browse files Browse the repository at this point in the history
Before:

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

After:

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

Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
  • Loading branch information
Ingo Molnar committed Jun 3, 2009
1 parent e98e96f commit 44db76c
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions Documentation/perf_counter/builtin-stat.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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();

Expand All @@ -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++)
Expand Down

0 comments on commit 44db76c

Please sign in to comment.