diff options
author | Jiri Olsa <jolsa@redhat.com> | 2012-08-07 09:20:39 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2012-08-10 11:16:22 -0400 |
commit | 5685e0ff45f5df67e79e9b052b6ffd501ff38c11 (patch) | |
tree | ead6bd92a49b42ec0ca5bfee467e03e37656a6f1 /kernel/events | |
parent | 91d7753a45f8525dc75b6be01e427dc1c378dc16 (diff) |
perf: Add perf_output_skip function to skip bytes in sample
Introducing perf_output_skip function to be able to skip data within the
perf ring buffer.
When writing data into perf ring buffer we first reserve needed place in
ring buffer and then copy the actual data.
There's a possibility we won't be able to fill all the reserved size
with data, so we need a way to skip the remaining bytes.
This is going to be useful when storing the user stack dump, where we
might end up with less data than we originally requested.
Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Acked-by: Frederic Weisbecker <fweisbec@gmail.com>
Cc: "Frank Ch. Eigler" <fche@redhat.com>
Cc: Arun Sharma <asharma@fb.com>
Cc: Benjamin Redelings <benjamin.redelings@nescent.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Cyrill Gorcunov <gorcunov@openvz.org>
Cc: Frank Ch. Eigler <fche@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Robert Richter <robert.richter@amd.com>
Cc: Stephane Eranian <eranian@google.com>
Cc: Tom Zanussi <tzanussi@gmail.com>
Cc: Ulrich Drepper <drepper@gmail.com>
Link: http://lkml.kernel.org/r/1344345647-11536-5-git-send-email-jolsa@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'kernel/events')
-rw-r--r-- | kernel/events/internal.h | 4 | ||||
-rw-r--r-- | kernel/events/ring_buffer.c | 6 |
2 files changed, 10 insertions, 0 deletions
diff --git a/kernel/events/internal.h b/kernel/events/internal.h index 7fd5408493d2..ce7bdfc1d045 100644 --- a/kernel/events/internal.h +++ b/kernel/events/internal.h | |||
@@ -114,6 +114,10 @@ static inline int memcpy_common(void *dst, const void *src, size_t n) | |||
114 | 114 | ||
115 | DEFINE_OUTPUT_COPY(__output_copy, memcpy_common) | 115 | DEFINE_OUTPUT_COPY(__output_copy, memcpy_common) |
116 | 116 | ||
117 | #define MEMCPY_SKIP(dst, src, n) (n) | ||
118 | |||
119 | DEFINE_OUTPUT_COPY(__output_skip, MEMCPY_SKIP) | ||
120 | |||
117 | #ifndef arch_perf_out_copy_user | 121 | #ifndef arch_perf_out_copy_user |
118 | #define arch_perf_out_copy_user __copy_from_user_inatomic | 122 | #define arch_perf_out_copy_user __copy_from_user_inatomic |
119 | #endif | 123 | #endif |
diff --git a/kernel/events/ring_buffer.c b/kernel/events/ring_buffer.c index b4c2ad3dee7a..23cb34ff3973 100644 --- a/kernel/events/ring_buffer.c +++ b/kernel/events/ring_buffer.c | |||
@@ -188,6 +188,12 @@ unsigned int perf_output_copy(struct perf_output_handle *handle, | |||
188 | return __output_copy(handle, buf, len); | 188 | return __output_copy(handle, buf, len); |
189 | } | 189 | } |
190 | 190 | ||
191 | unsigned int perf_output_skip(struct perf_output_handle *handle, | ||
192 | unsigned int len) | ||
193 | { | ||
194 | return __output_skip(handle, NULL, len); | ||
195 | } | ||
196 | |||
191 | void perf_output_end(struct perf_output_handle *handle) | 197 | void perf_output_end(struct perf_output_handle *handle) |
192 | { | 198 | { |
193 | perf_output_put_handle(handle); | 199 | perf_output_put_handle(handle); |