diff options
Diffstat (limited to 'tools/perf/util/evsel.c')
| -rw-r--r-- | tools/perf/util/evsel.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c index cca29ededb5b..0239eb87b232 100644 --- a/tools/perf/util/evsel.c +++ b/tools/perf/util/evsel.c | |||
| @@ -15,6 +15,22 @@ | |||
| 15 | 15 | ||
| 16 | #define FD(e, x, y) (*(int *)xyarray__entry(e->fd, x, y)) | 16 | #define FD(e, x, y) (*(int *)xyarray__entry(e->fd, x, y)) |
| 17 | 17 | ||
| 18 | int __perf_evsel__sample_size(u64 sample_type) | ||
| 19 | { | ||
| 20 | u64 mask = sample_type & PERF_SAMPLE_MASK; | ||
| 21 | int size = 0; | ||
| 22 | int i; | ||
| 23 | |||
| 24 | for (i = 0; i < 64; i++) { | ||
| 25 | if (mask & (1ULL << i)) | ||
| 26 | size++; | ||
| 27 | } | ||
| 28 | |||
| 29 | size *= sizeof(u64); | ||
| 30 | |||
| 31 | return size; | ||
| 32 | } | ||
| 33 | |||
| 18 | void perf_evsel__init(struct perf_evsel *evsel, | 34 | void perf_evsel__init(struct perf_evsel *evsel, |
| 19 | struct perf_event_attr *attr, int idx) | 35 | struct perf_event_attr *attr, int idx) |
| 20 | { | 36 | { |
