[plt-scheme] Profiling...

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Wed Jun 14 09:22:40 EDT 2006

At Wed, 14 Jun 2006 14:17:03 +0100, Matt Jadud wrote:
> ==========
> (module foo mzscheme
>    (require (lib "errortrace.ss" "errortrace"))
>    (instrumenting-enabled #t)
>    (profiling-enabled #t)
>    (profiling-record-enabled #t)
>    (profile-paths-enabled #t)

The errortrace module is strange; don't import it into another module.

Instead, move the above lines outside the `module' form, before the
module is loaded. Then, errortrace gets a chance to change the way that
the module is compiled.

Here's a command line using the file content below:

 mzscheme -f pre.ss -t foo.ss -f post.ss


; pre.ss
(require (lib "errortrace.ss" "errortrace"))
(instrumenting-enabled #t)
(profiling-enabled #t)
(profiling-record-enabled #t)
(profile-paths-enabled #t)

; foo.ss
(module foo mzscheme
   ;; Perhaps I might 'require' a module here?

   (define (fact n)
     (if (zero? n)
         (* n (fact (sub1 n)))))

   (fact 5))
; post.ss
(output-profile-results #t #t)

Posted on the users mailing list.