aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2011-01-12 14:07:28 -0500
committerArnaldo Carvalho de Melo <acme@redhat.com>2011-01-22 16:56:29 -0500
commit744bd8aa3c8b43447f689a27872fa95e700b8a4f (patch)
treee43370a72b1faca5ca90e9049d95b833f895ad4a /tools
parent70082dd92c4b288bd723a77897e2b555f0e63113 (diff)
perf record: Use struct perf_mmap and helpers
Paving the way to using perf_evsel->mmap, do this to reduce the patch noise in the next ones. 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>
Diffstat (limited to 'tools')
-rw-r--r--tools/perf/builtin-record.c25
1 files changed, 4 insertions, 21 deletions
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index ec43f2eb7b72..d89e2f106a62 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -78,26 +78,9 @@ static off_t post_processing_offset;
78static struct perf_session *session; 78static struct perf_session *session;
79static const char *cpu_list; 79static const char *cpu_list;
80 80
81struct mmap_data { 81static struct perf_mmap mmap_array[MAX_NR_CPUS];
82 void *base;
83 unsigned int mask;
84 unsigned int prev;
85};
86
87static struct mmap_data mmap_array[MAX_NR_CPUS];
88
89static unsigned long mmap_read_head(struct mmap_data *md)
90{
91 struct perf_event_mmap_page *pc = md->base;
92 long head;
93
94 head = pc->data_head;
95 rmb();
96
97 return head;
98}
99 82
100static void mmap_write_tail(struct mmap_data *md, unsigned long tail) 83static void mmap_write_tail(struct perf_mmap *md, unsigned long tail)
101{ 84{
102 struct perf_event_mmap_page *pc = md->base; 85 struct perf_event_mmap_page *pc = md->base;
103 86
@@ -136,9 +119,9 @@ static int process_synthesized_event(event_t *event,
136 return 0; 119 return 0;
137} 120}
138 121
139static void mmap_read(struct mmap_data *md) 122static void mmap_read(struct perf_mmap *md)
140{ 123{
141 unsigned int head = mmap_read_head(md); 124 unsigned int head = perf_mmap__read_head(md);
142 unsigned int old = md->prev; 125 unsigned int old = md->prev;
143 unsigned char *data = md->base + page_size; 126 unsigned char *data = md->base + page_size;
144 unsigned long size; 127 unsigned long size;