util: Implement util_thread_get_time_nano on win32
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com> Reviewed-by: Jesse Natalie <jenatali@microsoft.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18001>
This commit is contained in:
@@ -240,6 +240,13 @@ util_thread_get_time_nano(thrd_t thread)
|
||||
pthread_getcpuclockid(thread, &cid);
|
||||
clock_gettime(cid, &ts);
|
||||
return (int64_t)ts.tv_sec * 1000000000 + ts.tv_nsec;
|
||||
#elif defined(_WIN32)
|
||||
union {
|
||||
FILETIME time;
|
||||
ULONGLONG value;
|
||||
} kernel_time, user_time;
|
||||
GetThreadTimes((HANDLE)thread.handle, NULL, NULL, &kernel_time.time, &user_time.time);
|
||||
return (kernel_time.value + user_time.value) * 100;
|
||||
#else
|
||||
(void)thread;
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user