[PATCH 02/15] perf_counter: add more context information

From: Peter Zijlstra
Date: Mon Apr 06 2009 - 05:46:21 EST


Change the callchain context entries to u16, so as to gain some space.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@xxxxxxxxx>
---
include/linux/perf_counter.h | 4 ++--
kernel/perf_counter.c | 6 ++----
2 files changed, 4 insertions(+), 6 deletions(-)

Index: linux-2.6/include/linux/perf_counter.h
===================================================================
--- linux-2.6.orig/include/linux/perf_counter.h
+++ linux-2.6/include/linux/perf_counter.h
@@ -507,10 +507,10 @@ extern void perf_counter_mmap(unsigned l
extern void perf_counter_munmap(unsigned long addr, unsigned long len,
unsigned long pgoff, struct file *file);

-#define MAX_STACK_DEPTH 254
+#define MAX_STACK_DEPTH 255

struct perf_callchain_entry {
- u32 nr, hv, kernel, user;
+ u16 nr, hv, kernel, user;
u64 ip[MAX_STACK_DEPTH];
};

Index: linux-2.6/kernel/perf_counter.c
===================================================================
--- linux-2.6.orig/kernel/perf_counter.c
+++ linux-2.6/kernel/perf_counter.c
@@ -1657,9 +1657,7 @@ void perf_counter_do_pending(void)
* Callchain support -- arch specific
*/

-struct perf_callchain_entry *
-__attribute__((weak))
-perf_callchain(struct pt_regs *regs)
+__weak struct perf_callchain_entry *perf_callchain(struct pt_regs *regs)
{
return NULL;
}
@@ -1819,7 +1817,7 @@ void perf_counter_output(struct perf_cou
callchain = perf_callchain(regs);

if (callchain) {
- callchain_size = (2 + callchain->nr) * sizeof(u64);
+ callchain_size = (1 + callchain->nr) * sizeof(u64);

header.type |= __PERF_EVENT_CALLCHAIN;
header.size += callchain_size;

--

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/