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

Side by Side Diff: remoting/webapp/base/js/connection_stats.js

Issue 1811833002: Show max latency on client's status bar (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: [Remoting WebApp]Show and upload max capture/encode/render/roundtrip latency 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
« no previous file with comments | « remoting/webapp/base/js/chromoting_event.js ('k') | remoting/webapp/base/js/session_logger.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 /** 5 /**
6 * @fileoverview 6 * @fileoverview
7 * Module to support debug overlay window with connection stats. 7 * Module to support debug overlay window with connection stats.
8 */ 8 */
9 9
10 'use strict'; 10 'use strict';
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 videoBandwidth = videoBandwidth / 1048576; 116 videoBandwidth = videoBandwidth / 1048576;
117 } else { 117 } else {
118 units = 'GiBps'; 118 units = 'GiBps';
119 videoBandwidth = videoBandwidth / 1073741824; 119 videoBandwidth = videoBandwidth / 1073741824;
120 } 120 }
121 } 121 }
122 122
123 /** 123 /**
124 * @param {number} value 124 * @param {number} value
125 * @param {string} units 125 * @param {string} units
126 * @param {number} number of digits after decimal.
Dan Beam 2016/03/22 20:49:04 @param {number} digits
126 * @return {string} Formatted number. 127 * @return {string} Formatted number.
127 */ 128 */
128 function formatStatNumber(value, units) { 129 function formatStatNumber(value, units, digits) {
129 if (value != undefined) { 130 if (value != undefined) {
130 return value.toFixed(2) + ' ' + units; 131 return value.toFixed(digits) + ' ' + units;
131 } else { 132 } else {
132 return "n/a"; 133 return "n/a";
133 } 134 }
134 } 135 }
135 136
137 /**
138 * @param {string} type
139 * @param {number} avg
140 * @param {number} max
141 * @return {string} "type: avg, max; " e.g. "RTT: 8.0, 13; "
142 */
143 function formatStat(type, avg, max) {
144 return type + ': ' + avg.toFixed(1) + ', ' + max + '; ';
145 }
146
136 var statistics = document.getElementById('statistics'); 147 var statistics = document.getElementById('statistics');
137 this.statsElement_.innerText = ( 148 this.statsElement_.innerText = (
138 'Bandwidth: ' + formatStatNumber(videoBandwidth, units) + 149 '(avg, max in ms) ' +
139 ', Frame Rate: ' + formatStatNumber(stats.videoFrameRate, 'fps') + 150 formatStat('Capture', stats.captureLatency, stats.maxCaptureLatency) +
140 ', Capture: ' + formatStatNumber(stats.captureLatency, 'ms') + 151 formatStat('Encode', stats.encodeLatency, stats.maxEncodeLatency) +
141 ', Encode: ' + formatStatNumber(stats.encodeLatency, 'ms') + 152 formatStat('Decode', stats.decodeLatency, stats.maxDecodeLatency) +
142 ', Decode: ' + formatStatNumber(stats.decodeLatency, 'ms') + 153 formatStat('Render', stats.renderLatency, stats.maxRenderLatency) +
143 ', Render: ' + formatStatNumber(stats.renderLatency, 'ms') + 154 formatStat('RTT', stats.roundtripLatency, stats.maxRoundtripLatency) +
144 ', Latency: ' + formatStatNumber(stats.roundtripLatency, 'ms')); 155 'Bandwidth: ' + formatStatNumber(videoBandwidth, units, 2) + '; ' +
156 'Frame Rate: ' + formatStatNumber(stats.videoFrameRate, 'fps', 1)
157 );
145 }; 158 };
OLDNEW
« no previous file with comments | « remoting/webapp/base/js/chromoting_event.js ('k') | remoting/webapp/base/js/session_logger.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698