lkml.org 
[lkml]   [2009]   [Apr]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH 5/6] perf_counter: add more context information
Put in counts to tell which ips belong to what context.

-----
| | hv
| --
nr | | kernel
| --
| | user
-----
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
---
arch/x86/kernel/cpu/perf_counter.c | 9 +++++++++
include/linux/perf_counter.h | 4 ++--
kernel/perf_counter.c | 2 +-
3 files changed, 12 insertions(+), 3 deletions(-)
Index: linux-2.6/arch/x86/kernel/cpu/perf_counter.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/cpu/perf_counter.c
+++ linux-2.6/arch/x86/kernel/cpu/perf_counter.c
@@ -1088,6 +1088,7 @@ perf_callchain_kernel(struct pt_regs *re
{
unsigned long bp;
char *stack;
+ int nr = entry->nr;

callchain_store(entry, instruction_pointer(regs));

@@ -1099,6 +1100,8 @@ perf_callchain_kernel(struct pt_regs *re
#endif

dump_trace(NULL, regs, (void *)stack, bp, &backtrace_ops, entry);
+
+ entry->kernel = entry->nr - nr;
}


@@ -1128,6 +1131,7 @@ perf_callchain_user(struct pt_regs *regs
{
struct stack_frame frame;
const void __user *fp;
+ int nr = entry->nr;

regs = (struct pt_regs *)current->thread.sp0 - 1;
fp = (void __user *)regs->bp;
@@ -1147,6 +1151,8 @@ perf_callchain_user(struct pt_regs *regs
callchain_store(entry, frame.return_address);
fp = frame.next_fp;
}
+
+ entry->user = entry->nr - nr;
}

static void
@@ -1182,6 +1188,9 @@ struct perf_callchain_entry *perf_callch
entry = &__get_cpu_var(irq_entry);

entry->nr = 0;
+ entry->hv = 0;
+ entry->kernel = 0;
+ entry->user = 0;

perf_do_callchain(regs, entry);

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
@@ -520,10 +520,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 255
+#define MAX_STACK_DEPTH 254

struct perf_callchain_entry {
- u64 nr;
+ u32 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
@@ -1830,7 +1830,7 @@ void perf_counter_output(struct perf_cou
callchain = perf_callchain(regs);

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

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



\
 
 \ /
  Last update: 2009-04-02 11:15    [from the cache]
©2003-2014 Jasper Spaans. Advertise on this site