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

Unified Diff: remoting/webapp/base/js/stats_accumulator.js

Issue 1811833002: Show max latency on client's status bar (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: JS compiler fix and lld fix 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
« no previous file with comments | « remoting/webapp/base/js/session_logger.js ('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/stats_accumulator.js
diff --git a/remoting/webapp/base/js/stats_accumulator.js b/remoting/webapp/base/js/stats_accumulator.js
index e0edd49653807203dd25b333d7c5f2af697fc45f..e8bda09ff0a11752131ec6af1e1d9604f223c917 100644
--- a/remoting/webapp/base/js/stats_accumulator.js
+++ b/remoting/webapp/base/js/stats_accumulator.js
@@ -94,6 +94,26 @@ remoting.StatsAccumulator.prototype.calcMean = function(key) {
};
/**
+ * Finds the max of the values for a given key.
+ *
+ * @param {string} key
+ * @return {number} the max of the values for that key
+ */
+remoting.StatsAccumulator.prototype.calcMax = function(key) {
+ /**
+ * @param {Array<number>} values
+ * @return {number}
+ */
+ var calcMax = function(values) {
+ if (!values || !values.length) {
+ return 0;
+ }
+ return Math.max.apply(null, values);
+ };
+ return this.map(key, calcMax);
+};
+
+/**
* Applies a given map to the list of values for a given key.
*
* @param {string} key
@@ -131,10 +151,15 @@ remoting.StatsAccumulator.prototype.getPerfStats = function() {
var stats = new remoting.ClientSession.PerfStats();
stats.videoBandwidth = this.calcMean('videoBandwidth');
stats.captureLatency = this.calcMean('captureLatency');
+ stats.maxCaptureLatency = this.calcMax('maxCaptureLatency');
stats.encodeLatency = this.calcMean('encodeLatency');
+ stats.maxEncodeLatency = this.calcMax('maxEncodeLatency');
stats.decodeLatency = this.calcMean('decodeLatency');
+ stats.maxDecodeLatency = this.calcMax('maxDecodeLatency');
stats.renderLatency = this.calcMean('renderLatency');
+ stats.maxRenderLatency = this.calcMax('maxRenderLatency');
stats.roundtripLatency = this.calcMean('roundtripLatency');
+ stats.maxRoundtripLatency = this.calcMax('maxRoundtripLatency');
for (var key in stats) {
if (stats[key] !== 0) {
« no previous file with comments | « remoting/webapp/base/js/session_logger.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698