mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-29 07:04:10 +08:00
50a9667c93
With dynamic pmu allocation there are also dynamically assigned pmu ids. These ids are used in event->attr.type to describe the pmu to be used for that event. The information is available in sysfs, e.g: /sys/bus/event_source/devices/breakpoint/type: 5 /sys/bus/event_source/devices/cpu/type: 4 /sys/bus/event_source/devices/ibs_fetch/type: 6 /sys/bus/event_source/devices/ibs_op/type: 7 /sys/bus/event_source/devices/software/type: 1 /sys/bus/event_source/devices/tracepoint/type: 2 These mappings are needed to know which samples belong to which pmu. If a pmu is added dynamically like for ibs_fetch or ibs_op the type value may vary. Now, when decoding samples from perf.data this information in sysfs might be no longer available or may have changed. We need to store it in perf.data. Using the header for this. Now the header information created with perf report contains an additional section looking like this: # pmu mappings: ibs_op = 7, ibs_fetch = 6, cpu = 4, breakpoint = 5, tracepoint = 2, software = 1 Signed-off-by: Robert Richter <robert.richter@amd.com> Acked-by: Peter Zijlstra <peterz@infradead.org> Cc: Ingo Molnar <mingo@kernel.org> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Peter Zijlstra <peterz@infradead.org> Link: http://lkml.kernel.org/r/1345144224-27280-9-git-send-email-robert.richter@amd.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
53 lines
1.3 KiB
C
53 lines
1.3 KiB
C
#ifndef __PMU_H
|
|
#define __PMU_H
|
|
|
|
#include <linux/bitops.h>
|
|
#include "../../../include/linux/perf_event.h"
|
|
|
|
enum {
|
|
PERF_PMU_FORMAT_VALUE_CONFIG,
|
|
PERF_PMU_FORMAT_VALUE_CONFIG1,
|
|
PERF_PMU_FORMAT_VALUE_CONFIG2,
|
|
};
|
|
|
|
#define PERF_PMU_FORMAT_BITS 64
|
|
|
|
struct perf_pmu__format {
|
|
char *name;
|
|
int value;
|
|
DECLARE_BITMAP(bits, PERF_PMU_FORMAT_BITS);
|
|
struct list_head list;
|
|
};
|
|
|
|
struct perf_pmu__alias {
|
|
char *name;
|
|
struct list_head terms;
|
|
struct list_head list;
|
|
};
|
|
|
|
struct perf_pmu {
|
|
char *name;
|
|
__u32 type;
|
|
struct list_head format;
|
|
struct list_head aliases;
|
|
struct list_head list;
|
|
};
|
|
|
|
struct perf_pmu *perf_pmu__find(char *name);
|
|
int perf_pmu__config(struct perf_pmu *pmu, struct perf_event_attr *attr,
|
|
struct list_head *head_terms);
|
|
int perf_pmu__check_alias(struct perf_pmu *pmu, struct list_head *head_terms);
|
|
struct list_head *perf_pmu__alias(struct perf_pmu *pmu,
|
|
struct list_head *head_terms);
|
|
int perf_pmu_wrap(void);
|
|
void perf_pmu_error(struct list_head *list, char *name, char const *msg);
|
|
|
|
int perf_pmu__new_format(struct list_head *list, char *name,
|
|
int config, unsigned long *bits);
|
|
void perf_pmu__set_format(unsigned long *bits, long from, long to);
|
|
|
|
struct perf_pmu *perf_pmu__scan(struct perf_pmu *pmu);
|
|
|
|
int perf_pmu__test(void);
|
|
#endif /* __PMU_H */
|