[ofw] A problem on cl_get_time_stamp (and other functions)

Tzachi Dar tzachid at mellanox.co.il
Mon Jun 15 06:52:15 PDT 2009


When running on a new system I have came to conclusion that there is a
problem with 
uint64_t
cl_get_time_stamp( void )
{
 LARGE_INTEGER tick_count, frequency;
 
 if( !QueryPerformanceFrequency( &frequency ) )
  return( 0 );
 
 if( !QueryPerformanceCounter( &tick_count ) )
  return( 0 );
 
 return( tick_count.QuadPart / (frequency.QuadPart / SEC_TO_MICRO) );
}
 
The problem starts from the fact that frequency is 3579545. In other
words, this means that (frequency.QuadPart / SEC_TO_MICRO) is 3 and not
3.579 and all measurements are bypassed with 19%.
 
I suggest to change that to be 
 
return( SEC_TO_MICRO * tick_count.QuadPart / frequency.QuadPart ) );
 
We probably have to look at all other places...
 
Please also note that on another computer, I have received "frequency =
14318180".
This is much better than before, but please note that we were still
wrong in around 3%.
 
On a different computer I have also received 1121205359 which is
probably fine.
 
Thanks
Tzachi

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openfabrics.org/pipermail/ofw/attachments/20090615/e09381c5/attachment.html>


More information about the ofw mailing list