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

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

Issue 2004673002: Initialize remoting.ClientSession.PerfStats with zeros (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Reviewer's Feedback Created 4 years, 7 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/client_session.js ('k') | remoting/webapp/base/js/stats_accumulator.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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
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} digits 126 * @param {number} digits
127 * @return {string} Formatted number. 127 * @return {string} Formatted number.
128 */ 128 */
129 function formatStatNumber(value, units, digits) { 129 function formatStatNumber(value, units, digits) {
130 if (value != undefined) { 130 return value.toFixed(digits) + ' ' + units;
131 return value.toFixed(digits) + ' ' + units;
132 } else {
133 return "n/a";
134 }
135 } 131 }
136 132
137 /** 133 /**
138 * @param {string} type 134 * @param {string} type
139 * @param {number} avg 135 * @param {number} avg
140 * @param {number} max 136 * @param {number} max
141 * @return {string} "type: avg, max; " e.g. "RTT: 8.0, 13; " 137 * @return {string} "type: avg, max; " e.g. "RTT: 8.0, 13; "
142 */ 138 */
143 function formatStat(type, avg, max) { 139 function formatStat(type, avg, max) {
144 var avgStr = (avg == undefined) ? 'n/a' : avg.toFixed(1); 140 return type + ': ' + avg.toFixed(1) + ', ' + max + '; ';
145 return type + ': ' + avgStr + ', ' + max + '; ';
146 } 141 }
147 142
148 var statistics = document.getElementById('statistics'); 143 var statistics = document.getElementById('statistics');
149 this.statsElement_.innerText = ( 144 this.statsElement_.innerText = (
150 '(avg, max in ms) ' + 145 '(avg, max in ms) ' +
151 formatStat('Capture', stats.captureLatency, stats.maxCaptureLatency) + 146 formatStat('Capture', stats.captureLatency, stats.maxCaptureLatency) +
152 formatStat('Encode', stats.encodeLatency, stats.maxEncodeLatency) + 147 formatStat('Encode', stats.encodeLatency, stats.maxEncodeLatency) +
153 formatStat('Decode', stats.decodeLatency, stats.maxDecodeLatency) + 148 formatStat('Decode', stats.decodeLatency, stats.maxDecodeLatency) +
154 formatStat('Render', stats.renderLatency, stats.maxRenderLatency) + 149 formatStat('Render', stats.renderLatency, stats.maxRenderLatency) +
155 formatStat('RTT', stats.roundtripLatency, stats.maxRoundtripLatency) + 150 formatStat('RTT', stats.roundtripLatency, stats.maxRoundtripLatency) +
156 'Bandwidth: ' + formatStatNumber(videoBandwidth, units, 2) + '; ' + 151 'Bandwidth: ' + formatStatNumber(videoBandwidth, units, 2) + '; ' +
157 'Frame Rate: ' + formatStatNumber(stats.videoFrameRate, 'fps', 1) 152 'Frame Rate: ' + formatStatNumber(stats.videoFrameRate, 'fps', 1)
158 ); 153 );
159 }; 154 };
OLDNEW
« no previous file with comments | « remoting/webapp/base/js/client_session.js ('k') | remoting/webapp/base/js/stats_accumulator.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698