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

Unified Diff: tools/timer/Timer.cpp

Issue 788243008: Sketch DM refactor. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: better failure messages, disable a few things temporarily to try to go green Created 5 years, 11 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 | « tools/timer/Timer.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/timer/Timer.cpp
diff --git a/tools/timer/Timer.cpp b/tools/timer/Timer.cpp
index a9f04afe756ea1cb3f01c8ea1958f16a51adc2b3..e430404b3d7836d622bb45d734b7c9a8a45420a0 100644
--- a/tools/timer/Timer.cpp
+++ b/tools/timer/Timer.cpp
@@ -51,3 +51,14 @@ void WallTimer::start() {
void WallTimer::end() {
fWall = fSysTimer.endWall();
}
+
+SkString HumanizeMs(double ms) {
+ if (ms > 1e+3) return SkStringPrintf("%.3gs", ms/1e3);
+ if (ms < 1e-3) return SkStringPrintf("%.3gns", ms*1e6);
+#ifdef SK_BUILD_FOR_WIN
+ if (ms < 1) return SkStringPrintf("%.3gus", ms*1e3);
+#else
+ if (ms < 1) return SkStringPrintf("%.3gµs", ms*1e3);
+#endif
+ return SkStringPrintf("%.3gms", ms);
+}
« no previous file with comments | « tools/timer/Timer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698