#3904: Bug in shipped gcc makes profiling lose resolution
-----------------------------+----------------------------------------------
    Reporter:  augustss      |        Owner:              
        Type:  bug           |       Status:  new         
    Priority:  normal        |    Milestone:              
   Component:  Build System  |      Version:  6.12.1      
    Keywords:                |   Difficulty:              
          Os:  Windows       |     Testcase:              
Architecture:  x86           |      Failure:  None/Unknown
-----------------------------+----------------------------------------------

Comment(by simonmar):

 Replying to [comment:3 augustss]:
 > Switching back to using (unsigned) int seems like the simplest fix then.

 The patch that introduced the 64-bit values was:

 {{{
 Mon Sep 11 23:32:10 BST 2006  Ian Lynagh <[email protected]>
   * Fix ~2000 second profiling time wrapping bug
     {
     hunk ./rts/ProfHeap.c 389
     -    fprintf(hp_file, "%s %d.%02d\n",
     +    fprintf(hp_file, "%s %" FMT_Word64 ".%02" FMT_Word64 "\n",
     hunk ./rts/ProfHeap.c 391
     -            (int)integralPart, (int)(fractionalPart * 100));
     +            (StgWord64)integralPart, (StgWord64)(fractionalPart *
 100));
     hunk ./rts/posix/GetTime.c 47
     -    return (t.ru_utime.tv_sec * TICKS_PER_SECOND + [_$_]
     +    return ((Ticks)t.ru_utime.tv_sec * TICKS_PER_SECOND + [_$_]
     hunk ./rts/posix/GetTime.c 55
     -    return (tv.tv_sec * TICKS_PER_SECOND +
     +    return ((Ticks)tv.tv_sec * TICKS_PER_SECOND +
     hunk ./rts/posix/GetTime.c 123
     -    return (ts.tv_sec * TICKS_PER_SECOND + [_$_]
     +    return ((Ticks)ts.tv_sec * TICKS_PER_SECOND + [_$_]
     }
 }}}

 I can see that the changes to `GetTime` were necessary to avoid
 overflowing 32-bit integers (TICKS_PER_SECOND==1000000), but I don't see
 why we need to use `StgWord64` in `printSample`, since the values there
 are seconds, not microseconds.  Ian, any idea why this was done?

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/3904#comment:4>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to