提交 5872bdb8 编写于 作者: P Peter Zijlstra 提交者: Ingo Molnar

perf_counter: add more context information

Put in counts to tell which ips belong to what context.

  -----
   | |  hv
   | --
nr | |  kernel
   | --
   | |  user
  -----
Signed-off-by: NPeter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Orig-LKML-Reference: <20090402091319.493101305@chello.nl>
Signed-off-by: NIngo Molnar <mingo@elte.hu>
上级 3df70fd6
...@@ -1088,6 +1088,7 @@ perf_callchain_kernel(struct pt_regs *regs, struct perf_callchain_entry *entry) ...@@ -1088,6 +1088,7 @@ perf_callchain_kernel(struct pt_regs *regs, struct perf_callchain_entry *entry)
{ {
unsigned long bp; unsigned long bp;
char *stack; char *stack;
int nr = entry->nr;
callchain_store(entry, instruction_pointer(regs)); callchain_store(entry, instruction_pointer(regs));
...@@ -1099,6 +1100,8 @@ perf_callchain_kernel(struct pt_regs *regs, struct perf_callchain_entry *entry) ...@@ -1099,6 +1100,8 @@ perf_callchain_kernel(struct pt_regs *regs, struct perf_callchain_entry *entry)
#endif #endif
dump_trace(NULL, regs, (void *)stack, bp, &backtrace_ops, entry); 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 perf_callchain_entry *entry) ...@@ -1128,6 +1131,7 @@ perf_callchain_user(struct pt_regs *regs, struct perf_callchain_entry *entry)
{ {
struct stack_frame frame; struct stack_frame frame;
const void __user *fp; const void __user *fp;
int nr = entry->nr;
regs = (struct pt_regs *)current->thread.sp0 - 1; regs = (struct pt_regs *)current->thread.sp0 - 1;
fp = (void __user *)regs->bp; fp = (void __user *)regs->bp;
...@@ -1147,6 +1151,8 @@ perf_callchain_user(struct pt_regs *regs, struct perf_callchain_entry *entry) ...@@ -1147,6 +1151,8 @@ perf_callchain_user(struct pt_regs *regs, struct perf_callchain_entry *entry)
callchain_store(entry, frame.return_address); callchain_store(entry, frame.return_address);
fp = frame.next_fp; fp = frame.next_fp;
} }
entry->user = entry->nr - nr;
} }
static void static void
...@@ -1182,6 +1188,9 @@ struct perf_callchain_entry *perf_callchain(struct pt_regs *regs) ...@@ -1182,6 +1188,9 @@ struct perf_callchain_entry *perf_callchain(struct pt_regs *regs)
entry = &__get_cpu_var(irq_entry); entry = &__get_cpu_var(irq_entry);
entry->nr = 0; entry->nr = 0;
entry->hv = 0;
entry->kernel = 0;
entry->user = 0;
perf_do_callchain(regs, entry); perf_do_callchain(regs, entry);
......
...@@ -513,10 +513,10 @@ extern void perf_counter_mmap(unsigned long addr, unsigned long len, ...@@ -513,10 +513,10 @@ extern void perf_counter_mmap(unsigned long addr, unsigned long len,
extern void perf_counter_munmap(unsigned long addr, unsigned long len, extern void perf_counter_munmap(unsigned long addr, unsigned long len,
unsigned long pgoff, struct file *file); unsigned long pgoff, struct file *file);
#define MAX_STACK_DEPTH 255 #define MAX_STACK_DEPTH 254
struct perf_callchain_entry { struct perf_callchain_entry {
u64 nr; u32 nr, hv, kernel, user;
u64 ip[MAX_STACK_DEPTH]; u64 ip[MAX_STACK_DEPTH];
}; };
......
...@@ -1819,7 +1819,7 @@ void perf_counter_output(struct perf_counter *counter, ...@@ -1819,7 +1819,7 @@ void perf_counter_output(struct perf_counter *counter,
callchain = perf_callchain(regs); callchain = perf_callchain(regs);
if (callchain) { if (callchain) {
callchain_size = (1 + callchain->nr) * sizeof(u64); callchain_size = (2 + callchain->nr) * sizeof(u64);
header.type |= __PERF_EVENT_CALLCHAIN; header.type |= __PERF_EVENT_CALLCHAIN;
header.size += callchain_size; header.size += callchain_size;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册