[<prev] [next>] [day] [month] [year] [list]
Message-ID: <tip-7y40wib8n1eqio7hjpn1dsrm@git.kernel.org>
Date: Thu, 28 Apr 2011 06:55:24 GMT
From: tip-bot for Ingo Molnar <mingo@...e.hu>
To: linux-tip-commits@...r.kernel.org
Cc: linux-kernel@...r.kernel.org, acme@...hat.com, hpa@...or.com,
mingo@...hat.com, a.p.zijlstra@...llo.nl, fweisbec@...il.com,
tglx@...utronix.de, mingo@...e.hu
Subject: [tip:perf/stat] perf stat: Add --sync/-S option
Commit-ID: f9cef0a90c4e7637f1ec98474a1a099aec45eb65
Gitweb: http://git.kernel.org/tip/f9cef0a90c4e7637f1ec98474a1a099aec45eb65
Author: Ingo Molnar <mingo@...e.hu>
AuthorDate: Thu, 28 Apr 2011 18:17:11 +0200
Committer: Ingo Molnar <mingo@...e.hu>
CommitDate: Thu, 28 Apr 2011 08:39:39 +0200
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@...llo.nl>
Cc: Arnaldo Carvalho de Melo <acme@...hat.com>
Cc: Frederic Weisbecker <fweisbec@...il.com>
Link: http://lkml.kernel.org/n/tip-7y40wib8n1eqio7hjpn1dsrm@git.kernel.org
Signed-off-by: Ingo Molnar <mingo@...e.hu>
---
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 003caa8..5658a77 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -128,6 +128,7 @@ static pid_t target_tid = -1;
static pid_t child_pid = -1;
static bool null_run = false;
static bool detailed_run = false;
+static bool sync_run = false;
static bool big_num = true;
static int big_num_opt = -1;
static const char *cpu_list;
@@ -819,6 +820,8 @@ static const struct option options[] = {
"null run - dont start any counters"),
OPT_BOOLEAN('d', "detailed", &detailed_run,
"detailed run - start a lot of events"),
+ OPT_BOOLEAN('S', "sync", &sync_run,
+ "call sync() before starting a run"),
OPT_CALLBACK_NOOPT('B', "big-num", NULL, NULL,
"print large numbers with thousands\' separators",
stat__set_big_num),
@@ -944,6 +947,10 @@ int cmd_stat(int argc, const char **argv, const char *prefix __used)
for (run_idx = 0; run_idx < run_count; run_idx++) {
if (run_count != 1 && verbose)
fprintf(stderr, "[ perf stat: executing run #%d ... ]\n", run_idx + 1);
+
+ if (sync_run)
+ sync();
+
status = run_perf_stat(argc, argv);
}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists