diff options
author | Ingo Molnar <mingo@elte.hu> | 2011-04-28 12:17:11 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2011-04-28 02:39:39 -0400 |
commit | f9cef0a90c4e7637f1ec98474a1a099aec45eb65 (patch) | |
tree | 6a7b6bd456a274070f83d75fa1e7f97d90f32e8e /tools | |
parent | 8a850cadca0e387c87a0911a61e99fd66aeb57ec (diff) |
perf stat: Add --sync/-S option
--sync will tell perf stat to run sync() before starting a command.
This allows IO-heavy tests to be used with --repeat, without one
iteration impacting the other.
Elapsed time will stabilize for example:
before: 3.971525714 seconds time elapsed ( +- 8.56% )
after: 3.211098537 seconds time elapsed ( +- 1.52% )
So measurements will be more accurate.
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Link: http://lkml.kernel.org/n/tip-7y40wib8n1eqio7hjpn1dsrm@git.kernel.org
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/perf/builtin-stat.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c index 003caa857a44..5658a770dbd7 100644 --- a/tools/perf/builtin-stat.c +++ b/tools/perf/builtin-stat.c | |||
@@ -128,6 +128,7 @@ static pid_t target_tid = -1; | |||
128 | static pid_t child_pid = -1; | 128 | static pid_t child_pid = -1; |
129 | static bool null_run = false; | 129 | static bool null_run = false; |
130 | static bool detailed_run = false; | 130 | static bool detailed_run = false; |
131 | static bool sync_run = false; | ||
131 | static bool big_num = true; | 132 | static bool big_num = true; |
132 | static int big_num_opt = -1; | 133 | static int big_num_opt = -1; |
133 | static const char *cpu_list; | 134 | static const char *cpu_list; |
@@ -819,6 +820,8 @@ static const struct option options[] = { | |||
819 | "null run - dont start any counters"), | 820 | "null run - dont start any counters"), |
820 | OPT_BOOLEAN('d', "detailed", &detailed_run, | 821 | OPT_BOOLEAN('d', "detailed", &detailed_run, |
821 | "detailed run - start a lot of events"), | 822 | "detailed run - start a lot of events"), |
823 | OPT_BOOLEAN('S', "sync", &sync_run, | ||
824 | "call sync() before starting a run"), | ||
822 | OPT_CALLBACK_NOOPT('B', "big-num", NULL, NULL, | 825 | OPT_CALLBACK_NOOPT('B', "big-num", NULL, NULL, |
823 | "print large numbers with thousands\' separators", | 826 | "print large numbers with thousands\' separators", |
824 | stat__set_big_num), | 827 | stat__set_big_num), |
@@ -944,6 +947,10 @@ int cmd_stat(int argc, const char **argv, const char *prefix __used) | |||
944 | for (run_idx = 0; run_idx < run_count; run_idx++) { | 947 | for (run_idx = 0; run_idx < run_count; run_idx++) { |
945 | if (run_count != 1 && verbose) | 948 | if (run_count != 1 && verbose) |
946 | fprintf(stderr, "[ perf stat: executing run #%d ... ]\n", run_idx + 1); | 949 | fprintf(stderr, "[ perf stat: executing run #%d ... ]\n", run_idx + 1); |
950 | |||
951 | if (sync_run) | ||
952 | sync(); | ||
953 | |||
947 | status = run_perf_stat(argc, argv); | 954 | status = run_perf_stat(argc, argv); |
948 | } | 955 | } |
949 | 956 | ||