aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/timer
diff options
context:
space:
mode:
authorGravatar Jim Van Verth <jvanverth@google.com>2017-09-20 12:53:00 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-09-20 17:46:59 +0000
commit32bbf377e67398705dd33e097d94b0e23d9e84db (patch)
tree3b5109688bf67aedef35ddf963accf13a47c2607 /tools/timer
parentf20e77bcb6d3d5aae693bcefa0a5270d5f39890e (diff)
Fix TSAN issue with atlas expansion.
Removes SkString-related malloc from DM crash handler, and adds null check in ProxyRefTest. Bug: skia:3550 Change-Id: I143c532b5d231a426b1a96b854e1effd6379b673 Reviewed-on: https://skia-review.googlesource.com/48440 Reviewed-by: Mike Klein <mtklein@google.com> Reviewed-by: Robert Phillips <robertphillips@google.com> Commit-Queue: Jim Van Verth <jvanverth@google.com>
Diffstat (limited to 'tools/timer')
-rw-r--r--tools/timer/Timer.cpp12
-rw-r--r--tools/timer/Timer.h1
2 files changed, 13 insertions, 0 deletions
diff --git a/tools/timer/Timer.cpp b/tools/timer/Timer.cpp
index 28841cdc84..01ffb96674 100644
--- a/tools/timer/Timer.cpp
+++ b/tools/timer/Timer.cpp
@@ -17,3 +17,15 @@ SkString HumanizeMs(double ms) {
#endif
return SkStringPrintf("%.3gms", ms);
}
+
+int HumanizeMs(char* s, int len, double ms) {
+ if (ms > 60e+3) return snprintf(s, len, "%.3gm", ms / 60e+3);
+ if (ms > 1e+3) return snprintf(s, len, "%.3gs", ms / 1e+3);
+ if (ms < 1e-3) return snprintf(s, len, "%.3gns", ms*1e+6);
+#ifdef SK_BUILD_FOR_WIN
+ if (ms < 1) return snprintf(s, len, "%.3gus", ms*1e+3);
+#else
+ if (ms < 1) return snprintf(s, len, "%.3gµs", ms*1e+3);
+#endif
+ return snprintf(s, len, "%.3gms", ms);
+}
diff --git a/tools/timer/Timer.h b/tools/timer/Timer.h
index 446eb254fd..9b0f7b2b98 100644
--- a/tools/timer/Timer.h
+++ b/tools/timer/Timer.h
@@ -22,5 +22,6 @@ public:
};
SkString HumanizeMs(double);
+int HumanizeMs(char*, int len, double);
#endif