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 | |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame^] | 10 | #include "include/core/SkString.h" |
| 11 | #include "include/core/SkTime.h" |
| 12 | #include "include/core/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 |