Chromium Code Reviews| 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)); |
| }; |