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

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

Issue 1381273002: A better idle time estimator (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 5 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 unified diff | Download patch
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/scheduler_export.h"
12
13 namespace scheduler {
14
15 // Estimates how much idle time there is avaliable.
Sami 2015/10/09 02:32:18 typo: available
alex clarke (OOO till 29th) 2015/10/15 13:24:01 Done.
16 class SCHEDULER_EXPORT IdleTimeEstimator
17 : public base::MessageLoop::TaskObserver {
18 public:
19 IdleTimeEstimator(int sample_count, double estimation_percentile);
Sami 2015/10/09 02:32:18 I think it would be slightly less error prone to p
alex clarke (OOO till 29th) 2015/10/15 13:24:01 Done.
20
21 ~IdleTimeEstimator() override;
22
23 // Expected Idle time is defined as: expected frame duration minus
24 // expected compositor task duration, where the frame duration is clamped to a
25 // meximum of |max_frame_length|.
Sami 2015/10/09 02:32:18 typo: maximum
alex clarke (OOO till 29th) 2015/10/15 13:24:01 Done.
26 base::TimeDelta GetExpectedIdleDuration(
27 base::TimeDelta max_frame_length) const;
28
29 void DidCommitFrameToCompositor();
30
31 void Clear();
32
33 // TaskObserver implementation:
34 void WillProcessTask(const base::PendingTask& pending_task) override;
35 void DidProcessTask(const base::PendingTask& pending_task) override;
36
37 void SetTimeSourceForTesting(scoped_ptr<base::TickClock> time_source);
38
39 private:
40 cc::RollingTimeDeltaHistory frame_length_;
41 cc::RollingTimeDeltaHistory per_frame_compositor_task_runtime_;
42 scoped_ptr<base::TickClock> time_source_;
43 double estimation_percentile_;
44
45 base::TimeTicks task_start_time_;
46 base::TimeTicks prev_commit_time_;
47 base::TimeDelta cumulative_compositor_runtime_;
48 bool did_commit_;
49
50 DISALLOW_COPY_AND_ASSIGN(IdleTimeEstimator);
51 };
52
53 } // namespace scheduler
54
55 #endif // COMPONENTS_SCHEDULER_RENDERER_IDLE_TIME_ESTIMATOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698