diff options
author | Peter Zijlstra <a.p.zijlstra@chello.nl> | 2009-03-23 13:22:06 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-04-06 03:30:25 -0400 |
commit | f4a2deb4860497f4332cf6a1acddab3dd628ddf0 (patch) | |
tree | 1655c7c000edce20d2c5b54cf12f99c23340371e /include/linux/perf_counter.h | |
parent | af9522cf133e9be6da8525a46a9ed7e7659f0e1a (diff) |
perf_counter: remove the event config bitfields
Since the bitfields turned into a bit of a mess, remove them and rely on
good old masks.
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
Orig-LKML-Reference: <20090323172417.059499915@chello.nl>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'include/linux/perf_counter.h')
-rw-r--r-- | include/linux/perf_counter.h | 74 |
1 files changed, 50 insertions, 24 deletions
diff --git a/include/linux/perf_counter.h b/include/linux/perf_counter.h index 98f5990be1e1..56099e52970d 100644 --- a/include/linux/perf_counter.h +++ b/include/linux/perf_counter.h | |||
@@ -82,32 +82,37 @@ enum perf_counter_record_type { | |||
82 | PERF_RECORD_GROUP = 2, | 82 | PERF_RECORD_GROUP = 2, |
83 | }; | 83 | }; |
84 | 84 | ||
85 | #define __PERF_COUNTER_MASK(name) \ | ||
86 | (((1ULL << PERF_COUNTER_##name##_BITS) - 1) << \ | ||
87 | PERF_COUNTER_##name##_SHIFT) | ||
88 | |||
89 | #define PERF_COUNTER_RAW_BITS 1 | ||
90 | #define PERF_COUNTER_RAW_SHIFT 63 | ||
91 | #define PERF_COUNTER_RAW_MASK __PERF_COUNTER_MASK(RAW) | ||
92 | |||
93 | #define PERF_COUNTER_CONFIG_BITS 63 | ||
94 | #define PERF_COUNTER_CONFIG_SHIFT 0 | ||
95 | #define PERF_COUNTER_CONFIG_MASK __PERF_COUNTER_MASK(CONFIG) | ||
96 | |||
97 | #define PERF_COUNTER_TYPE_BITS 7 | ||
98 | #define PERF_COUNTER_TYPE_SHIFT 56 | ||
99 | #define PERF_COUNTER_TYPE_MASK __PERF_COUNTER_MASK(TYPE) | ||
100 | |||
101 | #define PERF_COUNTER_EVENT_BITS 56 | ||
102 | #define PERF_COUNTER_EVENT_SHIFT 0 | ||
103 | #define PERF_COUNTER_EVENT_MASK __PERF_COUNTER_MASK(EVENT) | ||
104 | |||
85 | /* | 105 | /* |
86 | * Hardware event to monitor via a performance monitoring counter: | 106 | * Hardware event to monitor via a performance monitoring counter: |
87 | */ | 107 | */ |
88 | struct perf_counter_hw_event { | 108 | struct perf_counter_hw_event { |
89 | union { | 109 | /* |
90 | #ifndef __BIG_ENDIAN_BITFIELD | 110 | * The MSB of the config word signifies if the rest contains cpu |
91 | struct { | 111 | * specific (raw) counter configuration data, if unset, the next |
92 | __u64 event_id : 56, | 112 | * 7 bits are an event type and the rest of the bits are the event |
93 | type : 8; | 113 | * identifier. |
94 | }; | 114 | */ |
95 | struct { | 115 | __u64 config; |
96 | __u64 raw_event_id : 63, | ||
97 | raw_type : 1; | ||
98 | }; | ||
99 | #else | ||
100 | struct { | ||
101 | __u64 type : 8, | ||
102 | event_id : 56; | ||
103 | }; | ||
104 | struct { | ||
105 | __u64 raw_type : 1, | ||
106 | raw_event_id : 63; | ||
107 | }; | ||
108 | #endif /* __BIT_ENDIAN_BITFIELD */ | ||
109 | __u64 event_config; | ||
110 | }; | ||
111 | 116 | ||
112 | __u64 irq_period; | 117 | __u64 irq_period; |
113 | __u64 record_type; | 118 | __u64 record_type; |
@@ -157,6 +162,27 @@ struct perf_counter_hw_event { | |||
157 | 162 | ||
158 | struct task_struct; | 163 | struct task_struct; |
159 | 164 | ||
165 | static inline u64 perf_event_raw(struct perf_counter_hw_event *hw_event) | ||
166 | { | ||
167 | return hw_event->config & PERF_COUNTER_RAW_MASK; | ||
168 | } | ||
169 | |||
170 | static inline u64 perf_event_config(struct perf_counter_hw_event *hw_event) | ||
171 | { | ||
172 | return hw_event->config & PERF_COUNTER_CONFIG_MASK; | ||
173 | } | ||
174 | |||
175 | static inline u64 perf_event_type(struct perf_counter_hw_event *hw_event) | ||
176 | { | ||
177 | return (hw_event->config & PERF_COUNTER_TYPE_MASK) >> | ||
178 | PERF_COUNTER_TYPE_SHIFT; | ||
179 | } | ||
180 | |||
181 | static inline u64 perf_event_id(struct perf_counter_hw_event *hw_event) | ||
182 | { | ||
183 | return hw_event->config & PERF_COUNTER_EVENT_MASK; | ||
184 | } | ||
185 | |||
160 | /** | 186 | /** |
161 | * struct hw_perf_counter - performance counter hardware details: | 187 | * struct hw_perf_counter - performance counter hardware details: |
162 | */ | 188 | */ |
@@ -336,8 +362,8 @@ extern void perf_counter_output(struct perf_counter *counter, | |||
336 | */ | 362 | */ |
337 | static inline int is_software_counter(struct perf_counter *counter) | 363 | static inline int is_software_counter(struct perf_counter *counter) |
338 | { | 364 | { |
339 | return !counter->hw_event.raw_type && | 365 | return !perf_event_raw(&counter->hw_event) && |
340 | counter->hw_event.type != PERF_TYPE_HARDWARE; | 366 | perf_event_type(&counter->hw_event) != PERF_TYPE_HARDWARE; |
341 | } | 367 | } |
342 | 368 | ||
343 | extern void perf_swcounter_event(u32, u64, int, struct pt_regs *); | 369 | extern void perf_swcounter_event(u32, u64, int, struct pt_regs *); |