[racket] Statistical profiler doesn't return a complete report with JIT

From: Diogo F. S. Ramos (diogofsr at gmail.com)
Date: Fri Nov 16 10:18:54 EST 2012

I'm using Ubuntu 12.04 x86_64 and the statistical profiler is not
returning a report with the procedures called during the execution of a
thunk.

The package installed through the PPA (using apt-get) was
`5.3.1-20121108~precise'.

I've attached a test program at the bottom of this message.

When the program is run using `racket --no-jit ...', a report is
printed, with the procedures called, but when I run it using `racket
...', no procedure is listed.

$ racket fib-profile.rkt
Profiling results
-----------------
   Total cpu time observed: 2514ms (out of 2592ms)
   Number of samples taken: 50 (once every 50ms)

====================================
                         Caller
Idx  Total    Self    Name+srcLocal%
      ms(pct)  ms(pct)   Callee
====================================

$ racket --no-jit fib-profile.rkt
Profiling results
-----------------
   Total cpu time observed: 86859ms (out of 86997ms)
   Number of samples taken: 1728 (once every 50ms)

=============================================================
                                   Caller
Idx    Total         Self       Name+src               Local%
        ms(pct)       ms(pct)      Callee
=============================================================
[1] 86859(100.0%)     0(0.0%)   profile-thunk12
...t/collects/profile/main.rkt:9:0
                                   call-handled-body [2]100.0%
-------------------------------------------------------------
                                   profile-thunk12 [1]  100.0%
[2] 86859(100.0%)     0(0.0%)   call-handled-body ...private/more-
scheme.rkt:204:2
                                   run [3]              100.0%
-------------------------------------------------------------
                                   call-handled-body [2]100.0%
[3] 86859(100.0%)     0(0.0%)   run
...share/racket/collects/profile/main.rkt:29:2
                                   temp1 [4]            100.0%
-------------------------------------------------------------
                                   run [3]              100.0%
[4] 86859(100.0%)     0(0.0%)   temp1 /tmp/fib-profile.rkt:11:1
                                   fib [5]              100.0%
-------------------------------------------------------------
                                   temp1 [4]             18.6%
                                   fib [5]               81.4%
[5] 86859(100.0%) 86859(100.0%) fib /tmp/fib-profile.rkt:5:0
                                   fib [5]               81.4%
-------------------------------------------------------------

I'm suspicious of the package because I can get a report using the JIT
if I compile Racket from the git repository using the tag v5.3 and tag
v5.3.1 and also with the released source distribution v5.3.1 from the
website.

;;; fib-profile.rkt
#lang racket

(require profile)

(define (fib n)
   (if (<= n 2)
       1
       (+ (fib (- n 1)) (fib (- n 2)))))

(profile-thunk
  (thunk (fib 38))
  #:repeat 4)

Posted on the users mailing list.