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

Side by Side Diff: components/scheduler/renderer/idle_time_estimator.h

Issue 1411133003: A better idle time estimator (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2526
Patch Set: Created 5 years, 1 month 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 unified diff | Download patch
« no previous file with comments | « components/components_tests.gyp ('k') | components/scheduler/renderer/idle_time_estimator.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef COMPONENTS_SCHEDULER_RENDERER_IDLE_TIME_ESTIMATOR_H_
6 #define COMPONENTS_SCHEDULER_RENDERER_IDLE_TIME_ESTIMATOR_H_
7
8 #include "base/message_loop/message_loop.h"
9 #include "base/time/tick_clock.h"
10 #include "cc/base/rolling_time_delta_history.h"
11 #include "components/scheduler/base/task_queue.h"
12 #include "components/scheduler/scheduler_export.h"
13
14 namespace scheduler {
15
16 // Estimates how much idle time there is available.
17 class SCHEDULER_EXPORT IdleTimeEstimator
18 : public base::MessageLoop::TaskObserver {
19 public:
20 IdleTimeEstimator(const scoped_refptr<TaskQueue>& compositor_task_runner,
21 int sample_count,
22 double estimation_percentile);
23
24 ~IdleTimeEstimator() override;
25
26 // Expected Idle time is defined as: |compositor_frame_interval| minus
27 // expected compositor task duration.
28 base::TimeDelta GetExpectedIdleDuration(
29 base::TimeDelta compositor_frame_interval) const;
30
31 void DidCommitFrameToCompositor();
32
33 void Clear();
34
35 // TaskObserver implementation:
36 void WillProcessTask(const base::PendingTask& pending_task) override;
37 void DidProcessTask(const base::PendingTask& pending_task) override;
38
39 void SetTimeSourceForTesting(scoped_ptr<base::TickClock> time_source);
40
41 private:
42 scoped_refptr<TaskQueue> compositor_task_runner_;
43 cc::RollingTimeDeltaHistory per_frame_compositor_task_runtime_;
44 scoped_ptr<base::TickClock> time_source_;
45 double estimation_percentile_;
46
47 base::TimeTicks task_start_time_;
48 base::TimeTicks prev_commit_time_;
49 base::TimeDelta cumulative_compositor_runtime_;
50 int nesting_level_;
51 bool did_commit_;
52
53 DISALLOW_COPY_AND_ASSIGN(IdleTimeEstimator);
54 };
55
56 } // namespace scheduler
57
58 #endif // COMPONENTS_SCHEDULER_RENDERER_IDLE_TIME_ESTIMATOR_H_
OLDNEW
« no previous file with comments | « components/components_tests.gyp ('k') | components/scheduler/renderer/idle_time_estimator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698