From 930a2e29758f865e3a7b34b8b3b37c08d40f0254 Mon Sep 17 00:00:00 2001 From: Jiri Olsa Date: Wed, 29 Jul 2015 05:42:10 -0400 Subject: perf tools: Add support for event post configuration Add support to overload any global settings for event and force user specified term value. It will be useful for new time and backtrace terms. Signed-off-by: Jiri Olsa Cc: Andi Kleen Cc: Kan Liang Cc: Namhyung Kim Link: http://lkml.kernel.org/r/1438162936-59698-2-git-send-email-kan.liang@intel.com Signed-off-by: Kan Liang Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/evsel.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'tools/perf/util/evsel.c') diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c index 71f6905..048d61d 100644 --- a/tools/perf/util/evsel.c +++ b/tools/perf/util/evsel.c @@ -207,6 +207,7 @@ void perf_evsel__init(struct perf_evsel *evsel, evsel->unit = ""; evsel->scale = 1.0; INIT_LIST_HEAD(&evsel->node); + INIT_LIST_HEAD(&evsel->config_terms); perf_evsel__object.init(evsel); evsel->sample_size = __perf_evsel__sample_size(attr->sample_type); perf_evsel__calc_id_pos(evsel); @@ -586,6 +587,19 @@ perf_evsel__config_callgraph(struct perf_evsel *evsel, } } +static void apply_config_terms(struct perf_event_attr *attr __maybe_unused, + struct list_head *config_terms) +{ + struct perf_evsel_config_term *term; + + list_for_each_entry(term, config_terms, list) { + switch (term->type) { + default: + break; + } + } +} + /* * The enable_on_exec/disabled value strategy: * @@ -777,6 +791,12 @@ void perf_evsel__config(struct perf_evsel *evsel, struct record_opts *opts) attr->use_clockid = 1; attr->clockid = opts->clockid; } + + /* + * Apply event specific term settings, + * it overloads any global configuration. + */ + apply_config_terms(attr, &evsel->config_terms); } static int perf_evsel__alloc_fd(struct perf_evsel *evsel, int ncpus, int nthreads) @@ -900,6 +920,16 @@ static void perf_evsel__free_id(struct perf_evsel *evsel) zfree(&evsel->id); } +static void perf_evsel__free_config_terms(struct perf_evsel *evsel) +{ + struct perf_evsel_config_term *term, *h; + + list_for_each_entry_safe(term, h, &evsel->config_terms, list) { + list_del(&term->list); + free(term); + } +} + void perf_evsel__close_fd(struct perf_evsel *evsel, int ncpus, int nthreads) { int cpu, thread; @@ -919,6 +949,7 @@ void perf_evsel__exit(struct perf_evsel *evsel) assert(list_empty(&evsel->node)); perf_evsel__free_fd(evsel); perf_evsel__free_id(evsel); + perf_evsel__free_config_terms(evsel); close_cgroup(evsel->cgrp); cpu_map__put(evsel->cpus); thread_map__put(evsel->threads); -- cgit v1.1