| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef Histogram_h | 5 #ifndef Histogram_h |
| 6 #define Histogram_h | 6 #define Histogram_h |
| 7 | 7 |
| 8 #include "base/metrics/histogram_base.h" | 8 #include "base/metrics/histogram_base.h" |
| 9 #include "platform/PlatformExport.h" | 9 #include "platform/PlatformExport.h" |
| 10 #include "wtf/CurrentTime.h" | 10 #include "wtf/CurrentTime.h" |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 m_counter.count((WTF::monotonicallyIncreasingTime() - m_startTime) * | 60 m_counter.count((WTF::monotonicallyIncreasingTime() - m_startTime) * |
| 61 base::Time::kMicrosecondsPerSecond); | 61 base::Time::kMicrosecondsPerSecond); |
| 62 } | 62 } |
| 63 | 63 |
| 64 private: | 64 private: |
| 65 // In seconds. | 65 // In seconds. |
| 66 double m_startTime; | 66 double m_startTime; |
| 67 CustomCountHistogram& m_counter; | 67 CustomCountHistogram& m_counter; |
| 68 }; | 68 }; |
| 69 | 69 |
| 70 // Use code like this to record time, in microseconds, to execute a block of cod
e: | 70 // Use code like this to record time, in microseconds, to execute a block of |
| 71 // code: |
| 71 // | 72 // |
| 72 // { | 73 // { |
| 73 // SCOPED_BLINK_UMA_HISTOGRAM_TIMER(myUmaStatName) | 74 // SCOPED_BLINK_UMA_HISTOGRAM_TIMER(myUmaStatName) |
| 74 // RunMyCode(); | 75 // RunMyCode(); |
| 75 // } | 76 // } |
| 76 // This macro records all times between 0us and 10 seconds. | 77 // This macro records all times between 0us and 10 seconds. |
| 77 // Do not change this macro without renaming all metrics that use it! | 78 // Do not change this macro without renaming all metrics that use it! |
| 78 #define SCOPED_BLINK_UMA_HISTOGRAM_TIMER(name) \ | 79 #define SCOPED_BLINK_UMA_HISTOGRAM_TIMER(name) \ |
| 79 DEFINE_STATIC_LOCAL(CustomCountHistogram, scopedUsCounter, \ | 80 DEFINE_STATIC_LOCAL(CustomCountHistogram, scopedUsCounter, \ |
| 80 (name, 0, 10000000, 50)); \ | 81 (name, 0, 10000000, 50)); \ |
| 81 ScopedUsHistogramTimer timer(scopedUsCounter); | 82 ScopedUsHistogramTimer timer(scopedUsCounter); |
| 82 | 83 |
| 83 } // namespace blink | 84 } // namespace blink |
| 84 | 85 |
| 85 #endif // Histogram_h | 86 #endif // Histogram_h |
| OLD | NEW |