diff options
Diffstat (limited to 'tools/perf/util/evlist.c')
-rw-r--r-- | tools/perf/util/evlist.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c index 23eb22b05d27..50aa34879c33 100644 --- a/tools/perf/util/evlist.c +++ b/tools/perf/util/evlist.c | |||
@@ -459,3 +459,34 @@ int perf_evlist__set_filters(struct perf_evlist *evlist) | |||
459 | 459 | ||
460 | return 0; | 460 | return 0; |
461 | } | 461 | } |
462 | |||
463 | u64 perf_evlist__sample_type(struct perf_evlist *evlist) | ||
464 | { | ||
465 | struct perf_evsel *pos; | ||
466 | u64 type = 0; | ||
467 | |||
468 | list_for_each_entry(pos, &evlist->entries, node) { | ||
469 | if (!type) | ||
470 | type = pos->attr.sample_type; | ||
471 | else if (type != pos->attr.sample_type) | ||
472 | die("non matching sample_type"); | ||
473 | } | ||
474 | |||
475 | return type; | ||
476 | } | ||
477 | |||
478 | bool perf_evlist__sample_id_all(const struct perf_evlist *evlist) | ||
479 | { | ||
480 | bool value = false, first = true; | ||
481 | struct perf_evsel *pos; | ||
482 | |||
483 | list_for_each_entry(pos, &evlist->entries, node) { | ||
484 | if (first) { | ||
485 | value = pos->attr.sample_id_all; | ||
486 | first = false; | ||
487 | } else if (value != pos->attr.sample_id_all) | ||
488 | die("non matching sample_id_all"); | ||
489 | } | ||
490 | |||
491 | return value; | ||
492 | } | ||