File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change 9
9
#include <x86intrin.h>
10
10
#include <stdint.h>
11
11
12
- inline uint64_t get_frc64_time (void )
12
+ /* Return measure of free running counter, using rdtsc, so may be reordered with other code */
13
+ inline uint64_t get_frc64_time_standard (void )
13
14
{
14
15
return __rdtsc ();
15
16
}
16
17
18
+ /* Return measure of free running counter, using rdtscp, which gives higher accuracy when measuring
19
+ * the duration of blocks of code as it can't be reordered with earlier instructions, but has
20
+ * slightly higher overhead than get_frc64_time_standard() */
21
+ inline uint64_t get_frc64_time_accurate (void )
22
+ {
23
+ unsigned int aux ;
24
+ return __rdtscp (& aux );
25
+ }
26
+
27
+ /* Default to using the more accurate measure as all current uses of this function are using it to
28
+ * measure ping pong deltas, and hence will benefit from the accuracy */
29
+ #define get_frc64_time () get_frc64_time_accurate()
30
+
17
31
void init_tsc_frequency (void );
18
32
19
33
/* Given TSC ticks it will calculate and return number of nano seconds passed for it.
You can’t perform that action at this time.
0 commit comments