diff options
Diffstat (limited to 'tools/perf/perf.h')
-rw-r--r-- | tools/perf/perf.h | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/tools/perf/perf.h b/tools/perf/perf.h index 95aaf565c704..a5fc660c1f12 100644 --- a/tools/perf/perf.h +++ b/tools/perf/perf.h | |||
@@ -94,6 +94,32 @@ void get_term_dimensions(struct winsize *ws); | |||
94 | #include "util/types.h" | 94 | #include "util/types.h" |
95 | #include <stdbool.h> | 95 | #include <stdbool.h> |
96 | 96 | ||
97 | struct perf_mmap { | ||
98 | void *base; | ||
99 | int mask; | ||
100 | unsigned int prev; | ||
101 | }; | ||
102 | |||
103 | static inline unsigned int perf_mmap__read_head(struct perf_mmap *mm) | ||
104 | { | ||
105 | struct perf_event_mmap_page *pc = mm->base; | ||
106 | int head = pc->data_head; | ||
107 | rmb(); | ||
108 | return head; | ||
109 | } | ||
110 | |||
111 | static inline void perf_mmap__write_tail(struct perf_mmap *md, | ||
112 | unsigned long tail) | ||
113 | { | ||
114 | struct perf_event_mmap_page *pc = md->base; | ||
115 | |||
116 | /* | ||
117 | * ensure all reads are done before we write the tail out. | ||
118 | */ | ||
119 | /* mb(); */ | ||
120 | pc->data_tail = tail; | ||
121 | } | ||
122 | |||
97 | /* | 123 | /* |
98 | * prctl(PR_TASK_PERF_EVENTS_DISABLE) will (cheaply) disable all | 124 | * prctl(PR_TASK_PERF_EVENTS_DISABLE) will (cheaply) disable all |
99 | * counters in the current task. | 125 | * counters in the current task. |