perf evsel: Add 'immediate' option
authorAdrian Hunter <adrian.hunter@intel.com>
Mon, 14 Jul 2014 10:02:57 +0000 (13:02 +0300)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Wed, 16 Jul 2014 20:57:37 +0000 (17:57 -0300)
Add an option to cause a selected event to be enabled immediately when
configured by perf_evsel__config().

This is needed when using the sched_switch tracepoint to follow object
code execution.  By having sched_switch enabled immediately the first
sched_switch event precedes the start of other tracing.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@gmail.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1405332185-4050-34-git-send-email-adrian.hunter@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/util/evsel.c
tools/perf/util/evsel.h

index 40626e5fc1c080c44c03a3bb76a5e975fe4479b2..90f58cdd0fb088ac3e068160c2eb649f3c233263 100644 (file)
@@ -681,6 +681,11 @@ void perf_evsel__config(struct perf_evsel *evsel, struct record_opts *opts)
        if (target__none(&opts->target) && perf_evsel__is_group_leader(evsel) &&
                !opts->initial_delay)
                attr->enable_on_exec = 1;
+
+       if (evsel->immediate) {
+               attr->disabled = 0;
+               attr->enable_on_exec = 0;
+       }
 }
 
 int perf_evsel__alloc_fd(struct perf_evsel *evsel, int ncpus, int nthreads)
index 8dfec05bcec2dcbd70794a19ccf6a7aaaa7d1a40..d7f93ce0ebc12b33f542ec82d9d4f2d52ad9c661 100644 (file)
@@ -84,6 +84,7 @@ struct perf_evsel {
        bool                    supported;
        bool                    needs_swap;
        bool                    no_aux_samples;
+       bool                    immediate;
        /* parse modifier helper */
        int                     exclude_GH;
        int                     nr_members;