blob: 475c7f912864f9ff512cf9d189bed9ed1b4fa7a3 [file] [log] [blame]
Arnaldo Carvalho de Melo0b8026e2019-08-21 10:54:14 -03001// SPDX-License-Identifier: GPL-2.0-only
Andi Kleenb18f3e32017-08-31 12:40:31 -07002#ifndef METRICGROUP_H
3#define METRICGROUP_H 1
4
Arnaldo Carvalho de Melo0b8026e2019-08-21 10:54:14 -03005#include <linux/list.h>
6#include <linux/rbtree.h>
7#include <stdbool.h>
8
9struct evsel;
10struct option;
11struct rblist;
Andi Kleenb18f3e32017-08-31 12:40:31 -070012
13struct metric_event {
14 struct rb_node nd;
Jiri Olsa32dcd022019-07-21 13:23:51 +020015 struct evsel *evsel;
Andi Kleenb18f3e32017-08-31 12:40:31 -070016 struct list_head head; /* list of metric_expr */
17};
18
19struct metric_expr {
20 struct list_head nd;
21 const char *metric_expr;
22 const char *metric_name;
Jin Yao287f2642019-08-28 13:59:31 +080023 const char *metric_unit;
Jiri Olsa32dcd022019-07-21 13:23:51 +020024 struct evsel **metric_events;
Andi Kleenb18f3e32017-08-31 12:40:31 -070025};
26
27struct metric_event *metricgroup__lookup(struct rblist *metric_events,
Jiri Olsa32dcd022019-07-21 13:23:51 +020028 struct evsel *evsel,
Andi Kleenb18f3e32017-08-31 12:40:31 -070029 bool create);
30int metricgroup__parse_groups(const struct option *opt,
31 const char *str,
32 struct rblist *metric_events);
33
Jiri Olsa33bbc572019-02-13 13:32:41 +010034void metricgroup__print(bool metrics, bool groups, char *filter,
35 bool raw, bool details);
Thomas Richter742d92f2018-06-26 09:17:01 +020036bool metricgroup__has_metric(const char *metric);
Andi Kleenb18f3e32017-08-31 12:40:31 -070037#endif