perf stat: extend -D,--delay option with -1 value
Extend -D,--delay option with -1 value to start monitoring 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/81ac633c-a844-5cfb-931c-820f6e6cbd12@linux.intel.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
parent
987b823813
commit
2162b9c6bd
|
@ -238,8 +238,9 @@ mode, use --per-node in addition to -a. (system-wide).
|
||||||
|
|
||||||
-D msecs::
|
-D msecs::
|
||||||
--delay msecs::
|
--delay msecs::
|
||||||
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.
|
||||||
|
|
||||||
-T::
|
-T::
|
||||||
--transaction::
|
--transaction::
|
||||||
|
|
|
@ -487,16 +487,26 @@ static bool handle_interval(unsigned int interval, int *times)
|
||||||
|
|
||||||
static void enable_counters(void)
|
static void enable_counters(void)
|
||||||
{
|
{
|
||||||
if (stat_config.initial_delay)
|
if (stat_config.initial_delay < 0) {
|
||||||
|
pr_info(EVLIST_DISABLED_MSG);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (stat_config.initial_delay > 0) {
|
||||||
|
pr_info(EVLIST_DISABLED_MSG);
|
||||||
usleep(stat_config.initial_delay * USEC_PER_MSEC);
|
usleep(stat_config.initial_delay * USEC_PER_MSEC);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We need to enable counters only if:
|
* We need to enable counters only if:
|
||||||
* - we don't have tracee (attaching to task or cpu)
|
* - we don't have tracee (attaching to task or cpu)
|
||||||
* - we have initial delay configured
|
* - we have initial delay configured
|
||||||
*/
|
*/
|
||||||
if (!target__none(&target) || stat_config.initial_delay)
|
if (!target__none(&target) || stat_config.initial_delay) {
|
||||||
evlist__enable(evsel_list);
|
evlist__enable(evsel_list);
|
||||||
|
if (stat_config.initial_delay > 0)
|
||||||
|
pr_info(EVLIST_ENABLED_MSG);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void disable_counters(void)
|
static void disable_counters(void)
|
||||||
|
@ -1053,8 +1063,8 @@ static struct option stat_options[] = {
|
||||||
"aggregate counts per thread", AGGR_THREAD),
|
"aggregate counts per thread", AGGR_THREAD),
|
||||||
OPT_SET_UINT(0, "per-node", &stat_config.aggr_mode,
|
OPT_SET_UINT(0, "per-node", &stat_config.aggr_mode,
|
||||||
"aggregate counts per numa node", AGGR_NODE),
|
"aggregate counts per numa node", AGGR_NODE),
|
||||||
OPT_UINTEGER('D', "delay", &stat_config.initial_delay,
|
OPT_INTEGER('D', "delay", &stat_config.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_CALLBACK_NOOPT(0, "metric-only", &stat_config.metric_only, NULL,
|
OPT_CALLBACK_NOOPT(0, "metric-only", &stat_config.metric_only, NULL,
|
||||||
"Only print computed metrics. No raw values", enable_metric_only),
|
"Only print computed metrics. No raw values", enable_metric_only),
|
||||||
OPT_BOOLEAN(0, "metric-no-group", &stat_config.metric_no_group,
|
OPT_BOOLEAN(0, "metric-no-group", &stat_config.metric_no_group,
|
||||||
|
|
|
@ -378,4 +378,7 @@ int evlist__finalize_ctlfd(struct evlist *evlist);
|
||||||
bool evlist__ctlfd_initialized(struct evlist *evlist);
|
bool evlist__ctlfd_initialized(struct evlist *evlist);
|
||||||
int evlist__ctlfd_process(struct evlist *evlist, enum evlist_ctl_cmd *cmd);
|
int evlist__ctlfd_process(struct evlist *evlist, enum evlist_ctl_cmd *cmd);
|
||||||
|
|
||||||
|
#define EVLIST_ENABLED_MSG "Events enabled\n"
|
||||||
|
#define EVLIST_DISABLED_MSG "Events disabled\n"
|
||||||
|
|
||||||
#endif /* __PERF_EVLIST_H */
|
#endif /* __PERF_EVLIST_H */
|
||||||
|
|
|
@ -116,7 +116,7 @@ struct perf_stat_config {
|
||||||
FILE *output;
|
FILE *output;
|
||||||
unsigned int interval;
|
unsigned int interval;
|
||||||
unsigned int timeout;
|
unsigned int timeout;
|
||||||
unsigned int initial_delay;
|
int initial_delay;
|
||||||
unsigned int unit_width;
|
unsigned int unit_width;
|
||||||
unsigned int metric_only_len;
|
unsigned int metric_only_len;
|
||||||
int times;
|
int times;
|
||||||
|
|
Loading…
Reference in New Issue