Chromium Code Reviews| 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 // ChromotingStats defines a bundle of performance counters and statistics | 5 // ChromotingStats defines a bundle of performance counters and statistics |
| 6 // for chromoting. | 6 // for chromoting. |
| 7 | 7 |
| 8 #ifndef REMOTING_CLIENT_CHROMOTING_STATS_H_ | 8 #ifndef REMOTING_CLIENT_CHROMOTING_STATS_H_ |
| 9 #define REMOTING_CLIENT_CHROMOTING_STATS_H_ | 9 #define REMOTING_CLIENT_CHROMOTING_STATS_H_ |
| 10 | 10 |
| 11 #include "remoting/base/rate_counter.h" | 11 #include "remoting/base/rate_counter.h" |
| 12 #include "remoting/base/running_average.h" | 12 #include "remoting/base/running_average.h" |
| 13 | 13 |
| 14 namespace remoting { | 14 namespace remoting { |
| 15 | 15 |
| 16 class ChromotingStats { | 16 class ChromotingStats { |
| 17 public: | 17 public: |
| 18 ChromotingStats(); | 18 ChromotingStats(); |
| 19 virtual ~ChromotingStats(); | 19 virtual ~ChromotingStats(); |
| 20 | 20 |
| 21 RateCounter* video_bandwidth() { return &video_bandwidth_; } | 21 // Window for UMA stats updates and rate-counters. |
| 22 RateCounter* video_frame_rate() { return &video_frame_rate_; } | 22 const int kUMAStatsTimeWindowInSeconds = 1; |
|
Sergey Ulanov
2015/07/08 20:06:47
declare these are static const.
anandc
2015/07/08 22:43:34
Done.
| |
| 23 // The time-window for display-stats rate-counters. | |
| 24 const int kDisplayStatsRateWindowInSeconds = 3; | |
| 25 // The time interval for updating display stats. | |
| 26 const int kDisplayStatsUpdateWindowInSeconds = 60; | |
| 27 | |
| 28 // The following 2 metrics are used in the stats captured every 60s for | |
| 29 // display to users. | |
| 30 // Bytes/sec for non-empty packets, measured over a 1s time-window. | |
| 31 RateCounter* video_bandwidth_display() { return &video_bandwidth_display_; } | |
| 32 // frames/sec for non-empty video-packets, measured over a 1s time-window. | |
| 33 RateCounter* video_frame_rate_display() { return &video_frame_rate_display_; } | |
| 34 | |
| 35 // The next 3 metrics are used to record statistics for upload to UMA. | |
| 36 // Bytes/sec for non-empty video-packets, measured over a 1s time-window. | |
| 37 RateCounter* video_bandwidth_uma() { return &video_bandwidth_uma_; } | |
| 38 // frames/sec for non-empty video-packets, measured over a 1s time-window. | |
| 39 RateCounter* video_frame_rate_uma() { return &video_frame_rate_uma_; } | |
| 40 // packets/sec, including empty video-packets, measured over a 1s time-window. | |
| 41 | |
| 42 RateCounter* video_packet_rate_uma() { return &video_packet_rate_uma_; } | |
| 43 | |
| 44 // The following metrics report averages calculated when updating stats. | |
| 45 // For UMA, the updates occur every second. For stats shown to users, they are | |
| 46 // updated every 60s. | |
| 47 // Time to capture video. | |
| 23 RunningAverage* video_capture_ms() { return &video_capture_ms_; } | 48 RunningAverage* video_capture_ms() { return &video_capture_ms_; } |
| 49 // Time to encode a captured video-packet. | |
| 24 RunningAverage* video_encode_ms() { return &video_encode_ms_; } | 50 RunningAverage* video_encode_ms() { return &video_encode_ms_; } |
| 51 // Time to decode a video-packet. | |
| 25 RunningAverage* video_decode_ms() { return &video_decode_ms_; } | 52 RunningAverage* video_decode_ms() { return &video_decode_ms_; } |
| 53 // Time to paint, if there is a picture to paint or on force-repaint. | |
| 26 RunningAverage* video_paint_ms() { return &video_paint_ms_; } | 54 RunningAverage* video_paint_ms() { return &video_paint_ms_; } |
| 55 // Round-trip latency. | |
| 27 RunningAverage* round_trip_ms() { return &round_trip_ms_; } | 56 RunningAverage* round_trip_ms() { return &round_trip_ms_; } |
| 28 | 57 |
| 29 private: | 58 private: |
| 30 RateCounter video_bandwidth_; | 59 RateCounter video_bandwidth_display_; |
| 31 RateCounter video_frame_rate_; | 60 RateCounter video_frame_rate_display_; |
| 61 RateCounter video_bandwidth_uma_; | |
| 62 RateCounter video_frame_rate_uma_; | |
| 63 RateCounter video_packet_rate_uma_; | |
| 32 RunningAverage video_capture_ms_; | 64 RunningAverage video_capture_ms_; |
| 33 RunningAverage video_encode_ms_; | 65 RunningAverage video_encode_ms_; |
| 34 RunningAverage video_decode_ms_; | 66 RunningAverage video_decode_ms_; |
| 35 RunningAverage video_paint_ms_; | 67 RunningAverage video_paint_ms_; |
| 36 RunningAverage round_trip_ms_; | 68 RunningAverage round_trip_ms_; |
| 37 | 69 |
| 38 DISALLOW_COPY_AND_ASSIGN(ChromotingStats); | 70 DISALLOW_COPY_AND_ASSIGN(ChromotingStats); |
| 39 }; | 71 }; |
| 40 | 72 |
| 41 } // namespace remoting | 73 } // namespace remoting |
| 42 | 74 |
| 43 #endif // REMOTING_CLIENT_CHROMOTING_STATS_H_ | 75 #endif // REMOTING_CLIENT_CHROMOTING_STATS_H_ |
| OLD | NEW |