aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorFrederic Weisbecker <fweisbec@gmail.com>2009-08-10 10:11:32 -0400
committerIngo Molnar <mingo@elte.hu>2009-08-10 10:18:50 -0400
commit304703aba31a87903b8c0db8f5e6890cac2d596d (patch)
treebd233c6fd72d1d674c4a9537cfd6519069914d74 /include
parenta4e95fc2cbb31d70a65beffeaf8773f881328c34 (diff)
perf_counter: Subtract the buffer size field from the event record size
We compute the perf raw sample size by aligning the raw ftrace event size plus the buffer size field itself. We do that instead of aligning only the perf raw sample size, so that we might economize some in some cases. But this buffer size field is not stored in the perf raw sample, we must then substract its size from the buffer once we computed the alignment unless we may get a useless u32 field in the buffer. Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com> Acked-by: Peter Zijlstra <peterz@infradead.org> Cc: Arnaldo Carvalho de Melo <acme@redhat.com> Cc: Mike Galbraith <efault@gmx.de> Cc: Paul Mackerras <paulus@samba.org> LKML-Reference: <20090810141129.GA5124@nowhere> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'include')
-rw-r--r--include/trace/ftrace.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/include/trace/ftrace.h b/include/trace/ftrace.h
index 7167b9b97da2..a05524fa245d 100644
--- a/include/trace/ftrace.h
+++ b/include/trace/ftrace.h
@@ -637,7 +637,12 @@ __attribute__((section("_ftrace_events"))) event_##call = { \
637 * pc = preempt_count(); 637 * pc = preempt_count();
638 * 638 *
639 * __data_size = ftrace_get_offsets_<call>(&__data_offsets, args); 639 * __data_size = ftrace_get_offsets_<call>(&__data_offsets, args);
640 * __entry_size = __data_size + sizeof(*entry); 640 *
641 * // Below we want to get the aligned size by taking into account
642 * // the u32 field that will later store the buffer size
643 * __entry_size = ALIGN(__data_size + sizeof(*entry) + sizeof(u32),
644 * sizeof(u64));
645 * __entry_size -= sizeof(u32);
641 * 646 *
642 * do { 647 * do {
643 * char raw_data[__entry_size]; <- allocate our sample in the stack 648 * char raw_data[__entry_size]; <- allocate our sample in the stack
@@ -687,6 +692,7 @@ static void ftrace_profile_##call(proto) \
687 __data_size = ftrace_get_offsets_##call(&__data_offsets, args); \ 692 __data_size = ftrace_get_offsets_##call(&__data_offsets, args); \
688 __entry_size = ALIGN(__data_size + sizeof(*entry) + sizeof(u32),\ 693 __entry_size = ALIGN(__data_size + sizeof(*entry) + sizeof(u32),\
689 sizeof(u64)); \ 694 sizeof(u64)); \
695 __entry_size -= sizeof(u32); \
690 \ 696 \
691 do { \ 697 do { \
692 char raw_data[__entry_size]; \ 698 char raw_data[__entry_size]; \