diff options
author | Andi Kleen <ak@linux.intel.com> | 2014-01-11 13:38:27 -0800 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2014-01-13 10:07:03 -0300 |
commit | 6619a53ef7572b9eaf7aa71ff7f74c0d06b3817b (patch) | |
tree | 30cc3f9744834be9ca30959cf1308028c3a3aa2f /tools/perf/builtin-record.c | |
parent | d11416e76b3e2f60ed6cfa7c532d3b6777f66527 (diff) | |
download | linux-6619a53ef7572b9eaf7aa71ff7f74c0d06b3817b.tar.bz2 |
perf record: Add --initial-delay option
perf stat has a --delay option to delay measuring the workload.
This is useful to skip measuring the startup phase of the program, which
is often very different from the main workload.
The same is useful for perf record when sampling.
--no-delay was already taken, so add a --initial-delay
to perf record too.
-D was already taken for record, so there is only a long option.
v2: Don't disable group members (Namhyung Kim)
v3: port to latest perf/core
rename to --initial-delay to avoid conflict with --no-delay
Signed-off-by: Andi Kleen <ak@linux.intel.com>
Acked-by: Namhyung Kim <namhyung@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Link: http://lkml.kernel.org/r/1389476307-2124-1-git-send-email-andi@firstfloor.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/builtin-record.c')
-rw-r--r-- | tools/perf/builtin-record.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c index 88600158400e..07d4cf8d3fd3 100644 --- a/tools/perf/builtin-record.c +++ b/tools/perf/builtin-record.c @@ -499,7 +499,7 @@ static int __cmd_record(struct record *rec, int argc, const char **argv) * (apart from group members) have enable_on_exec=1 set, * so don't spoil it by prematurely enabling them. */ - if (!target__none(&opts->target)) + if (!target__none(&opts->target) && !opts->initial_delay) perf_evlist__enable(rec->evlist); /* @@ -508,6 +508,11 @@ static int __cmd_record(struct record *rec, int argc, const char **argv) if (forks) perf_evlist__start_workload(rec->evlist); + if (opts->initial_delay) { + usleep(opts->initial_delay * 1000); + perf_evlist__enable(rec->evlist); + } + for (;;) { int hits = rec->samples; @@ -877,6 +882,8 @@ const struct option record_options[] = { OPT_CALLBACK('G', "cgroup", &record.evlist, "name", "monitor event in cgroup name only", parse_cgroups), + OPT_UINTEGER(0, "initial-delay", &record.opts.initial_delay, + "ms to wait before starting measurement after program start"), OPT_STRING('u', "uid", &record.opts.target.uid_str, "user", "user to profile"), |