Show expressions in errortrace profiles, instead of just symbols.

Since profile nodes report the time spent in, e.g., an entire call
expression (including argument evaluation), and not just in the body of
the operator, showing only the operator in the profile is misleading.
This commit is contained in:
Vincent St-Amour 2013-11-07 15:49:03 -05:00
parent d1abf632b1
commit 22def35d68

View File

@ -8,12 +8,13 @@
(require errortrace/errortrace-key)
;; (cons sexp srcloc) -> (cons symbol srcloc)
;; just take the first symbol we find
;; (cons sexp srcloc) -> (cons sexp srcloc)
;; abbreviate the expression for concise reports
;; we take the first symbol we can find, and wrap it in a stub expression
(define (errortrace-preprocess frame)
(cons (and (car frame)
(let loop ([e (car frame)])
(cond [(symbol? e) e]
(cond [(symbol? e) (list e '...)]
[(pair? e) (loop (car e))]
[else (error 'errortrace-preprocess
"unexpected frame: ~a" frame)])))