Skip to content

Commit

Permalink
sb-sprof: Do not record implausibly short traces
Browse files Browse the repository at this point in the history
It occasionally happens that SIGPROF-HANDLER runs in a situation in
which it cannot walk the stack beyond the initial frame.

Recording such degenerate traces would disrupt certain report kinds
such as flamegraphs. In addition, this seems to happen rarely enough
that just dropping the traces shouldn't really affect statistics-based
reports.
  • Loading branch information
scymtym committed Mar 31, 2018
1 parent 69c9a09 commit 1af9441
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions contrib/sb-sprof/record.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,14 @@ EXPERIMENTAL: Interface subject to change."
(setf (values ok pc-ptr fp)
(sb-di::x86-call-context fp))
(unless ok
;; If we fail to walk the stack beyond the
;; initial frame, there is likely something
;; wrong. Undo the trace start marker and the
;; one sample we already recorded.
(when (zerop i)
(decf (samples-index samples)
(+ +elements-per-trace-start+
(* +elements-per-sample+ (1+ i)))))
(return))))))
;; Reset thread-local allocation counter before interrupts
;; are enabled.
Expand Down

0 comments on commit 1af9441

Please sign in to comment.