summaryrefslogtreecommitdiffstats
path: root/tools/perf/util/metricgroup.h
blob: 62623a39cbecd46763662463c831a2032b09787b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
// SPDX-License-Identifier: GPL-2.0-only
#ifndef METRICGROUP_H
#define METRICGROUP_H 1

#include <linux/list.h>
#include <linux/rbtree.h>
#include <stdbool.h>

struct evsel;
struct evlist;
struct option;
struct rblist;
struct pmu_events_map;

struct metric_event {
	struct rb_node nd;
	struct evsel *evsel;
	struct list_head head; /* list of metric_expr */
};

struct metric_ref {
	const char *metric_name;
	const char *metric_expr;
};

struct metric_expr {
	struct list_head nd;
	const char *metric_expr;
	const char *metric_name;
	const char *metric_unit;
	struct evsel **metric_events;
	struct metric_ref *metric_refs;
	int runtime;
};

struct metric_event *metricgroup__lookup(struct rblist *metric_events,
					 struct evsel *evsel,
					 bool create);
int metricgroup__parse_groups(const struct option *opt,
			      const char *str,
			      bool metric_no_group,
			      bool metric_no_merge,
			      struct rblist *metric_events);

int metricgroup__parse_groups_test(struct evlist *evlist,
				   struct pmu_events_map *map,
				   const char *str,
				   bool metric_no_group,
				   bool metric_no_merge,
				   struct rblist *metric_events);

void metricgroup__print(bool metrics, bool groups, char *filter,
			bool raw, bool details);
bool metricgroup__has_metric(const char *metric);
int arch_get_runtimeparam(void);
void metricgroup__rblist_exit(struct rblist *metric_events);
#endif