RE: getCPUTime: buggy?

2000-11-24 Thread Simon Marlow

 Given 
 
 getrusage(RUSAGE_SELF, t);
 cpu[0] = t.ru_utime.tv_sec;
 cpu[1] = 1000 * t.ru_utime.tv_usec;
 cpu[2] = t.ru_stime.tv_sec;
 cpu[3] = 1000 * t.ru_stime.tv_usec;
 
 in `getCPUTime.c', I don't understand
 
 return ((fromIntegral (I# (indexIntArray# frozen# 
 0#)) * 10 + 
  fromIntegral (I# (indexIntArray# frozen# 1#)) + 
fromIntegral (I# (indexIntArray# frozen# 2#)) 
 * 10 + 
  fromIntegral (I# (indexIntArray# frozen# 
 3#))) * 1000)
 
 in `GetCPUTime.lhs'.  I mean, I would expect cases 1# and 3#
 to be the same.  Is it a problem in my brain or in the code?

Yep, it looks entirely bogus to me.  Cases 0#, 1# and 2# all look to be
in nanoseconds, but they should be in picoseconds.

Cheers,
Simon

___
Glasgow-haskell-bugs mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs



RE: getCPUTime: buggy?

2000-11-24 Thread Simon Marlow

  Given 
  
  getrusage(RUSAGE_SELF, t);
  cpu[0] = t.ru_utime.tv_sec;
  cpu[1] = 1000 * t.ru_utime.tv_usec;
  cpu[2] = t.ru_stime.tv_sec;
  cpu[3] = 1000 * t.ru_stime.tv_usec;
  
  in `getCPUTime.c', I don't understand
  
  return ((fromIntegral (I# (indexIntArray# frozen# 
  0#)) * 10 + 
   fromIntegral (I# (indexIntArray# frozen# 1#)) + 
   fromIntegral (I# (indexIntArray# frozen# 2#)) 
  * 10 + 
   fromIntegral (I# (indexIntArray# frozen# 
  3#))) * 1000)
  
  in `GetCPUTime.lhs'.  I mean, I would expect cases 1# and 3#
  to be the same.  Is it a problem in my brain or in the code?
 
 Yep, it looks entirely bogus to me.  Cases 0#, 1# and 2# all 
 look to be
 in nanoseconds, but they should be in picoseconds.

I take it back.  Read the code again *very* carefully :-)

Cheers,
Simon

___
Glasgow-haskell-bugs mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs