projects
/
ghc-hetmet.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
917c16c
)
Fix ~2000 second profiling time wrapping bug
author
Ian Lynagh
<igloo@earth.li>
Mon, 11 Sep 2006 22:32:10 +0000
(22:32 +0000)
committer
Ian Lynagh
<igloo@earth.li>
Mon, 11 Sep 2006 22:32:10 +0000
(22:32 +0000)
rts/ProfHeap.c
patch
|
blob
|
history
rts/posix/GetTime.c
patch
|
blob
|
history
diff --git
a/rts/ProfHeap.c
b/rts/ProfHeap.c
index
8f4c8ba
..
c161d0c
100644
(file)
--- a/
rts/ProfHeap.c
+++ b/
rts/ProfHeap.c
@@
-386,9
+386,9
@@
printSample(rtsBool beginSample, StgDouble sampleValue)
{
StgDouble fractionalPart, integralPart;
fractionalPart = modf(sampleValue, &integralPart);
{
StgDouble fractionalPart, integralPart;
fractionalPart = modf(sampleValue, &integralPart);
- fprintf(hp_file, "%s %d.%02d\n",
+ fprintf(hp_file, "%s %" FMT_Word64 ".%02" FMT_Word64 "\n",
(beginSample ? "BEGIN_SAMPLE" : "END_SAMPLE"),
(beginSample ? "BEGIN_SAMPLE" : "END_SAMPLE"),
- (int)integralPart, (int)(fractionalPart * 100));
+ (StgWord64)integralPart, (StgWord64)(fractionalPart * 100));
}
/* --------------------------------------------------------------------------
}
/* --------------------------------------------------------------------------
diff --git
a/rts/posix/GetTime.c
b/rts/posix/GetTime.c
index
89d83a3
..
0e591ef
100644
(file)
--- a/
rts/posix/GetTime.c
+++ b/
rts/posix/GetTime.c
@@
-44,7
+44,7
@@
Ticks getProcessCPUTime(void)
{
struct rusage t;
getrusage(RUSAGE_SELF, &t);
{
struct rusage t;
getrusage(RUSAGE_SELF, &t);
- return (t.ru_utime.tv_sec * TICKS_PER_SECOND +
+ return ((Ticks)t.ru_utime.tv_sec * TICKS_PER_SECOND +
((Ticks)t.ru_utime.tv_usec * TICKS_PER_SECOND)/1000000);
}
((Ticks)t.ru_utime.tv_usec * TICKS_PER_SECOND)/1000000);
}
@@
-52,7
+52,7
@@
Ticks getProcessElapsedTime(void)
{
struct timeval tv;
gettimeofday(&tv, (struct timezone *) NULL);
{
struct timeval tv;
gettimeofday(&tv, (struct timezone *) NULL);
- return (tv.tv_sec * TICKS_PER_SECOND +
+ return ((Ticks)tv.tv_sec * TICKS_PER_SECOND +
((Ticks)tv.tv_usec * TICKS_PER_SECOND)/1000000);
}
((Ticks)tv.tv_usec * TICKS_PER_SECOND)/1000000);
}
@@
-120,7
+120,7
@@
Ticks getThreadCPUTime(void)
// reliable on Linux, but it's the best we have.
struct timespec ts;
clock_gettime(CLOCK_THREAD_CPUTIME_ID, &ts);
// reliable on Linux, but it's the best we have.
struct timespec ts;
clock_gettime(CLOCK_THREAD_CPUTIME_ID, &ts);
- return (ts.tv_sec * TICKS_PER_SECOND +
+ return ((Ticks)ts.tv_sec * TICKS_PER_SECOND +
((Ticks)ts.tv_nsec * TICKS_PER_SECOND) / 1000000000);
#else
return getProcessCPUTime();
((Ticks)ts.tv_nsec * TICKS_PER_SECOND) / 1000000000);
#else
return getProcessCPUTime();