Adding support to do memory profiling of drr startup that drdr can track.
This commit is contained in:
parent
b4d176466a
commit
896bbfaabb
|
@ -106,7 +106,15 @@ If the namespace does not, they are colored the unbound color.
|
||||||
(define (printf . args) (apply fprintf o args))
|
(define (printf . args) (apply fprintf o args))
|
||||||
|
|
||||||
|
|
||||||
(define xref (delay/idle (load-collections-xref)))
|
(define xref (if (getenv "PLTDRXREFDELAY")
|
||||||
|
(begin
|
||||||
|
(printf "PLTDRXREFDELAY: using plain delay\n")
|
||||||
|
(delay (begin
|
||||||
|
(printf "PLTDRXREFDELAY: loading xref\n")
|
||||||
|
(begin0
|
||||||
|
(load-collections-xref)
|
||||||
|
(printf "PLTDRXREFDELAY: loaded xref\n")))))
|
||||||
|
(delay/idle (load-collections-xref))))
|
||||||
(define (get-xref) (force xref))
|
(define (get-xref) (force xref))
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#lang scribble/doc
|
#lang scribble/doc
|
||||||
@(require "common.ss"
|
@(require "common.ss"
|
||||||
(for-label compiler/cm))
|
(for-label compiler/cm
|
||||||
|
racket/promise))
|
||||||
|
|
||||||
@title[#:tag "extending-drracket"]{Extending DrRacket}
|
@title[#:tag "extending-drracket"]{Extending DrRacket}
|
||||||
|
|
||||||
|
@ -163,4 +164,13 @@ Several environment variables can affect DrRacket's behavior:
|
||||||
@exec{setup-plt} with the @Flag{c} flag, set the environment
|
@exec{setup-plt} with the @Flag{c} flag, set the environment
|
||||||
variable, and then run @exec{setup-plt} again.}
|
variable, and then run @exec{setup-plt} again.}
|
||||||
|
|
||||||
|
@item{@indexed-envvar{PLTDRXREFDELAY} : When this environment variable
|
||||||
|
is set, DrRacket uses an ordinary @scheme[delay] (instead of
|
||||||
|
@scheme[delay/idle]) delay the computation of the searching
|
||||||
|
indicies. This means that Check Syntax will start more slowly
|
||||||
|
the first time, but that the startup performance is more
|
||||||
|
predictable. In addition, when the environment variable is
|
||||||
|
set, DrRacket will print out that it is set, and will print
|
||||||
|
when the index is started loading and when it finishes loading.}
|
||||||
|
|
||||||
]
|
]
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#lang racket/base
|
#lang racket/base
|
||||||
(require "drracket-test-util.rkt"
|
(require "drracket-test-util.rkt"
|
||||||
racket/gui/base)
|
racket/gui/base
|
||||||
|
racket/class
|
||||||
|
framework/test)
|
||||||
|
|
||||||
;; mem-cnt returns the amount of memory used, iterating (collect-garbage)
|
;; mem-cnt returns the amount of memory used, iterating (collect-garbage)
|
||||||
;; until the delta is less than 10k or we've done it 20 times.
|
;; until the delta is less than 10k or we've done it 20 times.
|
||||||
|
@ -17,12 +19,30 @@
|
||||||
[else
|
[else
|
||||||
(loop new-cmu (- n 1))]))))
|
(loop new-cmu (- n 1))]))))
|
||||||
|
|
||||||
|
(void (putenv "PLTDRXREFDELAY" "yes"))
|
||||||
|
|
||||||
|
(define (wait-and-print)
|
||||||
|
(let ([s (make-semaphore 0)])
|
||||||
|
;; let two rounds of pending events be handled.
|
||||||
|
(queue-callback (λ () (queue-callback (λ () (semaphore-post s)) #f)) #f)
|
||||||
|
(yield s)
|
||||||
|
|
||||||
|
;; print out memory use in a fake form to be tracked by drdr
|
||||||
|
(let ([n (mem-cnt)])
|
||||||
|
(printf "cpu time: ~a real time: ~a gc time: ~a\n"
|
||||||
|
n n n))))
|
||||||
|
|
||||||
|
(printf "The printouts below are designed to trick drdr into graphing them;\nthey aren't times, but memory usage.\n")
|
||||||
(fire-up-drscheme-and-run-tests
|
(fire-up-drscheme-and-run-tests
|
||||||
(λ ()
|
(λ ()
|
||||||
(let ([drscheme-frame (wait-for-drscheme-frame)]
|
(let ([drs-frame (wait-for-drscheme-frame)])
|
||||||
[s (make-semaphore 0)])
|
|
||||||
(queue-callback (λ () (queue-callback (λ () (semaphore-post s)) #f)) #f)
|
(wait-and-print)
|
||||||
(yield s) ;; let two rounds of pending events be handled.
|
|
||||||
(let ([n (mem-cnt)])
|
(send (send drs-frame get-definitions-text) insert "#lang racket/base\n+")
|
||||||
(printf "cpu time: ~a real time: ~a gc time: ~a\n"
|
(set-module-language!)
|
||||||
n n n)))))
|
(test:run-one (lambda () (send (send drs-frame syncheck:get-button) command)))
|
||||||
|
(wait-for-computation drs-frame)
|
||||||
|
|
||||||
|
(wait-and-print))))
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user