Chromium Code Reviews| Index: include/core/SkTime.h |
| diff --git a/include/core/SkTime.h b/include/core/SkTime.h |
| index 3ff29aa25e1d2f70474975ae1af2a459e5b9564e..8a8224a82a564437c58c3a3b313e53e28cbdf985 100644 |
| --- a/include/core/SkTime.h |
| +++ b/include/core/SkTime.h |
| @@ -34,34 +34,27 @@ public: |
| }; |
| static void GetDateTime(DateTime*); |
| - static SkMSec GetMSecs() { return (SkMSec)(GetNSecs() * 1e-6); } |
| + static double GetSecs() { return GetNSecs() * 1e-9; } |
|
mtklein
2016/03/22 13:35:40
Didn't catch anywhere this was used?
dogben
2016/03/22 17:12:51
It's used in src/views/SkTouchGesture.cpp, but I'm
|
| + static double GetMSecs() { return GetNSecs() * 1e-6; } |
| static double GetNSecs(); |
| }; |
| -#define SK_TIME_FACTOR 1 |
| - |
| /////////////////////////////////////////////////////////////////////////////// |
| class SkAutoTime { |
| public: |
| // The label is not deep-copied, so its address must remain valid for the |
| // lifetime of this object |
| - SkAutoTime(const char* label = NULL, SkMSec minToDump = 0) : fLabel(label) |
| - { |
| - fNow = SkTime::GetMSecs(); |
| - fMinToDump = minToDump; |
| - } |
| - ~SkAutoTime() |
| - { |
| - SkMSec dur = SkTime::GetMSecs() - fNow; |
| - if (dur >= fMinToDump) { |
| - SkDebugf("%s %d\n", fLabel ? fLabel : "", dur); |
| - } |
| + SkAutoTime(const char* label = nullptr) |
| + : fLabel(label) |
| + , fNow(SkTime::GetMSecs()) {} |
| + ~SkAutoTime() { |
| + uint64_t dur = static_cast<uint64_t>(SkTime::GetMSecs() - fNow); |
| + SkDebugf("%s %ld\n", fLabel ? fLabel : "", dur); |
| } |
| private: |
| const char* fLabel; |
| - SkMSec fNow; |
| - SkMSec fMinToDump; |
| + double fNow; |
| }; |
| #define SkAutoTime(...) SK_REQUIRE_LOCAL_VAR(SkAutoTime) |