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

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

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 #include "remoting/protocol/performance_tracker.h" 5 #include "remoting/protocol/performance_tracker.h"
6 6
7 #include "remoting/proto/video.pb.h" 7 #include "remoting/proto/video.pb.h"
8 8
9 namespace { 9 namespace {
10 10
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 PerformanceTracker::PerformanceTracker() 83 PerformanceTracker::PerformanceTracker()
84 : video_bandwidth_(base::TimeDelta::FromSeconds(kStatsUpdatePeriodSeconds)), 84 : video_bandwidth_(base::TimeDelta::FromSeconds(kStatsUpdatePeriodSeconds)),
85 video_frame_rate_( 85 video_frame_rate_(
86 base::TimeDelta::FromSeconds(kStatsUpdatePeriodSeconds)), 86 base::TimeDelta::FromSeconds(kStatsUpdatePeriodSeconds)),
87 video_packet_rate_( 87 video_packet_rate_(
88 base::TimeDelta::FromSeconds(kStatsUpdatePeriodSeconds)), 88 base::TimeDelta::FromSeconds(kStatsUpdatePeriodSeconds)),
89 video_capture_ms_(kLatencySampleSize), 89 video_capture_ms_(kLatencySampleSize),
90 video_encode_ms_(kLatencySampleSize), 90 video_encode_ms_(kLatencySampleSize),
91 video_decode_ms_(kLatencySampleSize), 91 video_decode_ms_(kLatencySampleSize),
92 video_paint_ms_(kLatencySampleSize), 92 video_paint_ms_(kLatencySampleSize),
93 round_trip_ms_(kLatencySampleSize) { 93 round_trip_ms_(kLatencySampleSize),
94 max_round_trip_ms_(kLatencySampleSize) {
94 uma_custom_counts_updater_ = base::Bind(&UpdateUmaCustomHistogramStub); 95 uma_custom_counts_updater_ = base::Bind(&UpdateUmaCustomHistogramStub);
95 uma_custom_times_updater_ = base::Bind(&UpdateUmaCustomHistogramStub); 96 uma_custom_times_updater_ = base::Bind(&UpdateUmaCustomHistogramStub);
96 uma_enum_histogram_updater_ = base::Bind(&UpdateUmaEnumHistogramStub); 97 uma_enum_histogram_updater_ = base::Bind(&UpdateUmaEnumHistogramStub);
97 } 98 }
98 99
99 PerformanceTracker::~PerformanceTracker() {} 100 PerformanceTracker::~PerformanceTracker() {}
100 101
101 void PerformanceTracker::SetUpdateUmaCallbacks( 102 void PerformanceTracker::SetUpdateUmaCallbacks(
102 UpdateUmaCustomHistogramCallback update_uma_custom_counts_callback, 103 UpdateUmaCustomHistogramCallback update_uma_custom_counts_callback,
103 UpdateUmaCustomHistogramCallback update_uma_custom_times_callback, 104 UpdateUmaCustomHistogramCallback update_uma_custom_times_callback,
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 void PerformanceTracker::RecordRoundTripLatency( 248 void PerformanceTracker::RecordRoundTripLatency(
248 const FrameTimestamps& timestamps) { 249 const FrameTimestamps& timestamps) {
249 if (timestamps.latest_event_timestamp.is_null()) 250 if (timestamps.latest_event_timestamp.is_null())
250 return; 251 return;
251 252
252 base::TimeTicks now = base::TimeTicks::Now(); 253 base::TimeTicks now = base::TimeTicks::Now();
253 base::TimeDelta round_trip_latency = 254 base::TimeDelta round_trip_latency =
254 now - timestamps.latest_event_timestamp; 255 now - timestamps.latest_event_timestamp;
255 256
256 round_trip_ms_.Record(round_trip_latency.InMilliseconds()); 257 round_trip_ms_.Record(round_trip_latency.InMilliseconds());
258 max_round_trip_ms_.Record(round_trip_latency.InMilliseconds());
Sergey Ulanov 2016/03/17 19:12:37 If you use the same class for Average() and Max()
Yuwei 2016/03/17 20:24:44 Acknowledged.
257 uma_custom_times_updater_.Run( 259 uma_custom_times_updater_.Run(
258 kRoundTripLatencyHistogram, round_trip_latency.InMilliseconds(), 260 kRoundTripLatencyHistogram, round_trip_latency.InMilliseconds(),
259 kLatencyHistogramMinMs, kLatencyHistogramMaxMs, kLatencyHistogramBuckets); 261 kLatencyHistogramMinMs, kLatencyHistogramMaxMs, kLatencyHistogramBuckets);
260 262
261 if (!timestamps.total_host_latency.is_max()) { 263 if (!timestamps.total_host_latency.is_max()) {
262 // Calculate total processing time on host and client. 264 // Calculate total processing time on host and client.
263 base::TimeDelta total_processing_latency = 265 base::TimeDelta total_processing_latency =
264 timestamps.total_host_latency + (now - timestamps.time_received); 266 timestamps.total_host_latency + (now - timestamps.time_received);
265 base::TimeDelta network_latency = 267 base::TimeDelta network_latency =
266 round_trip_latency - total_processing_latency; 268 round_trip_latency - total_processing_latency;
(...skipping 18 matching lines...) Expand all
285 is_paused_ = paused; 287 is_paused_ = paused;
286 if (is_paused_) { 288 if (is_paused_) {
287 // Pause the UMA timer when the video is paused. It will be unpaused in 289 // Pause the UMA timer when the video is paused. It will be unpaused in
288 // RecordVideoPacketStats() when a new frame is received. 290 // RecordVideoPacketStats() when a new frame is received.
289 upload_uma_stats_timer_.Stop(); 291 upload_uma_stats_timer_.Stop();
290 } 292 }
291 } 293 }
292 294
293 } // namespace protocol 295 } // namespace protocol
294 } // namespace remoting 296 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698