perf evsel: No need to always ask for PERF_FORMAT_ID in read_format

Instead make perf_evlist__confir_attrs use perf_evsel__set_sample_id()
when having more than one event, that way only if we have multiple
events we'll ask to have the event ids returned when we read its file
descriptors.

Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
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/n/tip-xuho5hrrxy2ky0cjpr80hyfp@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
Arnaldo Carvalho de Melo 2012-12-10 15:29:12 -03:00
parent 7a5a5ca5fe
commit 3a5afaec59
5 changed files with 7 additions and 4 deletions

View File

@ -7,7 +7,7 @@ size=96
config=0
sample_period=4000
sample_type=263
read_format=7
read_format=3
disabled=1
inherit=1
pinned=0

View File

@ -6,12 +6,14 @@ args = --group -e cycles,instructions kill >/dev/null 2>&1
fd=1
group_fd=-1
sample_type=327
read_format=7
[event-2:base-record]
fd=2
group_fd=1
config=1
sample_type=327
read_format=7
mmap=0
comm=0
enable_on_exec=0

View File

@ -6,6 +6,7 @@ args = -e '{cycles,instructions}' kill >/tmp/krava 2>&1
fd=1
group_fd=-1
sample_type=327
read_format=7
[event-2:base-record]
fd=2
@ -13,6 +14,7 @@ group_fd=1
type=0
config=1
sample_type=327
read_format=7
mmap=0
comm=0
enable_on_exec=0

View File

@ -61,7 +61,7 @@ void perf_evlist__config_attrs(struct perf_evlist *evlist,
perf_evsel__config(evsel, opts);
if (evlist->nr_entries > 1)
perf_evsel__set_sample_bit(evsel, ID);
perf_evsel__set_sample_id(evsel);
}
}

View File

@ -466,8 +466,7 @@ void perf_evsel__config(struct perf_evsel *evsel,
attr->sample_id_all = opts->sample_id_all_missing ? 0 : 1;
attr->inherit = !opts->no_inherit;
attr->read_format = PERF_FORMAT_TOTAL_TIME_ENABLED |
PERF_FORMAT_TOTAL_TIME_RUNNING |
PERF_FORMAT_ID;
PERF_FORMAT_TOTAL_TIME_RUNNING;
perf_evsel__set_sample_bit(evsel, IP);
perf_evsel__set_sample_bit(evsel, TID);