From: Arnaldo Carvalho de Melo Date: Wed, 26 Sep 2012 15:28:26 +0000 (-0300) Subject: perf evsel: Improve tracepoint constructor setup X-Git-Tag: v3.12-rc1~1727^2~42^2~15 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0b80f8b32f31f80e001fb6355fd86769555c4a3c;p=kernel%2Fkernel-generic.git perf evsel: Improve tracepoint constructor setup It needs to properly set the sample_type, sample_period and the KVM related perf_event_attr fields. Cc: David Ahern Cc: Frederic Weisbecker Cc: Jiri Olsa Cc: Mike Galbraith Cc: Namhyung Kim Cc: Paul Mackerras Cc: Peter Zijlstra Cc: Stephane Eranian Link: http://lkml.kernel.org/n/tip-v9x3q9rv4caxtox7wtjpchq5@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c index 00936ad..2467eaf 100644 --- a/tools/perf/util/evsel.c +++ b/tools/perf/util/evsel.c @@ -117,14 +117,18 @@ struct perf_evsel *perf_evsel__newtp(const char *sys, const char *name, int idx) if (evsel != NULL) { struct perf_event_attr attr = { - .type = PERF_TYPE_TRACEPOINT, + .type = PERF_TYPE_TRACEPOINT, + .sample_type = (PERF_SAMPLE_RAW | PERF_SAMPLE_TIME | + PERF_SAMPLE_CPU | PERF_SAMPLE_PERIOD), }; evsel->tp_format = event_format__new(sys, name); if (evsel->tp_format == NULL) goto out_free; + event_attr_init(&attr); attr.config = evsel->tp_format->id; + attr.sample_period = 1; perf_evsel__init(evsel, &attr, idx); evsel->name = evsel->tp_format->name; }