metricgroup.h 1.7 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 evlist;
11 12 13
struct evsel;
struct option;
struct rblist;
14
struct pmu_events_map;
15
struct cgroup;
16 17 18

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

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

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

struct metric_event *metricgroup__lookup(struct rblist *metric_events,
39
					 struct evsel *evsel,
40 41
					 bool create);
int metricgroup__parse_groups(const struct option *opt,
42 43 44 45
			      const char *str,
			      bool metric_no_group,
			      bool metric_no_merge,
			      struct rblist *metric_events);
46 47
struct pmu_event *metricgroup__find_metric(const char *metric,
					   struct pmu_events_map *map);
48 49 50 51 52 53 54
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);

55 56
void metricgroup__print(bool metrics, bool groups, char *filter,
			bool raw, bool details);
57
bool metricgroup__has_metric(const char *metric);
58
int arch_get_runtimeparam(struct pmu_event *pe __maybe_unused);
59
void metricgroup__rblist_exit(struct rblist *metric_events);
60 61 62 63

int metricgroup__copy_metric_events(struct evlist *evlist, struct cgroup *cgrp,
				    struct rblist *new_metric_events,
				    struct rblist *old_metric_events);
64
#endif