metricgroup.h 1.3 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 21 22 23 24
	struct list_head head; /* list of metric_expr */
};

struct metric_expr {
	struct list_head nd;
	const char *metric_expr;
	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 33
					 bool create);
int metricgroup__parse_groups(const struct option *opt,
34 35 36 37
			      const char *str,
			      bool metric_no_group,
			      bool metric_no_merge,
			      struct rblist *metric_events);
38

39 40 41 42 43 44 45
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);

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