1 // SPDX-License-Identifier: GPL-2.0-only 2 #ifndef METRICGROUP_H 3 #define METRICGROUP_H 1 4 5 #include <linux/list.h> 6 #include <linux/rbtree.h> 7 #include <stdbool.h> 8 9 struct evsel; 10 struct evlist; 11 struct option; 12 struct rblist; 13 struct pmu_events_map; 14 15 struct metric_event { 16 struct rb_node nd; 17 struct evsel *evsel; 18 struct list_head head; /* list of metric_expr */ 19 }; 20 21 struct metric_expr { 22 struct list_head nd; 23 const char *metric_expr; 24 const char *metric_name; 25 const char *metric_unit; 26 struct evsel **metric_events; 27 int runtime; 28 }; 29 30 struct metric_event *metricgroup__lookup(struct rblist *metric_events, 31 struct evsel *evsel, 32 bool create); 33 int metricgroup__parse_groups(const struct option *opt, 34 const char *str, 35 bool metric_no_group, 36 bool metric_no_merge, 37 struct rblist *metric_events); 38 39 int metricgroup__parse_groups_test(struct evlist *evlist, 40 struct pmu_events_map *map, 41 const char *str, 42 bool metric_no_group, 43 bool metric_no_merge, 44 struct rblist *metric_events); 45 46 void metricgroup__print(bool metrics, bool groups, char *filter, 47 bool raw, bool details); 48 bool metricgroup__has_metric(const char *metric); 49 int arch_get_runtimeparam(void); 50 void metricgroup__rblist_exit(struct rblist *metric_events); 51 #endif 52