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

Leonid Keller leonid at mellanox.co.il
Mon Jun 15 07:10:02 PDT 2009


one needs to convert to double ...


________________________________

	From: Tzachi Dar 
	Sent: Monday, June 15, 2009 4:52 PM
	To: ofw at lists.openfabrics.org
	Cc: Windows Design
	Subject: A problem on cl_get_time_stamp (and other functions)
	
	
	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/5b8baa07/attachment.html>


More information about the ofw mailing list