OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 #include "Timer.h" | 7 #include "Timer.h" |
8 | 8 |
9 Timer::Timer(SkGLContext* gl) | 9 Timer::Timer(SkGLContext* gl) |
10 : fCpu(-1.0) | 10 : fCpu(-1.0) |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 | 46 |
47 void WallTimer::start() { | 47 void WallTimer::start() { |
48 fSysTimer.startWall(); | 48 fSysTimer.startWall(); |
49 } | 49 } |
50 | 50 |
51 void WallTimer::end() { | 51 void WallTimer::end() { |
52 fWall = fSysTimer.endWall(); | 52 fWall = fSysTimer.endWall(); |
53 } | 53 } |
54 | 54 |
55 SkString HumanizeMs(double ms) { | 55 SkString HumanizeMs(double ms) { |
56 if (ms > 1e+3) return SkStringPrintf("%.3gs", ms/1e3); | 56 if (ms > 60e+3) return SkStringPrintf("%.3gm", ms/60e+3); |
57 if (ms < 1e-3) return SkStringPrintf("%.3gns", ms*1e6); | 57 if (ms > 1e+3) return SkStringPrintf("%.3gs", ms/1e+3); |
| 58 if (ms < 1e-3) return SkStringPrintf("%.3gns", ms*1e+6); |
58 #ifdef SK_BUILD_FOR_WIN | 59 #ifdef SK_BUILD_FOR_WIN |
59 if (ms < 1) return SkStringPrintf("%.3gus", ms*1e3); | 60 if (ms < 1) return SkStringPrintf("%.3gus", ms*1e+3); |
60 #else | 61 #else |
61 if (ms < 1) return SkStringPrintf("%.3gµs", ms*1e3); | 62 if (ms < 1) return SkStringPrintf("%.3gµs", ms*1e+3); |
62 #endif | 63 #endif |
63 return SkStringPrintf("%.3gms", ms); | 64 return SkStringPrintf("%.3gms", ms); |
64 } | 65 } |
OLD | NEW |