logo       

Re: [GHC] #664: Heap profiler can report hundredths of a second as "3.100" : msg#00142

lang.haskell.glasgow.bugs

Subject: Re: [GHC] #664: Heap profiler can report hundredths of a second as "3.100" (not "4.000")

#664: Heap profiler can report hundredths of a second as "3.100" (not "4.000")
------------------------+---------------------------------------------------
Reporter: guest | Owner:
Type: bug | Status: new
Priority: normal | Milestone:
Component: Profiling | Version: 6.4
Severity: normal | Resolution:
Keywords: | Os: Windows
Difficulty: Unknown | Architecture: x86
------------------------+---------------------------------------------------
Comment (by guest):

The problem looks to be in ghc/rts/ProfHeap.c in :
{{{
static void
printSample(rtsBool beginSample, StgDouble sampleValue)
{
StgDouble fractionalPart, integralPart;
fractionalPart = modf(sampleValue, &integralPart);
fprintf(hp_file, "%s %d.%02d\n",
(beginSample ? "BEGIN_SAMPLE" : "END_SAMPLE"),
(int)integralPart, (int)(fractionalPart * 100 + 0.5));
}
}}}

Specifically, {{{(int)(fractionalPart * 100 + 0.5)}}}. If
{{{fractionalPart}}} is >= 0.995, then {{{(int)(fractionalPart * 100 +
0.5)}}} will be equal to 100 and "x.100" will be printed inj the
"program.hp" file.

Perhaps {{{(int)(fractionalPart * 100 + 0.5)}}} should just be
{{{(int)(fractionalPart * 100)}}}.

--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/664>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler_______________________________________________
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@xxxxxxxxxxx
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise