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
#include <linux/list.h>
#include <linux/rbtree.h>
#include <stdbool.h>
8
#include "pmu-events/pmu-events.h"
9 10

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

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

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

27 28 29 30
struct metric_expr {
	struct list_head nd;
	const char *metric_expr;
	const char *metric_name;
31
	const char *metric_unit;
32
	struct evsel **metric_events;
33
	struct metric_ref *metric_refs;
34
	int runtime;
35 36 37
};

struct metric_event *metricgroup__lookup(struct rblist *metric_events,
38
					 struct evsel *evsel,
39 40
					 bool create);
int metricgroup__parse_groups(const struct option *opt,
41 42 43 44
			      const char *str,
			      bool metric_no_group,
			      bool metric_no_merge,
			      struct rblist *metric_events);
45

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

53 54
void metricgroup__print(bool metrics, bool groups, char *filter,
			bool raw, bool details);
55
bool metricgroup__has_metric(const char *metric);
56
int arch_get_runtimeparam(struct pmu_event *pe __maybe_unused);
57
void metricgroup__rblist_exit(struct rblist *metric_events);
58
#endif