perf tools: Add support for parsing PERF_SAMPLE_READ sample type
Adding support to parse out the PERF_SAMPLE_READ sample bits. The code contains both single and group format specification. This code parse out and prepare PERF_SAMPLE_READ data into the perf_sample struct. It will be used for group leader sampling feature comming in shortly. Signed-off-by: Jiri Olsa <jolsa@redhat.com> Acked-by: Namhyung Kim <namhyung@kernel.org> Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Link: http://lkml.kernel.org/n/tip-0tgdoln5rwk3wocshb442cl3@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
committed by
Arnaldo Carvalho de Melo
parent
e2b5abe0c8
commit
9ede473cc9
@@ -1096,8 +1096,34 @@ int perf_evsel__parse_sample(struct perf_evsel *evsel, union perf_event *event,
|
||||
}
|
||||
|
||||
if (type & PERF_SAMPLE_READ) {
|
||||
fprintf(stderr, "PERF_SAMPLE_READ is unsupported for now\n");
|
||||
return -1;
|
||||
u64 read_format = evsel->attr.read_format;
|
||||
|
||||
if (read_format & PERF_FORMAT_GROUP)
|
||||
data->read.group.nr = *array;
|
||||
else
|
||||
data->read.one.value = *array;
|
||||
|
||||
array++;
|
||||
|
||||
if (read_format & PERF_FORMAT_TOTAL_TIME_ENABLED) {
|
||||
data->read.time_enabled = *array;
|
||||
array++;
|
||||
}
|
||||
|
||||
if (read_format & PERF_FORMAT_TOTAL_TIME_RUNNING) {
|
||||
data->read.time_running = *array;
|
||||
array++;
|
||||
}
|
||||
|
||||
/* PERF_FORMAT_ID is forced for PERF_SAMPLE_READ */
|
||||
if (read_format & PERF_FORMAT_GROUP) {
|
||||
data->read.group.values = (struct sample_read_value *) array;
|
||||
array = (void *) array + data->read.group.nr *
|
||||
sizeof(struct sample_read_value);
|
||||
} else {
|
||||
data->read.one.id = *array;
|
||||
array++;
|
||||
}
|
||||
}
|
||||
|
||||
if (type & PERF_SAMPLE_CALLCHAIN) {
|
||||
|
Reference in New Issue
Block a user