OSX ArchHooks::GetMicrosecondsSinceStart
This commit is contained in:
@@ -14,6 +14,7 @@
|
|||||||
#include <mach/thread_act.h>
|
#include <mach/thread_act.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/sysctl.h>
|
#include <sys/sysctl.h>
|
||||||
|
#include <sys/time.h>
|
||||||
|
|
||||||
/* You would think that these would be defined somewhere. */
|
/* You would think that these would be defined somewhere. */
|
||||||
enum
|
enum
|
||||||
@@ -343,6 +344,20 @@ void ArchHooks_darwin::ExitTimeCriticalSection()
|
|||||||
LOG->Warn( "Time-critical section lasted for %f", fTimeCritLen );
|
LOG->Warn( "Time-critical section lasted for %f", fTimeCritLen );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int64_t GetMicrosecondsSinceEpoch()
|
||||||
|
{
|
||||||
|
struct timeval tv;
|
||||||
|
gettimeofday( &tv, NULL );
|
||||||
|
|
||||||
|
return int64_t(tv.tv_sec) * 1000000 + int64_t(tv.tv_usec);
|
||||||
|
}
|
||||||
|
|
||||||
|
int64_t ArchHooks::GetMicrosecondsSinceStart( bool bAccurate )
|
||||||
|
{
|
||||||
|
static int64_t iStartTime = GetMicrosecondsSinceEpoch();
|
||||||
|
return GetMicrosecondsSinceEpoch() - iStartTime;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (c) 2003-2004 Steve Checkoway
|
* (c) 2003-2004 Steve Checkoway
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
|
|||||||
Reference in New Issue
Block a user