Chromium Code Reviews| Index: remoting/base/running_samples.h |
| diff --git a/remoting/base/running_average.h b/remoting/base/running_samples.h |
| similarity index 74% |
| rename from remoting/base/running_average.h |
| rename to remoting/base/running_samples.h |
| index e41234e5957cbb2265e3e6d45d6f62c08b254dbf..0b84091874c41fb8ad2be8c727d71ab478137b19 100644 |
| --- a/remoting/base/running_average.h |
| +++ b/remoting/base/running_samples.h |
| @@ -2,8 +2,8 @@ |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| -#ifndef REMOTING_BASE_RUNNING_AVERAGE_H_ |
| -#define REMOTING_BASE_RUNNING_AVERAGE_H_ |
| +#ifndef REMOTING_BASE_RUNNING_SAMPLES_H_ |
| +#define REMOTING_BASE_RUNNING_SAMPLES_H_ |
| #include <stddef.h> |
| #include <stdint.h> |
| @@ -18,11 +18,11 @@ namespace remoting { |
| // Calculates the average of the most recent N recorded samples. |
|
Sergey Ulanov
2016/03/18 19:42:06
update this comment
Yuwei
2016/03/18 20:05:59
Acknowledged.
|
| // This is typically used to smooth out random variation in point samples |
| // over bandwidth, frame rate, etc. |
| -class RunningAverage { |
| +class RunningSamples { |
| public: |
| // Constructs a helper to average over the |window_size| most recent samples. |
| - explicit RunningAverage(int window_size); |
| - virtual ~RunningAverage(); |
| + explicit RunningSamples(int window_size); |
| + virtual ~RunningSamples(); |
| // Records a point sample. |
| void Record(int64_t value); |
| @@ -30,6 +30,10 @@ class RunningAverage { |
| // Returns the average over up to |window_size| of the most recent samples. |
| double Average(); |
|
Sergey Ulanov
2016/03/18 19:42:06
mark this const.
Yuwei
2016/03/18 20:05:59
Acknowledged.
|
| + // Returns the max over up to |window_size| of the most recent samples. |
| + // 0 if no sample available |
| + int64_t Max(); |
|
Sergey Ulanov
2016/03/18 19:42:06
const
Yuwei
2016/03/18 20:05:59
Acknowledged.
|
| + |
| private: |
| // Stores the desired window size, as size_t to avoid casting when comparing |
| // with the size of |data_points_|. |
| @@ -43,9 +47,9 @@ class RunningAverage { |
| base::ThreadChecker thread_checker_; |
| - DISALLOW_COPY_AND_ASSIGN(RunningAverage); |
| + DISALLOW_COPY_AND_ASSIGN(RunningSamples); |
| }; |
| } // namespace remoting |
| -#endif // REMOTING_BASE_RUNNING_AVERAGE_H_ |
| +#endif // REMOTING_BASE_RUNNING_SAMPLES_H_ |