Add 'depth' argument to CTRSTACK() macro, which allows to reduce number
of ktr slots used. If 'depth' is equal to 0, the whole stack will be logged, just like before.
This commit is contained in:
parent
80447bf701
commit
e37a499443
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=149574
@ -168,7 +168,7 @@ lockmgr(lkp, flags, interlkp, td)
|
||||
{
|
||||
struct stack stack; /* XXX */
|
||||
stack_save(&stack);
|
||||
CTRSTACK(KTR_LOCK, &stack, 1);
|
||||
CTRSTACK(KTR_LOCK, &stack, 0, 1);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -115,7 +115,8 @@ stack_sbuf_print(struct sbuf *sb, struct stack *st)
|
||||
|
||||
#ifdef KTR
|
||||
void
|
||||
stack_ktr(u_int mask, const char *file, int line, struct stack *st, int cheap)
|
||||
stack_ktr(u_int mask, const char *file, int line, struct stack *st, u_int depth,
|
||||
int cheap)
|
||||
{
|
||||
const char *name;
|
||||
long offset;
|
||||
@ -136,12 +137,15 @@ stack_ktr(u_int mask, const char *file, int line, struct stack *st, int cheap)
|
||||
ktr_tracepoint(mask, file, line, "#2 %p %p %p %p %p %p",
|
||||
st->pcs[12], st->pcs[13], st->pcs[14], st->pcs[15],
|
||||
st->pcs[16], st->pcs[17]);
|
||||
} else
|
||||
for (i = 0; i < st->depth; i++) {
|
||||
} else {
|
||||
if (depth == 0 || st->depth < depth)
|
||||
depth = st->depth;
|
||||
for (i = 0; i < depth; i++) {
|
||||
stack_symbol(st->pcs[i], &name, &offset);
|
||||
ktr_tracepoint(mask, file, line, "#%d %p at %s+%#lx",
|
||||
i, st->pcs[i], (u_long)name, offset, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -47,13 +47,13 @@ void stack_zero(struct stack *);
|
||||
void stack_print(struct stack *);
|
||||
void stack_sbuf_print(struct sbuf *, struct stack *);
|
||||
#ifdef KTR
|
||||
void stack_ktr(u_int, const char *, int, struct stack *, int);
|
||||
#define CTRSTACK(m, st, cheap) do { \
|
||||
void stack_ktr(u_int, const char *, int, struct stack *, u_int, int);
|
||||
#define CTRSTACK(m, st, depth, cheap) do { \
|
||||
if (KTR_COMPILE & (m)) \
|
||||
stack_ktr((m), __FILE__, __LINE__, st, cheap); \
|
||||
stack_ktr((m), __FILE__, __LINE__, st, depth, cheap); \
|
||||
} while(0)
|
||||
#else
|
||||
#define CTRSTACK(m, st, cheap)
|
||||
#define CTRSTACK(m, st, depth, cheap)
|
||||
#endif
|
||||
|
||||
/* MD Routine. */
|
||||
|
Loading…
Reference in New Issue
Block a user