Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1780)

Unified Diff: src/core/SkTime.cpp

Issue 1420923003: Revert of SkTime::GetNSecs() (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/animator/SkTime.cpp ('k') | src/ports/SkTime_Unix.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkTime.cpp
diff --git a/src/core/SkTime.cpp b/src/core/SkTime.cpp
index 03970aa824a51131bca6bd342e5021afcff19d98..fa6c04447de0ade9f8bfaf927151215d6eec85ec 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 @@
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
« no previous file with comments | « src/animator/SkTime.cpp ('k') | src/ports/SkTime_Unix.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698