Commit 115d2d8963a426670ac3ce983fc4c4e001703943
1 parent
744bd8aa3c
Exists in
master
and in
39 other branches
perf record: Move perf_mmap__write_tail to perf.h
Close to perf_mmap__read_head() and the perf_mmap struct definition. This is useful for any recorder, and we will need it in 'perf test'. Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Mike Galbraith <efault@gmx.de> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stephane Eranian <eranian@google.com> Cc: Tom Zanussi <tzanussi@gmail.com> LKML-Reference: <new-submission> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Showing 2 changed files with 13 additions and 12 deletions Side-by-side Diff
tools/perf/builtin-record.c
... | ... | @@ -80,17 +80,6 @@ |
80 | 80 | |
81 | 81 | static struct perf_mmap mmap_array[MAX_NR_CPUS]; |
82 | 82 | |
83 | -static void mmap_write_tail(struct perf_mmap *md, unsigned long tail) | |
84 | -{ | |
85 | - struct perf_event_mmap_page *pc = md->base; | |
86 | - | |
87 | - /* | |
88 | - * ensure all reads are done before we write the tail out. | |
89 | - */ | |
90 | - /* mb(); */ | |
91 | - pc->data_tail = tail; | |
92 | -} | |
93 | - | |
94 | 83 | static void advance_output(size_t size) |
95 | 84 | { |
96 | 85 | bytes_written += size; |
... | ... | @@ -165,7 +154,7 @@ |
165 | 154 | write_output(buf, size); |
166 | 155 | |
167 | 156 | md->prev = old; |
168 | - mmap_write_tail(md, old); | |
157 | + perf_mmap__write_tail(md, old); | |
169 | 158 | } |
170 | 159 | |
171 | 160 | static volatile int done = 0; |
tools/perf/perf.h
... | ... | @@ -108,6 +108,18 @@ |
108 | 108 | return head; |
109 | 109 | } |
110 | 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 | + | |
111 | 123 | /* |
112 | 124 | * prctl(PR_TASK_PERF_EVENTS_DISABLE) will (cheaply) disable all |
113 | 125 | * counters in the current task. |