OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2011 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 // This class chooses a capture interval so as to limit CPU usage to not exceed |
| 6 // a specified %age. It bases this on the CPU usage of recent capture and encode |
| 7 // operations, and on the number of available CPUs. |
| 8 |
| 9 #ifndef REMOTING_HOST_CAPTURE_SCHEDULER_H_ |
| 10 #define REMOTING_HOST_CAPTURE_SCHEDULER_H_ |
| 11 |
| 12 #include "base/time.h" |
| 13 #include "remoting/base/running_average.h" |
| 14 |
| 15 namespace remoting { |
| 16 |
| 17 class CaptureScheduler { |
| 18 public: |
| 19 CaptureScheduler(); |
| 20 ~CaptureScheduler(); |
| 21 |
| 22 // Determine the time delay from current time to perform next capture. |
| 23 base::TimeDelta NextCaptureDelay(); |
| 24 |
| 25 // Record time spent on capturing and encoding. |
| 26 void RecordCaptureTime(base::TimeDelta capture_time); |
| 27 void RecordEncodeTime(base::TimeDelta encode_time); |
| 28 |
| 29 private: |
| 30 int num_of_processors_; |
| 31 RunningAverage capture_time_; |
| 32 RunningAverage encode_time_; |
| 33 |
| 34 DISALLOW_COPY_AND_ASSIGN(CaptureScheduler); |
| 35 }; |
| 36 |
| 37 } // namespace remoting |
| 38 |
| 39 #endif // REMOTING_HOST_CAPTURE_SCHEDULER_H_ |
OLD | NEW |