20 #include <freerdp/config.h>
25 #include <winpr/sysinfo.h>
26 #include <freerdp/utils/stopwatch.h>
28 static void stopwatch_set_time(UINT64* usecs)
30 const UINT64 ns = winpr_GetTickCount64NS();
31 *usecs = WINPR_TIME_NS_TO_US(ns);
49 void stopwatch_start(
STOPWATCH* stopwatch)
51 stopwatch_set_time(&stopwatch->start);
57 stopwatch_set_time(&stopwatch->end);
58 stopwatch->elapsed += (stopwatch->end - stopwatch->start);
61 void stopwatch_reset(
STOPWATCH* stopwatch)
65 stopwatch->elapsed = 0;
69 double stopwatch_get_elapsed_time_in_seconds(
STOPWATCH* stopwatch)
71 const long double ld = stopwatch->elapsed / 1000000.0L;
75 void stopwatch_get_elapsed_time_in_useconds(
STOPWATCH* stopwatch, UINT32* sec, UINT32* usec)
77 *sec = (UINT32)stopwatch->elapsed / 1000000;
78 *usec = (UINT32)stopwatch->elapsed % 1000000;