mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-24 14:49:42 -06:00
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
This commit is contained in:
@ -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);
|
||||
}
|
||||
|
||||
|
@ -60,8 +60,7 @@
|
||||
#define INFINITE 0xffffffff
|
||||
#endif
|
||||
|
||||
//for gettimeofday and struct time(val|spec)
|
||||
#include <sys/time.h>
|
||||
//for clock_gettime and struct timespec
|
||||
#include <time.h>
|
||||
#endif
|
||||
|
||||
|
@ -21,8 +21,6 @@
|
||||
#include <Windows.h>
|
||||
#include <mmsystem.h>
|
||||
#include <sys/timeb.h>
|
||||
#else
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
|
||||
#include "Common.h"
|
||||
@ -37,9 +35,9 @@ u32 Timer::GetTimeMs()
|
||||
#ifdef _WIN32
|
||||
return timeGetTime();
|
||||
#else
|
||||
struct timeval t;
|
||||
(void)gettimeofday(&t, NULL);
|
||||
return((u32)(t.tv_sec * 1000 + t.tv_usec / 1000));
|
||||
struct timespec t;
|
||||
(void)clock_gettime(CLOCK_MONOTONIC_RAW, &t);
|
||||
return ((u32)(t.tv_sec * 1000 + t.tv_nsec / 1000000));
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -157,13 +155,6 @@ void Timer::RestoreResolution()
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef __GNUC__
|
||||
void _time64(u64* t)
|
||||
{
|
||||
*t = 0; //TODO
|
||||
}
|
||||
#endif
|
||||
|
||||
// Get the number of seconds since January 1 1970
|
||||
u64 Timer::GetTimeSinceJan1970()
|
||||
{
|
||||
@ -213,9 +204,9 @@ std::string Timer::GetTimeFormatted()
|
||||
(void)::ftime(&tp);
|
||||
sprintf(formattedTime, "%s:%03i", tmp, tp.millitm);
|
||||
#else
|
||||
struct timeval t;
|
||||
(void)gettimeofday(&t, NULL);
|
||||
sprintf(formattedTime, "%s:%03d", tmp, (int)(t.tv_usec / 1000));
|
||||
struct timespec t;
|
||||
(void)clock_gettime(CLOCK_REALTIME, &t);
|
||||
sprintf(formattedTime, "%s:%03d", tmp, (int)(t.tv_nsec / 1000000));
|
||||
#endif
|
||||
|
||||
return std::string(formattedTime);
|
||||
@ -229,8 +220,8 @@ double Timer::GetDoubleTime()
|
||||
struct timeb tp;
|
||||
(void)::ftime(&tp);
|
||||
#else
|
||||
struct timeval t;
|
||||
(void)gettimeofday(&t, NULL);
|
||||
struct timespec t;
|
||||
(void)clock_gettime(CLOCK_REALTIME, &t);
|
||||
#endif
|
||||
// Get continuous timestamp
|
||||
u64 TmpSeconds = Common::Timer::GetTimeSinceJan1970();
|
||||
@ -246,7 +237,7 @@ double Timer::GetDoubleTime()
|
||||
#ifdef _WIN32
|
||||
double ms = tp.millitm / 1000.0 / 1000.0;
|
||||
#else
|
||||
double ms = t.tv_usec / 1000.0 / 1000.0;
|
||||
double ms = t.tv_nsec / 1000000000.0;
|
||||
#endif
|
||||
double TmpTime = Seconds + ms;
|
||||
|
||||
|
Reference in New Issue
Block a user