| mtklein | 9ac68ee | 2014-06-20 11:29:20 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2011 Google Inc. | ||||
| 3 | * | ||||
| 4 | * Use of this source code is governed by a BSD-style license that can be | ||||
| 5 | * found in the LICENSE file. | ||||
| 6 | */ | ||||
| 7 | #ifndef Timer_DEFINED | ||||
| 8 | #define Timer_DEFINED | ||||
| 9 | |||||
| mtklein | 3b5b784 | 2015-10-23 06:40:33 -0700 | [diff] [blame] | 10 | #include "SkString.h" |
| mtklein | 33eefcd | 2015-10-23 07:02:06 -0700 | [diff] [blame] | 11 | #include "SkTime.h" |
| 12 | #include "SkTypes.h" | ||||
| mtklein | 9ac68ee | 2014-06-20 11:29:20 -0700 | [diff] [blame] | 13 | |
| mtklein | 9ac68ee | 2014-06-20 11:29:20 -0700 | [diff] [blame] | 14 | class WallTimer { |
| 15 | public: | ||||
| mtklein | 33eefcd | 2015-10-23 07:02:06 -0700 | [diff] [blame] | 16 | WallTimer() : fWall(-1) {} |
| mtklein | 9ac68ee | 2014-06-20 11:29:20 -0700 | [diff] [blame] | 17 | |
| mtklein | 33eefcd | 2015-10-23 07:02:06 -0700 | [diff] [blame] | 18 | void start() { fWall = SkTime::GetNSecs(); } |
| 19 | void end() { fWall = (SkTime::GetNSecs() - fWall) * 1e-6; } | ||||
| mtklein | 9ac68ee | 2014-06-20 11:29:20 -0700 | [diff] [blame] | 20 | |
| 21 | double fWall; // Milliseconds. | ||||
| mtklein | 9ac68ee | 2014-06-20 11:29:20 -0700 | [diff] [blame] | 22 | }; |
| 23 | |||||
| mtklein | 748ca3b | 2015-01-15 10:56:12 -0800 | [diff] [blame] | 24 | SkString HumanizeMs(double); |
| 25 | |||||
| mtklein | 9ac68ee | 2014-06-20 11:29:20 -0700 | [diff] [blame] | 26 | #endif |