Oolite 1.91.0.7645-241119-222d325
Loading...
Searching...
No Matches
OOProfilingStopwatch.m File Reference
+ Include dependency graph for OOProfilingStopwatch.m:

Go to the source code of this file.

Functions

OOTimeDelta OOHighResTimeDeltaInSeconds (OOHighResTimeValue startTime, OOHighResTimeValue endTime)
 

Function Documentation

◆ OOHighResTimeDeltaInSeconds()

OOTimeDelta OOHighResTimeDeltaInSeconds ( OOHighResTimeValue startTime,
OOHighResTimeValue endTime )

Definition at line 115 of file OOProfilingStopwatch.m.

116{
117#if OO_PROFILING_STOPWATCH_MACH_ABSOLUTE_TIME
118 uint64_t diff = endTime - startTime;
119 static double conversion = 0.0;
120
121 if (EXPECT_NOT(conversion == 0.0))
122 {
123 mach_timebase_info_data_t info;
124 kern_return_t err = mach_timebase_info(&info);
125
126 if (err == 0)
127 {
128 conversion = 1e-9 * (double)info.numer / (double)info.denom;
129 }
130 }
131
132 return conversion * (double)diff;
133#elif OO_PROFILING_STOPWATCH_WINDOWS
134 return 1e-3 * (double)(endTime - startTime);
135#elif OO_PROFILING_STOPWATCH_GETTIMEOFDAY
136 int_fast32_t deltaS = (int_fast32_t)endTime.tv_sec - (int_fast32_t)startTime.tv_sec;
137 int_fast32_t deltaU = (int_fast32_t)endTime.tv_usec - (int_fast32_t)startTime.tv_usec;
138 double result = deltaU;
139 result = (result * 1e-6) + deltaS;
140 return result;
141#elif OO_PROFILING_STOPWATCH_JS_NOW
142 return 1e-6 * (double)(endTime - startTime);
143#endif
144}
#define EXPECT_NOT(x)

Referenced by OOTimeProfileEntry(Private)::addSampleWithTotalTime:selfTime:, OOJSProfileExit(), OOJSResumeTimeLimiter(), and OperationCallback().

+ Here is the caller graph for this function: