Report optimizations and missed optimizations with the DrRacket tool.
Currently, that just means showing the text that would be shown on the command line. Eventually, it should highlight code in the editor, and have tooltips explaining what happened.
This commit is contained in:
parent
a71a45e41f
commit
27f3eb3870
|
@ -1,8 +1,11 @@
|
||||||
#lang racket/base
|
#lang racket/base
|
||||||
|
|
||||||
(require racket/unit racket/class
|
(require racket/unit racket/class racket/port
|
||||||
racket/gui/base mrlib/switchable-button)
|
racket/gui/base mrlib/switchable-button)
|
||||||
|
|
||||||
|
(require (prefix-in tr: typed-scheme/typed-reader)
|
||||||
|
typed-scheme/optimizer/logging)
|
||||||
|
|
||||||
(provide performance-report-drracket-button)
|
(provide performance-report-drracket-button)
|
||||||
|
|
||||||
;; DrRacket tool for reporting missed optimizations in the editor.
|
;; DrRacket tool for reporting missed optimizations in the editor.
|
||||||
|
@ -20,10 +23,25 @@
|
||||||
(send bdc set-bitmap #f)
|
(send bdc set-bitmap #f)
|
||||||
bmp))
|
bmp))
|
||||||
|
|
||||||
|
;; performance-report-callback : drracket:unit:frame<%> -> void
|
||||||
|
(define (performance-report-callback drr-frame)
|
||||||
|
(define defs (send drr-frame get-definitions-text)) ; : text%
|
||||||
|
(define portname (send defs get-filename))
|
||||||
|
(message-box
|
||||||
|
"Performance Report"
|
||||||
|
(with-output-to-string
|
||||||
|
(lambda ()
|
||||||
|
(with-tr-logging-to-port
|
||||||
|
(current-output-port)
|
||||||
|
(lambda ()
|
||||||
|
(parameterize ([current-namespace (make-base-namespace)]
|
||||||
|
[read-accept-reader #t])
|
||||||
|
(expand
|
||||||
|
(tr:read-syntax portname
|
||||||
|
(open-input-string (send defs get-text)))))))))))
|
||||||
|
|
||||||
(define performance-report-drracket-button
|
(define performance-report-drracket-button
|
||||||
(list
|
(list
|
||||||
"Performance Report"
|
"Performance Report"
|
||||||
reverse-content-bitmap
|
reverse-content-bitmap
|
||||||
(λ (drs-frame)
|
performance-report-callback))
|
||||||
(message-box "Performance Report"
|
|
||||||
"Coming Soon!"))))
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user