perf trace: Enable events when doing system wide tracing and starting a workload
authorArnaldo Carvalho de Melo <acme@redhat.com>
Wed, 22 Apr 2015 13:04:23 +0000 (10:04 -0300)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Thu, 23 Apr 2015 20:07:59 +0000 (17:07 -0300)
commitcb24d01d217497fb32467de22d773655f47d3896
tree0513656136b73a177d1e00662a1d7a6bfaab952b
parent0140e6141e4f1d4b15fb469e6912b0e71b7d1cc2
perf trace: Enable events when doing system wide tracing and starting a workload

 commit f7aa222ff397
 Author: Arnaldo Carvalho de Melo <acme@redhat.com>
 Date:   Tue Feb 3 13:25:39 2015 -0300

    perf trace: No need to enable evsels for workload started from perf

The assumption was that whenever a workload is specified, the
attr.enable_on_exec evsel flag would be set, but that is not happening
when perf_record_opts.system_wide is set, for instance

That resulted in both perf_evlist__enable() and attr.enable_on_exec
being not called/set, which made the events to remain disabled while the
workload runs, producing no output.

Fix it,  by calling perf_evlist__enable() in the 'trace' tool
when forking and not targetting a workload started from trace

v2: Test against !target__none(), as suggested by Namhyung Kim, that is
what is used in perf_evsel__config() when deciding if the
attr.enable_on_exec flag to be set. More work is needed to cover other
cases such as opts->initial_delay.

Acked-by: Jiri Olsa <jolsa@redhat.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Borislav Petkov <bp@suse.de>
Cc: David Ahern <dsahern@gmail.com>
Cc: Don Zickus <dzickus@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-27z7169pvfxgj8upic636syv@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/builtin-trace.c