Have nicer information to present in pop-ups.
This commit is contained in:
parent
28f51f7376
commit
a134e4ffb7
|
@ -16,7 +16,7 @@
|
||||||
(format "~a:~a" line col)
|
(format "~a:~a" line col)
|
||||||
"(no location)")))
|
"(no location)")))
|
||||||
|
|
||||||
(struct log-entry (msg stx pos) #:prefab)
|
(struct log-entry (msg raw-msg stx pos) #:prefab)
|
||||||
|
|
||||||
;; to identify log messages that come from the optimizer
|
;; to identify log messages that come from the optimizer
|
||||||
;; to be stored in the data section of log messages
|
;; to be stored in the data section of log messages
|
||||||
|
@ -45,7 +45,7 @@
|
||||||
#:from [from "TR opt"]
|
#:from [from "TR opt"]
|
||||||
#:show-badness? [show-badness? #f])
|
#:show-badness? [show-badness? #f])
|
||||||
(let* ([new-message (gen-log-message msg stx from show-badness?)]
|
(let* ([new-message (gen-log-message msg stx from show-badness?)]
|
||||||
[new-entry (log-entry new-message stx (syntax-position stx))])
|
[new-entry (log-entry new-message msg stx (syntax-position stx))])
|
||||||
(set! log-so-far (cons new-entry log-so-far))))
|
(set! log-so-far (cons new-entry log-so-far))))
|
||||||
|
|
||||||
;; once the optimizer is done, we sort the log according to source
|
;; once the optimizer is done, we sort the log according to source
|
||||||
|
@ -66,8 +66,8 @@
|
||||||
(cons optimization-log-key x)))
|
(cons optimization-log-key x)))
|
||||||
(sort (remove-duplicates log-so-far)
|
(sort (remove-duplicates log-so-far)
|
||||||
(match-lambda*
|
(match-lambda*
|
||||||
[(list (log-entry msg-x stx-x pos-x)
|
[(list (log-entry msg-x raw-x stx-x pos-x)
|
||||||
(log-entry msg-y stx-y pos-y))
|
(log-entry msg-y raw-y stx-y pos-y))
|
||||||
(cond [(not (or pos-x pos-y))
|
(cond [(not (or pos-x pos-y))
|
||||||
;; neither have location, sort by message
|
;; neither have location, sort by message
|
||||||
(string<? msg-x msg-y)]
|
(string<? msg-x msg-y)]
|
||||||
|
|
|
@ -46,25 +46,17 @@
|
||||||
;; highlight
|
;; highlight
|
||||||
(define new-highlights
|
(define new-highlights
|
||||||
(for/list ([l (in-list log)])
|
(for/list ([l (in-list log)])
|
||||||
(let* ([stx (log-entry-stx l)]
|
(match l
|
||||||
[pos (sub1 (log-entry-pos l))]
|
[(log-entry msg raw-msg stx (app sub1 pos))
|
||||||
[end (+ pos (syntax-span stx))]
|
(let* ([end (+ pos (syntax-span stx))]
|
||||||
[msg (log-entry-msg l)]
|
[opt? (regexp-match #rx"^TR opt:" msg)] ;; opt or missed opt?
|
||||||
;; opt or missed opt?
|
|
||||||
[opt? (regexp-match #rx"^TR opt:" msg)]
|
|
||||||
[color (if opt? "lightgreen" "pink")])
|
[color (if opt? "lightgreen" "pink")])
|
||||||
(send defs highlight-range pos end color)
|
(send defs highlight-range pos end color)
|
||||||
(send defs set-clickback pos end
|
(send defs set-clickback pos end
|
||||||
(lambda (ed start end)
|
(lambda (ed start end)
|
||||||
(message-box "Performance Report" msg)))
|
(message-box "Performance Report" raw-msg)))
|
||||||
(list pos end color)))) ; record the highlight, to undo it later
|
(list pos end color))]))) ; record the highlight, to undo it later
|
||||||
(set! highlights (append new-highlights highlights))
|
(set! highlights (append new-highlights highlights)))
|
||||||
(message-box
|
|
||||||
"Performance Report"
|
|
||||||
(with-output-to-string
|
|
||||||
(lambda ()
|
|
||||||
(for ([l (in-list log)])
|
|
||||||
(displayln (log-entry-msg l)))))))
|
|
||||||
|
|
||||||
(define remove-highlights-mixin
|
(define remove-highlights-mixin
|
||||||
(mixin ((class->interface text%)) ()
|
(mixin ((class->interface text%)) ()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user