metricgroup.h 1.4 KB
Newer Older
1
// SPDX-License-Identifier: GPL-2.0-only
2 3 4
#ifndef METRICGROUP_H
#define METRICGROUP_H 1

5 6 7 8 9
#include <linux/list.h>
#include <linux/rbtree.h>
#include <stdbool.h>

struct evsel;
10
struct evlist;
11 12
struct option;
struct rblist;
13
struct pmu_events_map;
14 15 16

struct metric_event {
	struct rb_node nd;
17
	struct evsel *evsel;
18 19 20
	struct list_head head; /* list of metric_expr */
};

21 22 23 24 25
struct metric_ref {
	const char *metric_name;
	const char *metric_expr;
};

26 27 28 29
struct metric_expr {
	struct list_head nd;
	const char *metric_expr;
	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 39
					 bool create);
int metricgroup__parse_groups(const struct option *opt,
40 41 42 43
			      const char *str,
			      bool metric_no_group,
			      bool metric_no_merge,
			      struct rblist *metric_events);
44

45 46 47 48 49 50 51
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);

52 53
void metricgroup__print(bool metrics, bool groups, char *filter,
			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