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

Unified 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: 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 side-by-side diff with in-line comments
Download patch
« remoting/protocol/performance_tracker.h ('K') | « remoting/remoting_test.gypi ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/webapp/base/js/connection_stats.js
diff --git a/remoting/webapp/base/js/connection_stats.js b/remoting/webapp/base/js/connection_stats.js
index d08a5270bd6c444f3e3601af572b7c83aac85210..8babafc4d40f1d7ae795bf87c371eaffcec95feb 100644
--- a/remoting/webapp/base/js/connection_stats.js
+++ b/remoting/webapp/base/js/connection_stats.js
@@ -123,11 +123,14 @@ remoting.ConnectionStats.prototype.update = function(stats) {
/**
* @param {number} value
* @param {string} units
+ * @param {number} number of digits after decimal.
+ * Undefined means no rounding.
* @return {string} Formatted number.
*/
- function formatStatNumber(value, units) {
+ function formatStatNumber(value, units, digits) {
if (value != undefined) {
- return value.toFixed(2) + ' ' + units;
+ var rounded = (digits == undefined ? digits : (value.toFixed(digits)));
Sergey Ulanov 2016/03/18 19:42:06 Why would digits be undefined here?
Yuwei 2016/03/18 20:06:00 Just thinking it is possible that we may want to f
Sergey Ulanov 2016/03/18 20:17:08 In that case parameter would need to be marked as
Yuwei 2016/03/18 20:46:47 Acknowledged.
+ return rounded + ' ' + units;
} else {
return "n/a";
}
@@ -135,11 +138,16 @@ remoting.ConnectionStats.prototype.update = function(stats) {
var statistics = document.getElementById('statistics');
this.statsElement_.innerText = (
- 'Bandwidth: ' + formatStatNumber(videoBandwidth, units) +
- ', Frame Rate: ' + formatStatNumber(stats.videoFrameRate, 'fps') +
- ', Capture: ' + formatStatNumber(stats.captureLatency, 'ms') +
- ', Encode: ' + formatStatNumber(stats.encodeLatency, 'ms') +
- ', Decode: ' + formatStatNumber(stats.decodeLatency, 'ms') +
- ', Render: ' + formatStatNumber(stats.renderLatency, 'ms') +
- ', Latency: ' + formatStatNumber(stats.roundtripLatency, 'ms'));
+ 'Bandwidth: ' + formatStatNumber(videoBandwidth, units, 2) +
+ ', Frame Rate: ' + formatStatNumber(stats.videoFrameRate, 'fps', 1) +
+ ', Capture: ' + formatStatNumber(stats.captureLatency, 'ms', 1) +
+ ' / ' + formatStatNumber(stats.maxCaptureLatency, 'ms', 0) +
Yuwei 2016/03/18 01:46:20 average / max. Tried to save some space...
Sergey Ulanov 2016/03/18 19:42:06 This should be clear from the string. Maybe also r
Yuwei 2016/03/18 20:06:00 Do you mean the back-tick string template (`foo: $
Sergey Ulanov 2016/03/18 20:17:08 no. I was suggesting to change the UI that display
Yuwei 2016/03/18 20:46:47 I will change the UI to display stats with less sp
+ ', Encode: ' + formatStatNumber(stats.encodeLatency, 'ms', 1) +
+ ' / ' + formatStatNumber(stats.maxEncodeLatency, 'ms', 0) +
+ ', Decode: ' + formatStatNumber(stats.decodeLatency, 'ms', 1) +
+ ' / ' + formatStatNumber(stats.maxDecodeLatency, 'ms', 0) +
+ ', Render: ' + formatStatNumber(stats.renderLatency, 'ms', 1) +
+ ' / ' + formatStatNumber(stats.maxRenderLatency, 'ms', 0) +
+ ', Latency: ' + formatStatNumber(stats.roundtripLatency, 'ms', 1) +
+ ' / ' + formatStatNumber(stats.maxRoundtripLatency, 'ms', 0));
};
« remoting/protocol/performance_tracker.h ('K') | « remoting/remoting_test.gypi ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698