Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

perf record: Extend -D,--delay option with -1 value

Extend -D,--delay option with -1 to start collection with events
disabled to be enabled later by 'enable' command provided via control
file descriptor.

Signed-off-by: Alexey Budankov <alexey.budankov@linux.intel.com>
Acked-by: Jiri Olsa <jolsa@redhat.com>
Acked-by: Namhyung Kim <namhyung@kernel.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lore.kernel.org/lkml/3e7d362c-7973-ee5d-e81e-c60ea22432c3@linux.intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

authored by

Alexey Budankov and committed by
Arnaldo Carvalho de Melo
68cd3b45 27e9769a

+13 -8
+3 -2
tools/perf/Documentation/perf-record.txt
··· 407 407 408 408 -D:: 409 409 --delay=:: 410 - After starting the program, wait msecs before measuring. This is useful to 411 - filter out the startup phase of the program, which is often very different. 410 + After starting the program, wait msecs before measuring (-1: start with events 411 + disabled). This is useful to filter out the startup phase of the program, which 412 + is often very different. 412 413 413 414 -I:: 414 415 --intr-regs::
+8 -4
tools/perf/builtin-record.c
··· 1786 1786 } 1787 1787 1788 1788 if (opts->initial_delay) { 1789 - usleep(opts->initial_delay * USEC_PER_MSEC); 1790 - evlist__enable(rec->evlist); 1789 + pr_info(EVLIST_DISABLED_MSG); 1790 + if (opts->initial_delay > 0) { 1791 + usleep(opts->initial_delay * USEC_PER_MSEC); 1792 + evlist__enable(rec->evlist); 1793 + pr_info(EVLIST_ENABLED_MSG); 1794 + } 1791 1795 } 1792 1796 1793 1797 trigger_ready(&auxtrace_snapshot_trigger); ··· 2503 2499 OPT_CALLBACK('G', "cgroup", &record.evlist, "name", 2504 2500 "monitor event in cgroup name only", 2505 2501 parse_cgroups), 2506 - OPT_UINTEGER('D', "delay", &record.opts.initial_delay, 2507 - "ms to wait before starting measurement after program start"), 2502 + OPT_INTEGER('D', "delay", &record.opts.initial_delay, 2503 + "ms to wait before starting measurement after program start (-1: start with events disabled)"), 2508 2504 OPT_BOOLEAN(0, "kcore", &record.opts.kcore, "copy /proc/kcore"), 2509 2505 OPT_STRING('u', "uid", &record.opts.target.uid_str, "user", 2510 2506 "user to profile"),
+1 -1
tools/perf/builtin-trace.c
··· 4812 4812 "per thread proc mmap processing timeout in ms"), 4813 4813 OPT_CALLBACK('G', "cgroup", &trace, "name", "monitor event in cgroup name only", 4814 4814 trace__parse_cgroups), 4815 - OPT_UINTEGER('D', "delay", &trace.opts.initial_delay, 4815 + OPT_INTEGER('D', "delay", &trace.opts.initial_delay, 4816 4816 "ms to wait before starting measurement after program " 4817 4817 "start"), 4818 4818 OPTS_EVSWITCH(&trace.evswitch),
+1 -1
tools/perf/util/record.h
··· 62 62 const char *auxtrace_snapshot_opts; 63 63 const char *auxtrace_sample_opts; 64 64 bool sample_transaction; 65 - unsigned initial_delay; 65 + int initial_delay; 66 66 bool use_clockid; 67 67 clockid_t clockid; 68 68 u64 clockid_res_ns;