aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/evsel.c
diff options
context:
space:
mode:
authorJiri Olsa <jolsa@redhat.com>2012-10-10 11:38:13 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2013-08-07 16:35:20 -0400
commit9ede473cc9f655f8a10cfc8ebbf04c48d84db7ee (patch)
tree7a05d71c33eaab621009296d5964534c6c31088c /tools/perf/util/evsel.c
parente2b5abe0c82b45980b95ead22678861a2013c0df (diff)
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>
Diffstat (limited to 'tools/perf/util/evsel.c')
-rw-r--r--tools/perf/util/evsel.c30
1 files changed, 28 insertions, 2 deletions
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index 8bed0c1a1399..9ab8fff74e30 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -1096,8 +1096,34 @@ int perf_evsel__parse_sample(struct perf_evsel *evsel, union perf_event *event,
1096 } 1096 }
1097 1097
1098 if (type & PERF_SAMPLE_READ) { 1098 if (type & PERF_SAMPLE_READ) {
1099 fprintf(stderr, "PERF_SAMPLE_READ is unsupported for now\n"); 1099 u64 read_format = evsel->attr.read_format;
1100 return -1; 1100
1101 if (read_format & PERF_FORMAT_GROUP)
1102 data->read.group.nr = *array;
1103 else
1104 data->read.one.value = *array;
1105
1106 array++;
1107
1108 if (read_format & PERF_FORMAT_TOTAL_TIME_ENABLED) {
1109 data->read.time_enabled = *array;
1110 array++;
1111 }
1112
1113 if (read_format & PERF_FORMAT_TOTAL_TIME_RUNNING) {
1114 data->read.time_running = *array;
1115 array++;
1116 }
1117
1118 /* PERF_FORMAT_ID is forced for PERF_SAMPLE_READ */
1119 if (read_format & PERF_FORMAT_GROUP) {
1120 data->read.group.values = (struct sample_read_value *) array;
1121 array = (void *) array + data->read.group.nr *
1122 sizeof(struct sample_read_value);
1123 } else {
1124 data->read.one.id = *array;
1125 array++;
1126 }
1101 } 1127 }
1102 1128
1103 if (type & PERF_SAMPLE_CALLCHAIN) { 1129 if (type & PERF_SAMPLE_CALLCHAIN) {