OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 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 REMOTING_BASE_RUNNING_AVERAGE_H_ | 5 #ifndef REMOTING_BASE_RUNNING_AVERAGE_H_ |
6 #define REMOTING_BASE_RUNNING_AVERAGE_H_ | 6 #define REMOTING_BASE_RUNNING_AVERAGE_H_ |
7 | 7 |
| 8 #include <stddef.h> |
| 9 #include <stdint.h> |
| 10 |
8 #include <deque> | 11 #include <deque> |
9 | 12 |
10 #include "base/basictypes.h" | 13 #include "base/macros.h" |
11 #include "base/threading/thread_checker.h" | 14 #include "base/threading/thread_checker.h" |
12 | 15 |
13 namespace remoting { | 16 namespace remoting { |
14 | 17 |
15 // Calculates the average of the most recent N recorded samples. | 18 // Calculates the average of the most recent N recorded samples. |
16 // This is typically used to smooth out random variation in point samples | 19 // This is typically used to smooth out random variation in point samples |
17 // over bandwidth, frame rate, etc. | 20 // over bandwidth, frame rate, etc. |
18 class RunningAverage { | 21 class RunningAverage { |
19 public: | 22 public: |
20 // Constructs a helper to average over the |window_size| most recent samples. | 23 // Constructs a helper to average over the |window_size| most recent samples. |
(...skipping 18 matching lines...) Expand all Loading... |
39 int64_t sum_; | 42 int64_t sum_; |
40 | 43 |
41 base::ThreadChecker thread_checker_; | 44 base::ThreadChecker thread_checker_; |
42 | 45 |
43 DISALLOW_COPY_AND_ASSIGN(RunningAverage); | 46 DISALLOW_COPY_AND_ASSIGN(RunningAverage); |
44 }; | 47 }; |
45 | 48 |
46 } // namespace remoting | 49 } // namespace remoting |
47 | 50 |
48 #endif // REMOTING_BASE_RUNNING_AVERAGE_H_ | 51 #endif // REMOTING_BASE_RUNNING_AVERAGE_H_ |
OLD | NEW |