diff options
author | Ingo Molnar <mingo@kernel.org> | 2015-07-06 17:46:15 +0200 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2015-07-06 17:46:15 +0200 |
commit | 60cd37eb100c4880b28078a47f3062fac7572095 (patch) | |
tree | 5cb03265f2ab74735f8d479d7bb7d85d8aa9e092 /tools/perf/util/evsel.c | |
parent | ebf2d2689de551d90965090bb991fc640a0c0d41 (diff) | |
parent | ab85785aa13c36440a91a8e9f7616357de411a1f (diff) |
Merge tag 'perf-core-for-mingo' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/core
Pull perf/core improvements and fixes from Arnaldo Carvalho de Melo:
User visible changes:
- Take tracefs into account when reporting errors about accessing
tracepoint information in tools like 'perf trace' (Arnaldo Carvalho de Melo)
- Let user have timestamps with per-thread recording in 'perf record' (Adrian Hunter)
Infrastructure changes:
- Introduce series of functions to build event filters so that we
can set them in just one ioctl call, useful to set up common_pid,
raw_syscalls:sys_{enter,exit}'s "id" filters to use with
'perf trace' (Arnaldo Carvalho de Melo)
- Delete an unnecessary check before calling strfilter__delete() (Markus Elfring)
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'tools/perf/util/evsel.c')
-rw-r--r-- | tools/perf/util/evsel.c | 37 |
1 files changed, 34 insertions, 3 deletions
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c index 2936b3080722..83c08037e7e2 100644 --- a/tools/perf/util/evsel.c +++ b/tools/perf/util/evsel.c @@ -707,7 +707,8 @@ void perf_evsel__config(struct perf_evsel *evsel, struct record_opts *opts) */ if (opts->sample_time && (!perf_missing_features.sample_id_all && - (!opts->no_inherit || target__has_cpu(&opts->target) || per_cpu))) + (!opts->no_inherit || target__has_cpu(&opts->target) || per_cpu || + opts->sample_time_set))) perf_evsel__set_sample_bit(evsel, TIME); if (opts->raw_samples && !evsel->no_aux_samples) { @@ -815,14 +816,44 @@ static int perf_evsel__run_ioctl(struct perf_evsel *evsel, int ncpus, int nthrea return 0; } -int perf_evsel__set_filter(struct perf_evsel *evsel, int ncpus, int nthreads, - const char *filter) +int perf_evsel__apply_filter(struct perf_evsel *evsel, int ncpus, int nthreads, + const char *filter) { return perf_evsel__run_ioctl(evsel, ncpus, nthreads, PERF_EVENT_IOC_SET_FILTER, (void *)filter); } +int perf_evsel__set_filter(struct perf_evsel *evsel, const char *filter) +{ + char *new_filter = strdup(filter); + + if (new_filter != NULL) { + free(evsel->filter); + evsel->filter = new_filter; + return 0; + } + + return -1; +} + +int perf_evsel__append_filter(struct perf_evsel *evsel, + const char *op, const char *filter) +{ + char *new_filter; + + if (evsel->filter == NULL) + return perf_evsel__set_filter(evsel, filter); + + if (asprintf(&new_filter,"(%s) %s (%s)", evsel->filter, op, filter) > 0) { + free(evsel->filter); + evsel->filter = new_filter; + return 0; + } + + return -1; +} + int perf_evsel__enable(struct perf_evsel *evsel, int ncpus, int nthreads) { return perf_evsel__run_ioctl(evsel, ncpus, nthreads, |