Skip to content

Bizarre results from -P profiler on OS X

I'm trying to use the profiler to understand the performance of an application on OS X. I have a smallish benchmark that prints a lot of lines of text to stdout, and the numbers reported when I use +RTS -P are very different from what I see with my eyes.

The benchmark itself is quite simple:

https://github.com/mailrank/text-format/blob/master/benchmarks/Simple.hs

When I run it on the command line, it produces simple enough output:

$ time ./Simple one 500000 +RTS -P >/dev/null
500000 iterations in 2.6 secs (191.7 thousand/sec)

real	0m2.626s
user	0m2.586s
sys	0m0.030s

The time measured within the app and the wallclock time are both in agreement.

However, if I look at the Simple.prof file left behind afterwards, its numbers seem bizarre:

        Mon Jun 27 11:35 2011 Time and Allocation Profiling Report  (Final)

           Simple +RTS -P -RTS one 500000

        total time  =        0.28 secs   (14 ticks @ 20 ms)
        total alloc = 2,200,395,720 bytes  (excludes profiling overheads)

It reports a time of just 0.28 seconds, and the number of ticks it counts arithmetically agree with this.

I have other programs that suffer from the same discrepancy between wallclock measurement and what the profiler reports to me, such that I don't feel like I can trust the profiler at all here. I'm at a loss for what to do about this, though.

Trac metadata
Trac field Value
Version 7.0.3
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Runtime System
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system MacOS X
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information