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

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_average.h"
17 #include "remoting/base/running_max.h"
17 18
18 namespace remoting { 19 namespace remoting {
19 20
20 class VideoPacket; 21 class VideoPacket;
21 22
22 namespace protocol { 23 namespace protocol {
23 24
24 // PerformanceTracker defines a bundle of performance counters and statistics 25 // PerformanceTracker defines a bundle of performance counters and statistics
25 // for chromoting. 26 // for chromoting.
26 class PerformanceTracker { 27 class PerformanceTracker {
(...skipping 20 matching lines...) Expand all
47 48
48 // Return rates and running-averages for different metrics. 49 // Return rates and running-averages for different metrics.
49 double video_bandwidth() { return video_bandwidth_.Rate(); } 50 double video_bandwidth() { return video_bandwidth_.Rate(); }
50 double video_frame_rate() { return video_frame_rate_.Rate(); } 51 double video_frame_rate() { return video_frame_rate_.Rate(); }
51 double video_packet_rate() { return video_packet_rate_.Rate(); } 52 double video_packet_rate() { return video_packet_rate_.Rate(); }
52 double video_capture_ms() { return video_capture_ms_.Average(); } 53 double video_capture_ms() { return video_capture_ms_.Average(); }
53 double video_encode_ms() { return video_encode_ms_.Average(); } 54 double video_encode_ms() { return video_encode_ms_.Average(); }
54 double video_decode_ms() { return video_decode_ms_.Average(); } 55 double video_decode_ms() { return video_decode_ms_.Average(); }
55 double video_paint_ms() { return video_paint_ms_.Average(); } 56 double video_paint_ms() { return video_paint_ms_.Average(); }
56 double round_trip_ms() { return round_trip_ms_.Average(); } 57 double round_trip_ms() { return round_trip_ms_.Average(); }
58 double max_round_trip_ms() {
59 return static_cast<double>(max_round_trip_ms_.Max());
60 }
57 61
58 // Record stats for a video-packet. 62 // Record stats for a video-packet.
59 void RecordVideoPacketStats(const VideoPacket& packet); 63 void RecordVideoPacketStats(const VideoPacket& packet);
60 64
61 // Helpers to track decode and paint time. If the render drops some frames 65 // 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 66 // before they are painted then OnFramePainted() records paint time when the
63 // following frame is rendered. OnFramePainted() may be called multiple times, 67 // following frame is rendered. OnFramePainted() may be called multiple times,
64 // in which case all calls after the first one are ignored. 68 // in which case all calls after the first one are ignored.
65 void OnFrameDecoded(int32_t frame_id); 69 void OnFrameDecoded(int32_t frame_id);
66 void OnFramePainted(int32_t frame_id); 70 void OnFramePainted(int32_t frame_id);
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 RateCounter video_packet_rate_; 115 RateCounter video_packet_rate_;
112 116
113 // The following running-averages are uploaded to UMA per video packet and 117 // 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. 118 // also used for display to users, averaged over the N most recent samples.
115 // N = kLatencySampleSize. 119 // N = kLatencySampleSize.
116 RunningAverage video_capture_ms_; 120 RunningAverage video_capture_ms_;
117 RunningAverage video_encode_ms_; 121 RunningAverage video_encode_ms_;
118 RunningAverage video_decode_ms_; 122 RunningAverage video_decode_ms_;
119 RunningAverage video_paint_ms_; 123 RunningAverage video_paint_ms_;
120 RunningAverage round_trip_ms_; 124 RunningAverage round_trip_ms_;
125 RunningMax max_round_trip_ms_;
121 126
122 // Used to update UMA stats, if set. 127 // Used to update UMA stats, if set.
123 UpdateUmaCustomHistogramCallback uma_custom_counts_updater_; 128 UpdateUmaCustomHistogramCallback uma_custom_counts_updater_;
124 UpdateUmaCustomHistogramCallback uma_custom_times_updater_; 129 UpdateUmaCustomHistogramCallback uma_custom_times_updater_;
125 UpdateUmaEnumHistogramCallback uma_enum_histogram_updater_; 130 UpdateUmaEnumHistogramCallback uma_enum_histogram_updater_;
126 131
127 // The latest event timestamp that a VideoPacket was seen annotated with. 132 // The latest event timestamp that a VideoPacket was seen annotated with.
128 base::TimeTicks latest_event_timestamp_; 133 base::TimeTicks latest_event_timestamp_;
129 134
130 // Stores timestamps for the frames that are currently being processed. 135 // Stores timestamps for the frames that are currently being processed.
131 FramesTimestampsMap frame_timestamps_; 136 FramesTimestampsMap frame_timestamps_;
132 137
133 bool is_paused_ = false; 138 bool is_paused_ = false;
134 139
135 base::RepeatingTimer upload_uma_stats_timer_; 140 base::RepeatingTimer upload_uma_stats_timer_;
136 141
137 DISALLOW_COPY_AND_ASSIGN(PerformanceTracker); 142 DISALLOW_COPY_AND_ASSIGN(PerformanceTracker);
138 }; 143 };
139 144
140 } // namespace protocol 145 } // namespace protocol
141 } // namespace remoting 146 } // namespace remoting
142 147
143 #endif // REMOTING_PROTOCOL_PERFORMANCE_TRACKER_H_ 148 #endif // REMOTING_PROTOCOL_PERFORMANCE_TRACKER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698