aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tools/perf/Documentation/perf-trace.txt5
-rw-r--r--tools/perf/builtin-trace.c10
2 files changed, 14 insertions, 1 deletions
diff --git a/tools/perf/Documentation/perf-trace.txt b/tools/perf/Documentation/perf-trace.txt
index 1ab0782369b1..781b019751a4 100644
--- a/tools/perf/Documentation/perf-trace.txt
+++ b/tools/perf/Documentation/perf-trace.txt
@@ -39,6 +39,11 @@ OPTIONS
39 Prefixing with ! shows all syscalls but the ones specified. You may 39 Prefixing with ! shows all syscalls but the ones specified. You may
40 need to escape it. 40 need to escape it.
41 41
42-D msecs::
43--delay msecs::
44After starting the program, wait msecs before measuring. This is useful to
45filter out the startup phase of the program, which is often very different.
46
42-o:: 47-o::
43--output=:: 48--output=::
44 Output file name. 49 Output file name.
diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
index c298bd3e1d90..0bae454e8efa 100644
--- a/tools/perf/builtin-trace.c
+++ b/tools/perf/builtin-trace.c
@@ -2310,12 +2310,17 @@ static int trace__run(struct trace *trace, int argc, const char **argv)
2310 if (err < 0) 2310 if (err < 0)
2311 goto out_error_mmap; 2311 goto out_error_mmap;
2312 2312
2313 if (!target__none(&trace->opts.target)) 2313 if (!target__none(&trace->opts.target) && !trace->opts.initial_delay)
2314 perf_evlist__enable(evlist); 2314 perf_evlist__enable(evlist);
2315 2315
2316 if (forks) 2316 if (forks)
2317 perf_evlist__start_workload(evlist); 2317 perf_evlist__start_workload(evlist);
2318 2318
2319 if (trace->opts.initial_delay) {
2320 usleep(trace->opts.initial_delay * 1000);
2321 perf_evlist__enable(evlist);
2322 }
2323
2319 trace->multiple_threads = thread_map__pid(evlist->threads, 0) == -1 || 2324 trace->multiple_threads = thread_map__pid(evlist->threads, 0) == -1 ||
2320 evlist->threads->nr > 1 || 2325 evlist->threads->nr > 1 ||
2321 perf_evlist__first(evlist)->attr.inherit; 2326 perf_evlist__first(evlist)->attr.inherit;
@@ -2816,6 +2821,9 @@ int cmd_trace(int argc, const char **argv, const char *prefix __maybe_unused)
2816 "Default: kernel.perf_event_max_stack or " __stringify(PERF_MAX_STACK_DEPTH)), 2821 "Default: kernel.perf_event_max_stack or " __stringify(PERF_MAX_STACK_DEPTH)),
2817 OPT_UINTEGER(0, "proc-map-timeout", &trace.opts.proc_map_timeout, 2822 OPT_UINTEGER(0, "proc-map-timeout", &trace.opts.proc_map_timeout,
2818 "per thread proc mmap processing timeout in ms"), 2823 "per thread proc mmap processing timeout in ms"),
2824 OPT_UINTEGER('D', "delay", &trace.opts.initial_delay,
2825 "ms to wait before starting measurement after program "
2826 "start"),
2819 OPT_END() 2827 OPT_END()
2820 }; 2828 };
2821 bool __maybe_unused max_stack_user_set = true; 2829 bool __maybe_unused max_stack_user_set = true;