metricgroup.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. // SPDX-License-Identifier: GPL-2.0-only
  2. #ifndef METRICGROUP_H
  3. #define METRICGROUP_H 1
  4. #include <linux/list.h>
  5. #include <linux/rbtree.h>
  6. #include <stdbool.h>
  7. #include "pmu-events/pmu-events.h"
  8. struct evlist;
  9. struct evsel;
  10. struct evlist;
  11. struct option;
  12. struct rblist;
  13. struct pmu_events_map;
  14. struct cgroup;
  15. struct metric_event {
  16. struct rb_node nd;
  17. struct evsel *evsel;
  18. struct list_head head; /* list of metric_expr */
  19. };
  20. struct metric_ref {
  21. const char *metric_name;
  22. const char *metric_expr;
  23. };
  24. struct metric_expr {
  25. struct list_head nd;
  26. const char *metric_expr;
  27. const char *metric_name;
  28. const char *metric_unit;
  29. struct evsel **metric_events;
  30. struct metric_ref *metric_refs;
  31. int runtime;
  32. };
  33. struct metric_event *metricgroup__lookup(struct rblist *metric_events,
  34. struct evsel *evsel,
  35. bool create);
  36. int metricgroup__parse_groups(const struct option *opt,
  37. const char *str,
  38. bool metric_no_group,
  39. bool metric_no_merge,
  40. struct rblist *metric_events);
  41. int metricgroup__parse_groups_test(struct evlist *evlist,
  42. struct pmu_events_map *map,
  43. const char *str,
  44. bool metric_no_group,
  45. bool metric_no_merge,
  46. struct rblist *metric_events);
  47. void metricgroup__print(bool metrics, bool groups, char *filter,
  48. bool raw, bool details);
  49. bool metricgroup__has_metric(const char *metric);
  50. int arch_get_runtimeparam(struct pmu_event *pe __maybe_unused);
  51. void metricgroup__rblist_exit(struct rblist *metric_events);
  52. int metricgroup__copy_metric_events(struct evlist *evlist, struct cgroup *cgrp,
  53. struct rblist *new_metric_events,
  54. struct rblist *old_metric_events);
  55. #endif