Commit 68cd3b45 authored by Alexey Budankov's avatar Alexey Budankov Committed by Arnaldo Carvalho de Melo

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: default avatarAlexey Budankov <alexey.budankov@linux.intel.com>
Acked-by: default avatarJiri Olsa <jolsa@redhat.com>
Acked-by: default avatarNamhyung 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.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 27e9769a
...@@ -407,8 +407,9 @@ if combined with -a or -C options. ...@@ -407,8 +407,9 @@ if combined with -a or -C options.
-D:: -D::
--delay=:: --delay=::
After starting the program, wait msecs before measuring. This is useful to After starting the program, wait msecs before measuring (-1: start with events
filter out the startup phase of the program, which is often very different. disabled). This is useful to filter out the startup phase of the program, which
is often very different.
-I:: -I::
--intr-regs:: --intr-regs::
......
...@@ -1786,8 +1786,12 @@ static int __cmd_record(struct record *rec, int argc, const char **argv) ...@@ -1786,8 +1786,12 @@ static int __cmd_record(struct record *rec, int argc, const char **argv)
} }
if (opts->initial_delay) { if (opts->initial_delay) {
usleep(opts->initial_delay * USEC_PER_MSEC); pr_info(EVLIST_DISABLED_MSG);
evlist__enable(rec->evlist); if (opts->initial_delay > 0) {
usleep(opts->initial_delay * USEC_PER_MSEC);
evlist__enable(rec->evlist);
pr_info(EVLIST_ENABLED_MSG);
}
} }
trigger_ready(&auxtrace_snapshot_trigger); trigger_ready(&auxtrace_snapshot_trigger);
...@@ -2499,8 +2503,8 @@ static struct option __record_options[] = { ...@@ -2499,8 +2503,8 @@ static struct option __record_options[] = {
OPT_CALLBACK('G', "cgroup", &record.evlist, "name", OPT_CALLBACK('G', "cgroup", &record.evlist, "name",
"monitor event in cgroup name only", "monitor event in cgroup name only",
parse_cgroups), parse_cgroups),
OPT_UINTEGER('D', "delay", &record.opts.initial_delay, OPT_INTEGER('D', "delay", &record.opts.initial_delay,
"ms to wait before starting measurement after program start"), "ms to wait before starting measurement after program start (-1: start with events disabled)"),
OPT_BOOLEAN(0, "kcore", &record.opts.kcore, "copy /proc/kcore"), OPT_BOOLEAN(0, "kcore", &record.opts.kcore, "copy /proc/kcore"),
OPT_STRING('u', "uid", &record.opts.target.uid_str, "user", OPT_STRING('u', "uid", &record.opts.target.uid_str, "user",
"user to profile"), "user to profile"),
......
...@@ -4812,7 +4812,7 @@ int cmd_trace(int argc, const char **argv) ...@@ -4812,7 +4812,7 @@ int cmd_trace(int argc, const char **argv)
"per thread proc mmap processing timeout in ms"), "per thread proc mmap processing timeout in ms"),
OPT_CALLBACK('G', "cgroup", &trace, "name", "monitor event in cgroup name only", OPT_CALLBACK('G', "cgroup", &trace, "name", "monitor event in cgroup name only",
trace__parse_cgroups), trace__parse_cgroups),
OPT_UINTEGER('D', "delay", &trace.opts.initial_delay, OPT_INTEGER('D', "delay", &trace.opts.initial_delay,
"ms to wait before starting measurement after program " "ms to wait before starting measurement after program "
"start"), "start"),
OPTS_EVSWITCH(&trace.evswitch), OPTS_EVSWITCH(&trace.evswitch),
......
...@@ -62,7 +62,7 @@ struct record_opts { ...@@ -62,7 +62,7 @@ struct record_opts {
const char *auxtrace_snapshot_opts; const char *auxtrace_snapshot_opts;
const char *auxtrace_sample_opts; const char *auxtrace_sample_opts;
bool sample_transaction; bool sample_transaction;
unsigned initial_delay; int initial_delay;
bool use_clockid; bool use_clockid;
clockid_t clockid; clockid_t clockid;
u64 clockid_res_ns; u64 clockid_res_ns;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment