Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(120)

Side by Side Diff: remoting/protocol/performance_tracker.h

Issue 1811833002: Show max latency on client's status bar (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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_PROTOCOL_PERFORMANCE_TRACKER_H_ 5 #ifndef REMOTING_PROTOCOL_PERFORMANCE_TRACKER_H_
6 #define REMOTING_PROTOCOL_PERFORMANCE_TRACKER_H_ 6 #define REMOTING_PROTOCOL_PERFORMANCE_TRACKER_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <map> 10 #include <map>
11 11
12 #include "base/callback.h" 12 #include "base/callback.h"
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "base/timer/timer.h" 14 #include "base/timer/timer.h"
15 #include "remoting/base/rate_counter.h" 15 #include "remoting/base/rate_counter.h"
16 #include "remoting/base/running_average.h" 16 #include "remoting/base/running_samples.h"
17 17
18 namespace remoting { 18 namespace remoting {
19 19
20 class VideoPacket; 20 class VideoPacket;
21 21
22 namespace protocol { 22 namespace protocol {
23 23
24 // PerformanceTracker defines a bundle of performance counters and statistics 24 // PerformanceTracker defines a bundle of performance counters and statistics
25 // for chromoting. 25 // for chromoting.
26 class PerformanceTracker { 26 class PerformanceTracker {
(...skipping 21 matching lines...) Expand all
48 // Return rates and running-averages for different metrics. 48 // Return rates and running-averages for different metrics.
49 double video_bandwidth() { return video_bandwidth_.Rate(); } 49 double video_bandwidth() { return video_bandwidth_.Rate(); }
50 double video_frame_rate() { return video_frame_rate_.Rate(); } 50 double video_frame_rate() { return video_frame_rate_.Rate(); }
51 double video_packet_rate() { return video_packet_rate_.Rate(); } 51 double video_packet_rate() { return video_packet_rate_.Rate(); }
52 double video_capture_ms() { return video_capture_ms_.Average(); } 52 double video_capture_ms() { return video_capture_ms_.Average(); }
53 double video_encode_ms() { return video_encode_ms_.Average(); } 53 double video_encode_ms() { return video_encode_ms_.Average(); }
54 double video_decode_ms() { return video_decode_ms_.Average(); } 54 double video_decode_ms() { return video_decode_ms_.Average(); }
55 double video_paint_ms() { return video_paint_ms_.Average(); } 55 double video_paint_ms() { return video_paint_ms_.Average(); }
56 double round_trip_ms() { return round_trip_ms_.Average(); } 56 double round_trip_ms() { return round_trip_ms_.Average(); }
57 57
58 // Return running-maxes for latencies
59 int64_t max_video_capture_ms() { return video_capture_ms_.Max(); }
Sergey Ulanov 2016/03/18 19:42:06 Update the functions above to return RunningSample
Yuwei 2016/03/18 20:06:00 Acknowledged.
60 int64_t max_video_encode_ms() { return video_encode_ms_.Max(); }
61 int64_t max_video_decode_ms() { return video_decode_ms_.Max(); }
62 int64_t max_video_paint_ms() { return video_paint_ms_.Max(); }
63 int64_t max_round_trip_ms() { return round_trip_ms_.Max(); }
64
58 // Record stats for a video-packet. 65 // Record stats for a video-packet.
59 void RecordVideoPacketStats(const VideoPacket& packet); 66 void RecordVideoPacketStats(const VideoPacket& packet);
60 67
61 // Helpers to track decode and paint time. If the render drops some frames 68 // Helpers to track decode and paint time. If the render drops some frames
62 // before they are painted then OnFramePainted() records paint time when the 69 // before they are painted then OnFramePainted() records paint time when the
63 // following frame is rendered. OnFramePainted() may be called multiple times, 70 // following frame is rendered. OnFramePainted() may be called multiple times,
64 // in which case all calls after the first one are ignored. 71 // in which case all calls after the first one are ignored.
65 void OnFrameDecoded(int32_t frame_id); 72 void OnFrameDecoded(int32_t frame_id);
66 void OnFramePainted(int32_t frame_id); 73 void OnFramePainted(int32_t frame_id);
67 74
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 113
107 // Video packets per second, including empty video-packets. 114 // Video packets per second, including empty video-packets.
108 // This will be greater than the frame rate, as individual frames are 115 // This will be greater than the frame rate, as individual frames are
109 // contained in packets, some of which might be empty (e.g. when there are no 116 // contained in packets, some of which might be empty (e.g. when there are no
110 // screen changes). 117 // screen changes).
111 RateCounter video_packet_rate_; 118 RateCounter video_packet_rate_;
112 119
113 // The following running-averages are uploaded to UMA per video packet and 120 // The following running-averages are uploaded to UMA per video packet and
114 // also used for display to users, averaged over the N most recent samples. 121 // also used for display to users, averaged over the N most recent samples.
115 // N = kLatencySampleSize. 122 // N = kLatencySampleSize.
116 RunningAverage video_capture_ms_; 123 RunningSamples video_capture_ms_;
117 RunningAverage video_encode_ms_; 124 RunningSamples video_encode_ms_;
118 RunningAverage video_decode_ms_; 125 RunningSamples video_decode_ms_;
119 RunningAverage video_paint_ms_; 126 RunningSamples video_paint_ms_;
120 RunningAverage round_trip_ms_; 127 RunningSamples round_trip_ms_;
121 128
122 // Used to update UMA stats, if set. 129 // Used to update UMA stats, if set.
123 UpdateUmaCustomHistogramCallback uma_custom_counts_updater_; 130 UpdateUmaCustomHistogramCallback uma_custom_counts_updater_;
124 UpdateUmaCustomHistogramCallback uma_custom_times_updater_; 131 UpdateUmaCustomHistogramCallback uma_custom_times_updater_;
125 UpdateUmaEnumHistogramCallback uma_enum_histogram_updater_; 132 UpdateUmaEnumHistogramCallback uma_enum_histogram_updater_;
126 133
127 // The latest event timestamp that a VideoPacket was seen annotated with. 134 // The latest event timestamp that a VideoPacket was seen annotated with.
128 base::TimeTicks latest_event_timestamp_; 135 base::TimeTicks latest_event_timestamp_;
129 136
130 // Stores timestamps for the frames that are currently being processed. 137 // Stores timestamps for the frames that are currently being processed.
131 FramesTimestampsMap frame_timestamps_; 138 FramesTimestampsMap frame_timestamps_;
132 139
133 bool is_paused_ = false; 140 bool is_paused_ = false;
134 141
135 base::RepeatingTimer upload_uma_stats_timer_; 142 base::RepeatingTimer upload_uma_stats_timer_;
136 143
137 DISALLOW_COPY_AND_ASSIGN(PerformanceTracker); 144 DISALLOW_COPY_AND_ASSIGN(PerformanceTracker);
138 }; 145 };
139 146
140 } // namespace protocol 147 } // namespace protocol
141 } // namespace remoting 148 } // namespace remoting
142 149
143 #endif // REMOTING_PROTOCOL_PERFORMANCE_TRACKER_H_ 150 #endif // REMOTING_PROTOCOL_PERFORMANCE_TRACKER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698