[ALL] improve exactness of time calculations. [mlnx: 4479]
authorleonidk <leonidk@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Wed, 17 Jun 2009 13:37:44 +0000 (13:37 +0000)
committerleonidk <leonidk@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Wed, 17 Jun 2009 13:37:44 +0000 (13:37 +0000)
git-svn-id: svn://openib.tc.cornell.edu/gen1/trunk@2257 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86

core/complib/user/cl_timer.c
inc/kernel/complib/cl_timer_osd.h

index 649a795..4f2ce0f 100644 (file)
@@ -161,7 +161,7 @@ cl_get_time_stamp( void )
        if( !QueryPerformanceCounter( &tick_count ) )\r
                return( 0 );\r
 \r
-       return( tick_count.QuadPart / (frequency.QuadPart / SEC_TO_MICRO) );\r
+       return( SEC_TO_MICRO * tick_count.QuadPart / frequency.QuadPart );\r
 }\r
 \r
 uint32_t\r
index bd3af5e..4cb99b0 100644 (file)
@@ -68,7 +68,7 @@ cl_get_time_stamp( void )
        LARGE_INTEGER   tick_count, frequency;\r
 \r
        tick_count = KeQueryPerformanceCounter( &frequency );\r
-       return( tick_count.QuadPart / (frequency.QuadPart / SEC_TO_MICRO) );\r
+       return( SEC_TO_MICRO * tick_count.QuadPart / frequency.QuadPart );\r
 }\r
 \r
 CL_INLINE uint32_t CL_API\r
@@ -99,4 +99,4 @@ cl_get_tick_freq( void )
 }      /* extern "C" */\r
 #endif\r
 \r
-#endif // _CL_TIMER_OSD_H_
\ No newline at end of file
+#endif // _CL_TIMER_OSD_H_\r