Commit 0cfb7a13 authored by Ingo Molnar's avatar Ingo Molnar

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: default avatarIngo Molnar <mingo@elte.hu>
parent fde953c1
...@@ -70,6 +70,7 @@ static int run_count = 1; ...@@ -70,6 +70,7 @@ static int run_count = 1;
static int inherit = 1; static int inherit = 1;
static int scale = 1; static int scale = 1;
static int target_pid = -1; static int target_pid = -1;
static int null_run = 0;
static int fd[MAX_NR_CPUS][MAX_COUNTERS]; static int fd[MAX_NR_CPUS][MAX_COUNTERS];
...@@ -461,6 +462,8 @@ static const struct option options[] = { ...@@ -461,6 +462,8 @@ static const struct option options[] = {
"be more verbose (show counter open errors, etc)"), "be more verbose (show counter open errors, etc)"),
OPT_INTEGER('r', "repeat", &run_count, OPT_INTEGER('r', "repeat", &run_count,
"repeat command and print average + stddev (max: 100)"), "repeat command and print average + stddev (max: 100)"),
OPT_BOOLEAN('n', "null", &null_run,
"null run - dont start any counters"),
OPT_END() OPT_END()
}; };
...@@ -476,7 +479,7 @@ int cmd_stat(int argc, const char **argv, const char *prefix) ...@@ -476,7 +479,7 @@ int cmd_stat(int argc, const char **argv, const char *prefix)
if (run_count <= 0 || run_count > MAX_RUN) if (run_count <= 0 || run_count > MAX_RUN)
usage_with_options(stat_usage, options); usage_with_options(stat_usage, options);
if (!nr_counters) if (!null_run && !nr_counters)
nr_counters = 8; nr_counters = 8;
nr_cpus = sysconf(_SC_NPROCESSORS_ONLN); nr_cpus = sysconf(_SC_NPROCESSORS_ONLN);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment