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

Side by Side Diff: remoting/webapp/me2mom/server_log_entry.js

Issue 8865005: The chromoting client logs connection statistics to the server. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 * A class of server log entries. 7 * A class of server log entries.
8 */ 8 */
9 9
10 'use strict'; 10 'use strict';
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 case remoting.ClientSession.ConnectionError.INCOMPATIBLE_PROTOCOL: 87 case remoting.ClientSession.ConnectionError.INCOMPATIBLE_PROTOCOL:
88 return 'incompatible-protocol'; 88 return 'incompatible-protocol';
89 case remoting.ClientSession.ConnectionError.NETWORK_FAILURE: 89 case remoting.ClientSession.ConnectionError.NETWORK_FAILURE:
90 return 'network-failure'; 90 return 'network-failure';
91 default: 91 default:
92 return 'unknown-' + connectionError; 92 return 'unknown-' + connectionError;
93 } 93 }
94 } 94 }
95 95
96 /** @private */ 96 /** @private */
97 remoting.ServerLogEntry.prototype.VALUE_EVENT_NAME_CONNECTION_STATISTICS_ =
98 "connection-statistics";
99 /** @private */
100 remoting.ServerLogEntry.prototype.KEY_VIDEO_BANDWIDTH_ = "video-bandwidth";
101 /** @private */
102 remoting.ServerLogEntry.prototype.KEY_CAPTURE_LATENCY_ = "capture-latency";
103 /** @private */
104 remoting.ServerLogEntry.prototype.KEY_ENCODE_LATENCY_ = "encode-latency";
105 /** @private */
106 remoting.ServerLogEntry.prototype.KEY_DECODE_LATENCY_ = "decode-latency";
107 /** @private */
108 remoting.ServerLogEntry.prototype.KEY_RENDER_LATENCY_ = "render-latency";
109 /** @private */
110 remoting.ServerLogEntry.prototype.KEY_ROUNDTRIP_LATENCY_ = "roundtrip-latency";
111
112 /** @private */
97 remoting.ServerLogEntry.prototype.KEY_OS_NAME_ = 'os-name'; 113 remoting.ServerLogEntry.prototype.KEY_OS_NAME_ = 'os-name';
98 /** @private */ 114 /** @private */
99 remoting.ServerLogEntry.prototype.VALUE_OS_NAME_WINDOWS_ = 'Windows'; 115 remoting.ServerLogEntry.prototype.VALUE_OS_NAME_WINDOWS_ = 'Windows';
100 /** @private */ 116 /** @private */
101 remoting.ServerLogEntry.prototype.VALUE_OS_NAME_LINUX_ = 'Linux'; 117 remoting.ServerLogEntry.prototype.VALUE_OS_NAME_LINUX_ = 'Linux';
102 /** @private */ 118 /** @private */
103 remoting.ServerLogEntry.prototype.VALUE_OS_NAME_MAC_ = 'Mac'; 119 remoting.ServerLogEntry.prototype.VALUE_OS_NAME_MAC_ = 'Mac';
104 /** @private */ 120 /** @private */
105 remoting.ServerLogEntry.prototype.VALUE_OS_NAME_CHROMEOS_ = 'ChromeOS'; 121 remoting.ServerLogEntry.prototype.VALUE_OS_NAME_CHROMEOS_ = 'ChromeOS';
106 122
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 entry.set(this.KEY_EVENT_NAME_, this.VALUE_EVENT_NAME_SESSION_STATE_); 171 entry.set(this.KEY_EVENT_NAME_, this.VALUE_EVENT_NAME_SESSION_STATE_);
156 entry.set(this.KEY_SESSION_STATE_, this.getValueForSessionState(state)); 172 entry.set(this.KEY_SESSION_STATE_, this.getValueForSessionState(state));
157 if (connectionError != remoting.ClientSession.ConnectionError.NONE) { 173 if (connectionError != remoting.ClientSession.ConnectionError.NONE) {
158 entry.set(this.KEY_CONNECTION_ERROR_, 174 entry.set(this.KEY_CONNECTION_ERROR_,
159 this.getValueForConnectionError(connectionError)); 175 this.getValueForConnectionError(connectionError));
160 } 176 }
161 return entry; 177 return entry;
162 }; 178 };
163 179
164 /** 180 /**
181 * Makes a log entry for a set of connection statistics.
182 * Returns null if all the statistics were zero.
183 *
184 * @param {remoting.StatsAccumulator} statsAccumulator
185 * @return {?remoting.ServerLogEntry}
186 */
187 remoting.ServerLogEntry.prototype.makeStats = function(statsAccumulator) {
188 var entry = new remoting.ServerLogEntry();
189 entry.set(this.KEY_ROLE_, this.VALUE_ROLE_CLIENT_);
190 entry.set(this.KEY_EVENT_NAME_, this.VALUE_EVENT_NAME_CONNECTION_STATISTICS_);
191 var nonZero = false;
Jamie 2011/12/09 06:58:34 Can't these just be entry.addStatsField, and remov
simonmorris 2011/12/09 18:40:36 Done.
192 nonZero |= this.addStatsField(
193 entry, this.KEY_VIDEO_BANDWIDTH_,
194 remoting.ClientSession.STATS_KEY_VIDEO_BANDWIDTH, statsAccumulator);
195 nonZero |= this.addStatsField(
196 entry, this.KEY_CAPTURE_LATENCY_,
197 remoting.ClientSession.STATS_KEY_CAPTURE_LATENCY, statsAccumulator);
198 nonZero |= this.addStatsField(
199 entry, this.KEY_ENCODE_LATENCY_,
200 remoting.ClientSession.STATS_KEY_ENCODE_LATENCY, statsAccumulator);
201 nonZero |= this.addStatsField(
202 entry, this.KEY_DECODE_LATENCY_,
203 remoting.ClientSession.STATS_KEY_DECODE_LATENCY, statsAccumulator);
204 nonZero |= this.addStatsField(
205 entry, this.KEY_RENDER_LATENCY_,
206 remoting.ClientSession.STATS_KEY_RENDER_LATENCY, statsAccumulator);
207 nonZero |= this.addStatsField(
208 entry, this.KEY_ROUNDTRIP_LATENCY_,
209 remoting.ClientSession.STATS_KEY_ROUNDTRIP_LATENCY, statsAccumulator);
210 if (nonZero) {
211 return entry;
212 }
213 return null;
214 };
215
216 /**
217 * Adds one connection statistic to a log entry.
218 *
219 * @param {remoting.ServerLogEntry} entry
220 * @param {string} entryKey
221 * @param {string} statsKey
222 * @param {remoting.StatsAccumulator} statsAccumulator
223 * @return {boolean} whether the statistic is non-zero
224 */
225 remoting.ServerLogEntry.prototype.addStatsField = function(
226 entry, entryKey, statsKey, statsAccumulator) {
227 var val = statsAccumulator.calcMean(statsKey);
228 entry.set(entryKey, val.toString());
229 return (val != 0);
230 };
231
232 /**
165 * Adds an ID field to this log entry. 233 * Adds an ID field to this log entry.
166 * 234 *
167 * @param {string} id 235 * @param {string} id
168 */ 236 */
169 remoting.ServerLogEntry.prototype.addIdField = function(id) { 237 remoting.ServerLogEntry.prototype.addIdField = function(id) {
170 this.set(this.KEY_ID_, id); 238 this.set(this.KEY_ID_, id);
171 } 239 }
172 240
173 /** 241 /**
174 * Adds fields describing the host to this log entry. 242 * Adds fields describing the host to this log entry.
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 } 352 }
285 return null; 353 return null;
286 }; 354 };
287 355
288 /** 356 /**
289 * Adds a field specifying the webapp version to this log entry. 357 * Adds a field specifying the webapp version to this log entry.
290 */ 358 */
291 remoting.ServerLogEntry.prototype.addWebappVersionField = function() { 359 remoting.ServerLogEntry.prototype.addWebappVersionField = function() {
292 this.set(this.KEY_WEBAPP_VERSION_, chrome.app.getDetails().version); 360 this.set(this.KEY_WEBAPP_VERSION_, chrome.app.getDetails().version);
293 }; 361 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698