perf record: Move perf_mmap__write_tail to perf.h
authorArnaldo Carvalho de Melo <acme@redhat.com>
Wed, 12 Jan 2011 19:11:53 +0000 (17:11 -0200)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Sat, 22 Jan 2011 21:56:29 +0000 (19:56 -0200)
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>
tools/perf/builtin-record.c
tools/perf/perf.h

index d89e2f106a622c8469d535bc025fc70b8aad4801..109f3b269ac5db4d605fff79fb0fb049f8007023 100644 (file)
@@ -80,17 +80,6 @@ static const char            *cpu_list;
 
 static struct perf_mmap                mmap_array[MAX_NR_CPUS];
 
-static void mmap_write_tail(struct perf_mmap *md, unsigned long tail)
-{
-       struct perf_event_mmap_page *pc = md->base;
-
-       /*
-        * ensure all reads are done before we write the tail out.
-        */
-       /* mb(); */
-       pc->data_tail = tail;
-}
-
 static void advance_output(size_t size)
 {
        bytes_written += size;
@@ -165,7 +154,7 @@ static void mmap_read(struct perf_mmap *md)
        write_output(buf, size);
 
        md->prev = old;
-       mmap_write_tail(md, old);
+       perf_mmap__write_tail(md, old);
 }
 
 static volatile int done = 0;
index 5fb5e1f11d1cc96d706dd348664623edcb102538..a5fc660c1f1286512b299342ad3841509a080194 100644 (file)
@@ -108,6 +108,18 @@ static inline unsigned int perf_mmap__read_head(struct perf_mmap *mm)
        return head;
 }
 
+static inline void perf_mmap__write_tail(struct perf_mmap *md,
+                                        unsigned long tail)
+{
+       struct perf_event_mmap_page *pc = md->base;
+
+       /*
+        * ensure all reads are done before we write the tail out.
+        */
+       /* mb(); */
+       pc->data_tail = tail;
+}
+
 /*
  * prctl(PR_TASK_PERF_EVENTS_DISABLE) will (cheaply) disable all
  * counters in the current task.