diff options
author | mtklein <mtklein@google.com> | 2015-10-22 17:49:22 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-10-22 17:49:22 -0700 |
commit | 5a06df46864f010befaf8c57af1801fb43cbea86 (patch) | |
tree | 2076a03c9e01fe3146e64755f54684abd3ea9497 /src/core | |
parent | a1840d50e29fd95e4df2d1168fe54c34c2a5c30c (diff) |
Revert of SkTime::GetNSecs() (patchset #10 id:180001 of https://codereview.chromium.org/1422513003/ )
Reason for revert:
https://codereview.chromium.org/1412453006
Original issue's description:
> SkTime::GetNSecs()
>
> - Move high-precision wall timers from tools/timer to SkTime.
> - Implement SkTime::GetMSecs() in terms of SkTime::GetNSecs().
> - Delete unused tools/timer code.
>
> I have no idea what's going on there in src/animator.
> I don't intend to investigate.
>
> BUG=skia:
>
> Committed: https://skia.googlesource.com/skia/+/70084cbc16ee8162649f2601377feb6e49de0217
>
> CQ_EXTRA_TRYBOTS=client.skia.compile:Build-Ubuntu-GCC-x86_64-Debug-CrOS_Link-Trybot
>
> Committed: https://skia.googlesource.com/skia/+/a1840d50e29fd95e4df2d1168fe54c34c2a5c30c
TBR=caryclark@google.com,reed@google.com,mtklein@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=skia:
Review URL: https://codereview.chromium.org/1417753003
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/SkTime.cpp | 35 |
1 files changed, 0 insertions, 35 deletions
diff --git a/src/core/SkTime.cpp b/src/core/SkTime.cpp index 03970aa824..fa6c04447d 100644 --- a/src/core/SkTime.cpp +++ b/src/core/SkTime.cpp @@ -5,7 +5,6 @@ * found in the LICENSE file. */ -#include "SkOncePtr.h" #include "SkString.h" #include "SkTime.h" @@ -23,37 +22,3 @@ void SkTime::DateTime::toISO8601(SkString* dst) const { timeZoneMinutes); } } - -// TODO: use rdtscp when (runtime) available -// TODO: use std::chrono when (compile-time) available - -#if defined(_MSC_VER) - #include <intrin.h> - SK_DECLARE_STATIC_ONCE_PTR(double, ns_per_tick); - double SkTime::GetNSecs() { - uint64_t ticks = __rdtsc(); - return ticks * *ns_per_tick.get([]{ - LARGE_INTEGER khz; // The docs say this returns Hz, but it returns KHz. - QueryPerformanceFrequency(&khz); - return new double(1e6 / khz.QuadPart); - }); - } -#elif defined(__MACH__) - #include <mach/mach_time.h> - SK_DECLARE_STATIC_ONCE_PTR(double, ns_per_tick); - double SkTime::GetNSecs() { - uint64_t ticks = mach_absolute_time(); - return ticks * *ns_per_tick.get([]{ - mach_timebase_info_data_t timebase; - (void)mach_timebase_info(&timebase); - return new double(timebase.numer * 1.0 / timebase.denom); - }); - } -#else - #include <time.h> - double SkTime::GetNSecs() { - struct timespec ts = {0, 0}; - (void)clock_gettime(CLOCK_MONOTONIC, &ts); - return ts.tv_sec * 1e9 + ts.tv_nsec; - } -#endif |