[*] UNIX benchmarks: follow CLOCK_PROCESS_CPUTIME_ID time
This commit is contained in:
parent
0be7c13e1b
commit
6e78ce5e07
@ -211,16 +211,26 @@ namespace Aurora::Time
|
||||
AUKN_SYM AuUInt64 HighResClockMS()
|
||||
{
|
||||
#if defined(AURORA_IS_POSIX_DERIVED)
|
||||
return SteadyClockMS();
|
||||
::timespec spec {};
|
||||
if (::clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &spec) == 0)
|
||||
{
|
||||
return AuSToMS<AuUInt64>(spec.tv_sec) + AuNSToMS<AuUInt64>(spec.tv_nsec);
|
||||
}
|
||||
#endif
|
||||
|
||||
return std::chrono::duration_cast<std::chrono::milliseconds>(high_res_clock::now().time_since_epoch()).count();
|
||||
}
|
||||
|
||||
AUKN_SYM AuUInt64 HighResClockNS()
|
||||
{
|
||||
#if defined(AURORA_IS_POSIX_DERIVED)
|
||||
return SteadyClockNS();
|
||||
::timespec spec {};
|
||||
if (::clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &spec) == 0)
|
||||
{
|
||||
return AuMSToNS<AuUInt64>(AuSToMS<AuUInt64>(spec.tv_sec)) + (AuUInt64)spec.tv_nsec;
|
||||
}
|
||||
#endif
|
||||
|
||||
return std::chrono::duration_cast<std::chrono::nanoseconds>(high_res_clock::now().time_since_epoch()).count();
|
||||
}
|
||||
|
||||
@ -328,7 +338,7 @@ namespace Aurora::Time
|
||||
|
||||
#if defined(AURORA_IS_POSIX_DERIVED)
|
||||
::timespec spec {};
|
||||
if (::clock_getres(CLOCK_MONOTONIC, &spec) == 0)
|
||||
if (::clock_getres(CLOCK_PROCESS_CPUTIME_ID, &spec) == 0)
|
||||
{
|
||||
if (spec.tv_nsec && !spec.tv_sec)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user