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_RATE_COUNTER_H_ | 5 #ifndef REMOTING_BASE_RATE_COUNTER_H_ |
6 #define REMOTING_BASE_RATE_COUNTER_H_ | 6 #define REMOTING_BASE_RATE_COUNTER_H_ |
7 | 7 |
8 #include <queue> | 8 #include <queue> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/threading/non_thread_safe.h" | 12 #include "base/threading/non_thread_safe.h" |
13 #include "base/time.h" | 13 #include "base/time/time.h" |
14 | 14 |
15 namespace remoting { | 15 namespace remoting { |
16 | 16 |
17 // Measures average rate per second of a sequence of point rate samples | 17 // Measures average rate per second of a sequence of point rate samples |
18 // over a specified time window. This can be used to measure bandwidth, frame | 18 // over a specified time window. This can be used to measure bandwidth, frame |
19 // rates, etc. | 19 // rates, etc. |
20 class RateCounter : public base::NonThreadSafe { | 20 class RateCounter : public base::NonThreadSafe { |
21 public: | 21 public: |
22 // Constructs a rate counter over the specified |time_window|. | 22 // Constructs a rate counter over the specified |time_window|. |
23 explicit RateCounter(base::TimeDelta time_window); | 23 explicit RateCounter(base::TimeDelta time_window); |
(...skipping 30 matching lines...) Expand all Loading... |
54 | 54 |
55 // If set, used to calculate the running average, in place of Now(). | 55 // If set, used to calculate the running average, in place of Now(). |
56 base::Time current_time_for_test_; | 56 base::Time current_time_for_test_; |
57 | 57 |
58 DISALLOW_COPY_AND_ASSIGN(RateCounter); | 58 DISALLOW_COPY_AND_ASSIGN(RateCounter); |
59 }; | 59 }; |
60 | 60 |
61 } // namespace remoting | 61 } // namespace remoting |
62 | 62 |
63 #endif // REMOTING_BASE_RATE_COUNTER_H_ | 63 #endif // REMOTING_BASE_RATE_COUNTER_H_ |
OLD | NEW |