Bogus stats when running SMP programs

Simon Marlow simonmarhaskell at gmail.com
Wed Sep 27 04:25:39 EDT 2006


Tomasz Zielonka wrote:
> On Tue, Sep 26, 2006 at 01:46:30AM +0100, Ian Lynagh wrote:
> 
>>I couldn't reproduce this with a simple program that forked off 4
>>threads to do computation on a single CPU machine, and neither could
>>someone on IRC with head from Sep 15 on a Core Duo.
>>
>>Is it possible to send us a small example program along with exactly
>>what flags you used to compile and run it please?
> 
> 
> It turns out it happens even with the simplest program:
> 
>     main = return
> 
> Compilation command:
> 
>     ghc -threaded --make B -o B
> 
> Running:
> 
>     tomekz at gfs6:~/src/par$ ./B +RTS -sstderr
>     ./B +RTS -sstderr
>          21,864 bytes allocated in the heap
>           1,404 bytes copied during GC (scavenged)
>           4,156 bytes copied during GC (not scavenged)
>          21,936 bytes maximum residency (1 sample(s))
> 
>               1 collections in generation 0 (  0.00s)
>               1 collections in generation 1 (  0.00s)
> 
>               1 Mb total memory in use
> 
>       Task  0 (worker) :  MUT time: 402094045.13s  (  0.00s elapsed)
>                           GC  time:   0.00s  (  0.00s elapsed)
> 
>       Task  1 (worker) :  MUT time: 200.00s  (  0.00s elapsed)
>                           GC  time:   0.00s  (  0.00s elapsed)
> 
>       Task  2 (worker) :  MUT time:   0.00s  (  0.00s elapsed)
>                           GC  time:   0.00s  (  0.00s elapsed)
> 
>       INIT  time    0.00s  (  0.00s elapsed)
>       MUT   time    0.00s  (  0.00s elapsed)
>       GC    time    0.00s  (  0.00s elapsed)
>       EXIT  time    0.00s  (  0.00s elapsed)
>       Total time    0.00s  (  0.00s elapsed)
> 
>       %GC time       0.0%  (11.5% elapsed)
> 
>       Alloc rate    21,864,000,000 bytes per MUT second
> 
>       Productivity 100.0% of total user, 0.2% of total elapsed
> 
> It doesn't happen when I compile without -threaded. But it doesn't show
> task statistics then.

Perhaps clock_gettime() is returning strange results on your system.  Could you 
try compiling with -threaded -debug, and run the program under gdb.  Set a 
breakpoint in getThreadCPUTime(), and take a look at what gets returned by 
clock_gettime().

Cheers,
	Simon



More information about the Glasgow-haskell-bugs mailing list