xref: /openbmc/linux/tools/perf/util/metricgroup.h (revision 29c37341)
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_ref {
22 	const char *metric_name;
23 	const char *metric_expr;
24 };
25 
26 struct metric_expr {
27 	struct list_head nd;
28 	const char *metric_expr;
29 	const char *metric_name;
30 	const char *metric_unit;
31 	struct evsel **metric_events;
32 	struct metric_ref *metric_refs;
33 	int runtime;
34 };
35 
36 struct metric_event *metricgroup__lookup(struct rblist *metric_events,
37 					 struct evsel *evsel,
38 					 bool create);
39 int metricgroup__parse_groups(const struct option *opt,
40 			      const char *str,
41 			      bool metric_no_group,
42 			      bool metric_no_merge,
43 			      struct rblist *metric_events);
44 
45 int metricgroup__parse_groups_test(struct evlist *evlist,
46 				   struct pmu_events_map *map,
47 				   const char *str,
48 				   bool metric_no_group,
49 				   bool metric_no_merge,
50 				   struct rblist *metric_events);
51 
52 void metricgroup__print(bool metrics, bool groups, char *filter,
53 			bool raw, bool details);
54 bool metricgroup__has_metric(const char *metric);
55 int arch_get_runtimeparam(void);
56 void metricgroup__rblist_exit(struct rblist *metric_events);
57 #endif
58