[*] Further deprecate the "high res" clock

(might introduce a fast low res clock, tbd)
This commit is contained in:
Reece Wilson 2023-07-06 10:17:22 +01:00
parent 94e2f7924e
commit 62b41ff93e

View File

@ -484,63 +484,26 @@ namespace Aurora::Time
#pragma region TO_DEPRECATE
// [soon to be] @deprecated / was used by benchmarks to measure thread time
AUKN_SYM AuUInt64 HighResClock()
{
return high_res_clock::now().time_since_epoch().count();
return SteadyClock();
}
// [soon to be] @deprecated / was used by benchmarks to measure thread time
AUKN_SYM AuUInt64 HighResClockMS()
{
#if defined(AURORA_IS_POSIX_DERIVED)
::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();
return SteadyClockMS();
}
// [soon to be] @deprecated / was used by benchmarks to measure thread time
AUKN_SYM AuUInt64 HighResClockNS()
{
#if defined(AURORA_IS_POSIX_DERIVED)
::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();
return SteadyClockNS();
}
AUKN_SYM AuUInt64 HighResClockJiffies()
{
static AuUInt64 frequency = 0;
if (frequency != 0)
{
return frequency;
}
#if defined(AURORA_COMPILER_MSVC)
return frequency = _Query_perf_frequency();
#endif
#if defined(AURORA_IS_POSIX_DERIVED)
::timespec spec {};
if (::clock_getres(CLOCK_PROCESS_CPUTIME_ID, &spec) == 0)
{
if (spec.tv_nsec && !spec.tv_sec)
{
return frequency = 1000000000ull / spec.tv_nsec;
}
}
#endif
return frequency = static_cast<double>(high_res_clock::period::den) / static_cast<double>(high_res_clock::period::num);
return SteadyClockJiffies();
}
#pragma endregion TO_DEPRECATE
}