| 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 THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_RENDERER_RENDERER_LOAD_TRAC
KER_H_ | 5 #ifndef THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_RENDERER_RENDERER_LOAD_TRAC
KER_H_ |
| 6 #define THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_RENDERER_RENDERER_LOAD_TRAC
KER_H_ | 6 #define THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_RENDERER_RENDERER_LOAD_TRAC
KER_H_ |
| 7 | 7 |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
| 11 #include "public/platform/WebCommon.h" | 11 #include "platform/PlatformExport.h" |
| 12 | 12 |
| 13 namespace blink { | 13 namespace blink { |
| 14 namespace scheduler { | 14 namespace scheduler { |
| 15 | 15 |
| 16 // This class tracks thread load level, i.e. percentage of wall time spent | 16 // This class tracks thread load level, i.e. percentage of wall time spent |
| 17 // running tasks. | 17 // running tasks. |
| 18 // In order to avoid bias it reports load level at regular intervals. | 18 // In order to avoid bias it reports load level at regular intervals. |
| 19 // Every |reporting_interval_| time units, it reports the average thread load | 19 // Every |reporting_interval_| time units, it reports the average thread load |
| 20 // level computed using a sliding window of width |reporting_interval_|. | 20 // level computed using a sliding window of width |reporting_interval_|. |
| 21 class BLINK_PLATFORM_EXPORT ThreadLoadTracker { | 21 class PLATFORM_EXPORT ThreadLoadTracker { |
| 22 public: | 22 public: |
| 23 // Callback is called with (current_time, load_level) parameters. | 23 // Callback is called with (current_time, load_level) parameters. |
| 24 using Callback = base::Callback<void(base::TimeTicks, double)>; | 24 using Callback = base::Callback<void(base::TimeTicks, double)>; |
| 25 | 25 |
| 26 ThreadLoadTracker(base::TimeTicks now, | 26 ThreadLoadTracker(base::TimeTicks now, |
| 27 const Callback& callback, | 27 const Callback& callback, |
| 28 base::TimeDelta reporting_interval, | 28 base::TimeDelta reporting_interval, |
| 29 base::TimeDelta waiting_period); | 29 base::TimeDelta waiting_period); |
| 30 ~ThreadLoadTracker(); | 30 ~ThreadLoadTracker(); |
| 31 | 31 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 | 69 |
| 70 Callback callback_; | 70 Callback callback_; |
| 71 | 71 |
| 72 DISALLOW_COPY_AND_ASSIGN(ThreadLoadTracker); | 72 DISALLOW_COPY_AND_ASSIGN(ThreadLoadTracker); |
| 73 }; | 73 }; |
| 74 | 74 |
| 75 } // namespace scheduler | 75 } // namespace scheduler |
| 76 } // namespace blink | 76 } // namespace blink |
| 77 | 77 |
| 78 #endif // THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_RENDERER_RENDERER_LOAD_T
RACKER_H_ | 78 #endif // THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_RENDERER_RENDERER_LOAD_T
RACKER_H_ |
| OLD | NEW |