Record a backtrace in the sampler

上级 7d71762b
......@@ -6,8 +6,11 @@ struct sampconf {
u64 period;
};
#define NTRACE 4
struct pmuevent {
u64 rip;
uptr trace[NTRACE];
};
struct logheader {
......
......@@ -95,12 +95,16 @@ static int
samplog(struct trapframe *tf)
{
struct pmulog *l;
struct pmuevent *e;
l = &pmulog[mycpu()->id];
if (l->count == l->capacity)
return 0;
l->event[l->count].rip = tf->rip;
e = &l->event[l->count];
e->rip = tf->rip;
getcallerpcs((void*)tf->rbp, e->trace, NELEM(e->trace));
l->count++;
return 1;
}
......
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论