blob: 07d553fe8d83c815ab65693c247aa7fa77446bd0 [file] [log] [blame]
Jiri Olsacd82a322012-03-15 20:09:17 +01001#ifndef __PMU_H
2#define __PMU_H
3
4#include <linux/bitops.h>
Ingo Molnar7d380c82012-10-14 10:40:57 +02005#include "../../../include/uapi/linux/perf_event.h"
Jiri Olsacd82a322012-03-15 20:09:17 +01006
7enum {
8 PERF_PMU_FORMAT_VALUE_CONFIG,
9 PERF_PMU_FORMAT_VALUE_CONFIG1,
10 PERF_PMU_FORMAT_VALUE_CONFIG2,
11};
12
13#define PERF_PMU_FORMAT_BITS 64
14
15struct perf_pmu__format {
16 char *name;
17 int value;
18 DECLARE_BITMAP(bits, PERF_PMU_FORMAT_BITS);
19 struct list_head list;
20};
21
Zheng Yana6146d52012-06-15 14:31:41 +080022struct perf_pmu__alias {
23 char *name;
24 struct list_head terms;
25 struct list_head list;
26};
27
Jiri Olsacd82a322012-03-15 20:09:17 +010028struct perf_pmu {
29 char *name;
30 __u32 type;
Yan, Zheng7ae92e72012-09-10 15:53:50 +080031 struct cpu_map *cpus;
Jiri Olsacd82a322012-03-15 20:09:17 +010032 struct list_head format;
Zheng Yana6146d52012-06-15 14:31:41 +080033 struct list_head aliases;
Jiri Olsacd82a322012-03-15 20:09:17 +010034 struct list_head list;
35};
36
37struct perf_pmu *perf_pmu__find(char *name);
38int perf_pmu__config(struct perf_pmu *pmu, struct perf_event_attr *attr,
39 struct list_head *head_terms);
Jiri Olsacff7f952012-11-10 01:46:50 +010040int perf_pmu__config_terms(struct list_head *formats,
41 struct perf_event_attr *attr,
42 struct list_head *head_terms);
Zheng Yana6146d52012-06-15 14:31:41 +080043int perf_pmu__check_alias(struct perf_pmu *pmu, struct list_head *head_terms);
44struct list_head *perf_pmu__alias(struct perf_pmu *pmu,
45 struct list_head *head_terms);
Jiri Olsacd82a322012-03-15 20:09:17 +010046int perf_pmu_wrap(void);
47void perf_pmu_error(struct list_head *list, char *name, char const *msg);
48
49int perf_pmu__new_format(struct list_head *list, char *name,
50 int config, unsigned long *bits);
51void perf_pmu__set_format(unsigned long *bits, long from, long to);
Jiri Olsacff7f952012-11-10 01:46:50 +010052int perf_pmu__format_parse(char *dir, struct list_head *head);
Jiri Olsacd82a322012-03-15 20:09:17 +010053
Robert Richter50a96672012-08-16 21:10:24 +020054struct perf_pmu *perf_pmu__scan(struct perf_pmu *pmu);
55
Jiri Olsacd82a322012-03-15 20:09:17 +010056int perf_pmu__test(void);
57#endif /* __PMU_H */