Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(533)

Unified Diff: third_party/WebKit/Source/platform/scheduler/base/thread_load_tracker.h

Issue 2391593002: [scheduler] Change ThreadLoadTracker to use only recent data. (Closed)
Patch Set: Simplified Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/platform/scheduler/base/thread_load_tracker.h
diff --git a/third_party/WebKit/Source/platform/scheduler/base/thread_load_tracker.h b/third_party/WebKit/Source/platform/scheduler/base/thread_load_tracker.h
index 69299f34132cdcfb80d185c0ab3168dab08c895d..b12bb34b26ca886413f04a617bbea7871e783e4e 100644
--- a/third_party/WebKit/Source/platform/scheduler/base/thread_load_tracker.h
+++ b/third_party/WebKit/Source/platform/scheduler/base/thread_load_tracker.h
@@ -5,6 +5,8 @@
#ifndef THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_RENDERER_RENDERER_LOAD_TRACKER_H_
#define THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_RENDERER_RENDERER_LOAD_TRACKER_H_
+#include <queue>
alex clarke (OOO till 29th) 2016/10/05 15:25:23 Looks like this is no longer used.
altimin 2016/10/05 16:26:56 Done.
+
#include "base/callback.h"
#include "base/macros.h"
#include "base/time/time.h"
@@ -16,6 +18,8 @@ namespace scheduler {
// This class tracks thread load level, i.e. percentage of wall time spent
// running tasks.
// In order to avoid bias it reports load level at regular intervals.
+// It reports every |reporting_interval_| average thread load level in
alex clarke (OOO till 29th) 2016/10/05 15:25:23 Every |reporting_interval_| time units, it reports
altimin 2016/10/05 16:26:56 Done.
+// sliding window of |reporting_interval_| width.
class BLINK_PLATFORM_EXPORT ThreadLoadTracker {
public:
// Callback is called with (current_time, load_level) parameters.
@@ -47,17 +51,21 @@ class BLINK_PLATFORM_EXPORT ThreadLoadTracker {
// |time_| is the last timestamp LoadTracker knows about.
base::TimeTicks time_;
base::TimeTicks next_reporting_time_;
+ // Total period for which this LoadTracker was active. Needed to discard
+ // first |waiting_period_| time.
+ base::TimeDelta recorded_time_;
Sami 2016/10/05 15:28:13 Would |active_time_| or maybe |total_active_time_|
altimin 2016/10/05 16:26:56 Done.
ThreadState thread_state_;
base::TimeTicks last_state_change_time_;
- base::TimeDelta total_time_;
- base::TimeDelta total_runtime_;
-
// Start reporting values after |waiting_period_|.
base::TimeDelta waiting_period_;
base::TimeDelta reporting_interval_;
+ // Recorded run time in bucket
Sami 2016/10/05 15:28:13 s/bucket/window./? (Just wanted to avoid mixing th
altimin 2016/10/05 16:26:56 Done.
+ // [next_reporting_time - reporting_interval, next_reporting_time].
+ base::TimeDelta run_time_inside_window_;
+
Callback callback_;
DISALLOW_COPY_AND_ASSIGN(ThreadLoadTracker);

Powered by Google App Engine
This is Rietveld 408576698