aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2009-06-27 00:10:30 -0400
committerIngo Molnar <mingo@elte.hu>2009-06-27 00:11:24 -0400
commit0cfb7a13b8e4e0afd4b856156ab16a182de7505b (patch)
tree7ebae71e6ef94d3bb95e43b4b2735c378f217449 /tools/perf
parentfde953c1c67986e1c381fa50d8207b1578b5cefa (diff)
perf stat: Add -n/--null option to run without counters
Allow a no-counters run. This can be useful to measure just elapsed wall-clock time - or to assess the raw overhead of perf stat itself, without running any counters. Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Mike Galbraith <efault@gmx.de> Cc: Paul Mackerras <paulus@samba.org> Cc: Arnaldo Carvalho de Melo <acme@redhat.com> LKML-Reference: <new-submission> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'tools/perf')
-rw-r--r--tools/perf/builtin-stat.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index 8420ec589506..cdcd058fac08 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -70,6 +70,7 @@ static int run_count = 1;
70static int inherit = 1; 70static int inherit = 1;
71static int scale = 1; 71static int scale = 1;
72static int target_pid = -1; 72static int target_pid = -1;
73static int null_run = 0;
73 74
74static int fd[MAX_NR_CPUS][MAX_COUNTERS]; 75static int fd[MAX_NR_CPUS][MAX_COUNTERS];
75 76
@@ -461,6 +462,8 @@ static const struct option options[] = {
461 "be more verbose (show counter open errors, etc)"), 462 "be more verbose (show counter open errors, etc)"),
462 OPT_INTEGER('r', "repeat", &run_count, 463 OPT_INTEGER('r', "repeat", &run_count,
463 "repeat command and print average + stddev (max: 100)"), 464 "repeat command and print average + stddev (max: 100)"),
465 OPT_BOOLEAN('n', "null", &null_run,
466 "null run - dont start any counters"),
464 OPT_END() 467 OPT_END()
465}; 468};
466 469
@@ -476,7 +479,7 @@ int cmd_stat(int argc, const char **argv, const char *prefix)
476 if (run_count <= 0 || run_count > MAX_RUN) 479 if (run_count <= 0 || run_count > MAX_RUN)
477 usage_with_options(stat_usage, options); 480 usage_with_options(stat_usage, options);
478 481
479 if (!nr_counters) 482 if (!null_run && !nr_counters)
480 nr_counters = 8; 483 nr_counters = 8;
481 484
482 nr_cpus = sysconf(_SC_NPROCESSORS_ONLN); 485 nr_cpus = sysconf(_SC_NPROCESSORS_ONLN);