gsdx-linux: Fix GSdx internal counter on linux

The issue is that clock gives the total cpu time of the process whereas
we want the cpu time of the rendering thread
This commit is contained in:
Gregory Hainaut 2014-11-24 23:44:32 +01:00
parent b259a46ab7
commit 1b555ea3b5
1 changed files with 8 additions and 0 deletions

View File

@ -37,7 +37,15 @@ void GSPerfMon::Put(counter_t c, double val)
{
if(c == Frame)
{
#ifdef __linux__
// clock on linux will return CLOCK_PROCESS_CPUTIME_ID.
// CLOCK_THREAD_CPUTIME_ID is much more useful to measure the fps
struct timespec ts;
clock_gettime(CLOCK_THREAD_CPUTIME_ID, &ts);
uint64 now = (uint64) ts.tv_sec * (uint64) 1e6 + (uint64) ts.tv_nsec / (uint64) 1e3;
#else
clock_t now = clock();
#endif
if(m_lastframe != 0)
{