Upstreaming browser/ui/uikit_ui_util from iOS.
[chromium-blink-merge.git] / remoting / client / chromoting_stats.h
blob28260349119e2008be2f98090562a23875a2e436
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.
5 // ChromotingStats defines a bundle of performance counters and statistics
6 // for chromoting.
8 #ifndef REMOTING_CLIENT_CHROMOTING_STATS_H_
9 #define REMOTING_CLIENT_CHROMOTING_STATS_H_
11 #include "remoting/base/rate_counter.h"
12 #include "remoting/base/running_average.h"
14 namespace remoting {
16 class ChromotingStats {
17 public:
18 ChromotingStats();
19 virtual ~ChromotingStats();
21 // Constant used to calculate the average for rate metrics and used by the
22 // plugin for the frequency at which stats should be updated.
23 static const int kStatsUpdateFrequencyInSeconds = 1;
25 // The video and packet rate metrics below are updated per video packet
26 // received and then, for reporting, averaged over a 1s time-window.
27 // Bytes per second for non-empty video-packets.
28 RateCounter* video_bandwidth() { return &video_bandwidth_; }
30 // Frames per second for non-empty video-packets.
31 RateCounter* video_frame_rate() { return &video_frame_rate_; }
33 // Video packets per second, including empty video-packets.
34 // This will be greater than the frame rate, as individual frames are
35 // contained in packets, some of which might be empty (e.g. when there are no
36 // screen changes).
37 RateCounter* video_packet_rate() { return &video_packet_rate_; }
39 // The latency metrics below are recorded per video packet received and, for
40 // reporting, averaged over the N most recent samples.
41 // N is defined by kLatencySampleSize.
42 RunningAverage* video_capture_ms() { return &video_capture_ms_; }
43 RunningAverage* video_encode_ms() { return &video_encode_ms_; }
44 RunningAverage* video_decode_ms() { return &video_decode_ms_; }
45 RunningAverage* video_paint_ms() { return &video_paint_ms_; }
46 RunningAverage* round_trip_ms() { return &round_trip_ms_; }
48 private:
49 RateCounter video_bandwidth_;
50 RateCounter video_frame_rate_;
51 RateCounter video_packet_rate_;
52 RunningAverage video_capture_ms_;
53 RunningAverage video_encode_ms_;
54 RunningAverage video_decode_ms_;
55 RunningAverage video_paint_ms_;
56 RunningAverage round_trip_ms_;
58 DISALLOW_COPY_AND_ASSIGN(ChromotingStats);
61 } // namespace remoting
63 #endif // REMOTING_CLIENT_CHROMOTING_STATS_H_