From ef55177ed6a6509d725cae39739c1bd68e6c4b30 Mon Sep 17 00:00:00 2001 From: Glenn Rice Date: Sat, 20 Nov 2010 00:22:56 +0000 Subject: Implement JitIL profiling on linux. I also tried implementing __rdtsc using assembly and didn't really see a speed improvement so went with clock_gettime. Also changed other gettimeofday calls to clock_gettime, which is supposedly more accurate. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6447 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Core/Common/Src/Thread.cpp | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'Source/Core/Common/Src/Thread.cpp') diff --git a/Source/Core/Common/Src/Thread.cpp b/Source/Core/Common/Src/Thread.cpp index e06c91170a..2788a4583e 100644 --- a/Source/Core/Common/Src/Thread.cpp +++ b/Source/Core/Common/Src/Thread.cpp @@ -492,15 +492,11 @@ namespace Common if (timeout != INFINITE) { - struct timeval now; - gettimeofday(&now, NULL); + struct timespec now; + clock_gettime(CLOCK_MONOTONIC_RAW, &now); memset(&wait, 0, sizeof(wait)); - //TODO: timespec also has nanoseconds, but do we need them? - //as consequence, waiting is limited to seconds for now. - //the following just looks ridiculous, and probably fails for - //values 429 < ms <= 999 since it overflows the long. - //wait.tv_nsec = (now.tv_usec + (timeout % 1000) * 1000) * 1000); + wait.tv_nsec = now.tv_nsec + (timeout % 1000) * 1000000; wait.tv_sec = now.tv_sec + (timeout / 1000); } -- cgit v1.2.3