Arnaldo Carvalho de Melo | 0b8026e | 2019-08-21 10:54:14 -0300 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0-only |
Andi Kleen | b18f3e3 | 2017-08-31 12:40:31 -0700 | [diff] [blame] | 2 | #ifndef METRICGROUP_H |
| 3 | #define METRICGROUP_H 1 |
| 4 | |
Arnaldo Carvalho de Melo | 0b8026e | 2019-08-21 10:54:14 -0300 | [diff] [blame] | 5 | #include <linux/list.h> |
| 6 | #include <linux/rbtree.h> |
| 7 | #include <stdbool.h> |
| 8 | |
| 9 | struct evsel; |
| 10 | struct option; |
| 11 | struct rblist; |
Andi Kleen | b18f3e3 | 2017-08-31 12:40:31 -0700 | [diff] [blame] | 12 | |
| 13 | struct metric_event { |
| 14 | struct rb_node nd; |
Jiri Olsa | 32dcd02 | 2019-07-21 13:23:51 +0200 | [diff] [blame] | 15 | struct evsel *evsel; |
Andi Kleen | b18f3e3 | 2017-08-31 12:40:31 -0700 | [diff] [blame] | 16 | struct list_head head; /* list of metric_expr */ |
| 17 | }; |
| 18 | |
| 19 | struct metric_expr { |
| 20 | struct list_head nd; |
| 21 | const char *metric_expr; |
| 22 | const char *metric_name; |
Jin Yao | 287f264 | 2019-08-28 13:59:31 +0800 | [diff] [blame] | 23 | const char *metric_unit; |
Jiri Olsa | 32dcd02 | 2019-07-21 13:23:51 +0200 | [diff] [blame] | 24 | struct evsel **metric_events; |
Andi Kleen | b18f3e3 | 2017-08-31 12:40:31 -0700 | [diff] [blame] | 25 | }; |
| 26 | |
| 27 | struct metric_event *metricgroup__lookup(struct rblist *metric_events, |
Jiri Olsa | 32dcd02 | 2019-07-21 13:23:51 +0200 | [diff] [blame] | 28 | struct evsel *evsel, |
Andi Kleen | b18f3e3 | 2017-08-31 12:40:31 -0700 | [diff] [blame] | 29 | bool create); |
| 30 | int metricgroup__parse_groups(const struct option *opt, |
| 31 | const char *str, |
| 32 | struct rblist *metric_events); |
| 33 | |
Jiri Olsa | 33bbc57 | 2019-02-13 13:32:41 +0100 | [diff] [blame] | 34 | void metricgroup__print(bool metrics, bool groups, char *filter, |
| 35 | bool raw, bool details); |
Thomas Richter | 742d92f | 2018-06-26 09:17:01 +0200 | [diff] [blame] | 36 | bool metricgroup__has_metric(const char *metric); |
Andi Kleen | b18f3e3 | 2017-08-31 12:40:31 -0700 | [diff] [blame] | 37 | #endif |