blob: 1179b26f244a31280e5454787a51a8f01ff9ac2e [file] [log] [blame]
Jiri Olsacd82a322012-03-15 20:09:17 +01001#ifndef __PMU_H
2#define __PMU_H
3
4#include <linux/bitops.h>
David Howellsd2709c72012-11-19 22:21:03 +00005#include <linux/perf_event.h>
Andi Kleendc098b32013-04-20 11:02:29 -07006#include <stdbool.h>
Jiri Olsacd82a322012-03-15 20:09:17 +01007
8enum {
9 PERF_PMU_FORMAT_VALUE_CONFIG,
10 PERF_PMU_FORMAT_VALUE_CONFIG1,
11 PERF_PMU_FORMAT_VALUE_CONFIG2,
12};
13
14#define PERF_PMU_FORMAT_BITS 64
15
Jiri Olsacd82a322012-03-15 20:09:17 +010016struct perf_pmu {
17 char *name;
18 __u32 type;
Yan, Zheng7ae92e72012-09-10 15:53:50 +080019 struct cpu_map *cpus;
Jiri Olsacd82a322012-03-15 20:09:17 +010020 struct list_head format;
Zheng Yana6146d52012-06-15 14:31:41 +080021 struct list_head aliases;
Jiri Olsacd82a322012-03-15 20:09:17 +010022 struct list_head list;
23};
24
Adrian Hunterb6b96fb2013-07-04 16:20:25 +030025struct perf_pmu *perf_pmu__find(const char *name);
Jiri Olsacd82a322012-03-15 20:09:17 +010026int perf_pmu__config(struct perf_pmu *pmu, struct perf_event_attr *attr,
27 struct list_head *head_terms);
Jiri Olsacff7f952012-11-10 01:46:50 +010028int perf_pmu__config_terms(struct list_head *formats,
29 struct perf_event_attr *attr,
30 struct list_head *head_terms);
Zheng Yana6146d52012-06-15 14:31:41 +080031int perf_pmu__check_alias(struct perf_pmu *pmu, struct list_head *head_terms);
32struct list_head *perf_pmu__alias(struct perf_pmu *pmu,
Arnaldo Carvalho de Melo5c6ccc32013-01-18 16:54:00 -030033 struct list_head *head_terms);
Jiri Olsacd82a322012-03-15 20:09:17 +010034int perf_pmu_wrap(void);
35void perf_pmu_error(struct list_head *list, char *name, char const *msg);
36
37int perf_pmu__new_format(struct list_head *list, char *name,
38 int config, unsigned long *bits);
39void perf_pmu__set_format(unsigned long *bits, long from, long to);
Jiri Olsacff7f952012-11-10 01:46:50 +010040int perf_pmu__format_parse(char *dir, struct list_head *head);
Jiri Olsacd82a322012-03-15 20:09:17 +010041
Robert Richter50a96672012-08-16 21:10:24 +020042struct perf_pmu *perf_pmu__scan(struct perf_pmu *pmu);
43
Andi Kleendc098b32013-04-20 11:02:29 -070044void print_pmu_events(const char *event_glob, bool name_only);
Andi Kleen4cabc3d2013-08-21 16:47:26 -070045bool pmu_have_event(const char *pname, const char *name);
Andi Kleendc098b32013-04-20 11:02:29 -070046
Jiri Olsacd82a322012-03-15 20:09:17 +010047int perf_pmu__test(void);
48#endif /* __PMU_H */