OLD | NEW |
---|---|
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 * A class of server log entries. | 7 * A class of server log entries. |
8 * | 8 * |
9 * Any changes to the values here need to be coordinated with the host and | 9 * Any changes to the values here need to be coordinated with the host and |
10 * server/log proto code. | 10 * server/log proto code. |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
42 /** @private */ | 42 /** @private */ |
43 remoting.ServerLogEntry.KEY_CONNECTION_TYPE_ = 'connection-type'; | 43 remoting.ServerLogEntry.KEY_CONNECTION_TYPE_ = 'connection-type'; |
44 /** @private */ | 44 /** @private */ |
45 remoting.ServerLogEntry.KEY_SIGNAL_STRATEGY_TYPE_ = 'signal-strategy-type'; | 45 remoting.ServerLogEntry.KEY_SIGNAL_STRATEGY_TYPE_ = 'signal-strategy-type'; |
46 /** @private */ | 46 /** @private */ |
47 remoting.ServerLogEntry.KEY_SIGNAL_STRATEGY_PROGRESS_ = | 47 remoting.ServerLogEntry.KEY_SIGNAL_STRATEGY_PROGRESS_ = |
48 'signal-strategy-progress'; | 48 'signal-strategy-progress'; |
49 /** @private */ | 49 /** @private */ |
50 remoting.ServerLogEntry.KEY_SIGNAL_STRATEGY_ELAPSED_TIME_ = | 50 remoting.ServerLogEntry.KEY_SIGNAL_STRATEGY_ELAPSED_TIME_ = |
51 'signal-strategy-elapsed-time'; | 51 'signal-strategy-elapsed-time'; |
52 /** @private */ | |
53 remoting.ServerLogEntry.EVENT_TOTAL_TIME_FOR_INITIAL_CONNECT_MS_ = | |
54 'total-time-for-initial-connect'; | |
Jamie
2015/02/25 21:12:35
I don't think we should need a separate log entry
anandc
2015/02/26 20:21:49
Done.
| |
55 | |
56 | |
52 | 57 |
53 /** | 58 /** |
54 * @private | 59 * @private |
55 * @param {remoting.ClientSession.State} state | 60 * @param {remoting.ClientSession.State} state |
56 * @return {string} | 61 * @return {string} |
57 */ | 62 */ |
58 remoting.ServerLogEntry.getValueForSessionState_ = function(state) { | 63 remoting.ServerLogEntry.getValueForSessionState_ = function(state) { |
59 switch(state) { | 64 switch(state) { |
60 case remoting.ClientSession.State.UNKNOWN: | 65 case remoting.ClientSession.State.UNKNOWN: |
61 return 'unknown'; | 66 return 'unknown'; |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
308 * @param {remoting.StatsAccumulator} statsAccumulator | 313 * @param {remoting.StatsAccumulator} statsAccumulator |
309 * @return {boolean} whether the statistic is non-zero | 314 * @return {boolean} whether the statistic is non-zero |
310 */ | 315 */ |
311 remoting.ServerLogEntry.prototype.addStatsField_ = function( | 316 remoting.ServerLogEntry.prototype.addStatsField_ = function( |
312 entryKey, statsKey, statsAccumulator) { | 317 entryKey, statsKey, statsAccumulator) { |
313 var val = statsAccumulator.calcMean(statsKey); | 318 var val = statsAccumulator.calcMean(statsKey); |
314 this.set_(entryKey, val.toFixed(2)); | 319 this.set_(entryKey, val.toFixed(2)); |
315 return (val != 0); | 320 return (val != 0); |
316 }; | 321 }; |
317 | 322 |
323 | |
324 /** | |
325 * Makes a log entry for a "total connection time" event. | |
326 * | |
327 * @param {string} sessionId | |
328 * @param {remoting.DesktopConnectedView.Mode} mode | |
329 * @param {number} connectionTimeInMs | |
330 * @return {remoting.ServerLogEntry} | |
331 */ | |
332 remoting.ServerLogEntry.makeTotalTimeForInitialConnection = | |
333 function(sessionId, mode, connectionTimeInMs) { | |
334 var entry = new remoting.ServerLogEntry(); | |
335 entry.set_(remoting.ServerLogEntry.KEY_ROLE_, | |
336 remoting.ServerLogEntry.VALUE_ROLE_CLIENT_); | |
337 entry.set_( | |
338 remoting.ServerLogEntry.KEY_EVENT_NAME_, | |
339 remoting.ServerLogEntry.EVENT_TOTAL_TIME_FOR_INITIAL_CONNECT_MS_); | |
340 entry.set_(remoting.ServerLogEntry.EVENT_TOTAL_TIME_FOR_INITIAL_CONNECT_MS_, | |
341 String(connectionTimeInMs)); | |
342 entry.addSessionIdField(sessionId); | |
343 entry.addModeField(mode); | |
344 return entry; | |
345 }; | |
346 | |
347 | |
318 /** | 348 /** |
319 * Makes a log entry for a "this session ID is old" event. | 349 * Makes a log entry for a "this session ID is old" event. |
320 * | 350 * |
321 * @param {string} sessionId | 351 * @param {string} sessionId |
322 * @param {remoting.DesktopConnectedView.Mode} mode | 352 * @param {remoting.DesktopConnectedView.Mode} mode |
323 * @return {remoting.ServerLogEntry} | 353 * @return {remoting.ServerLogEntry} |
324 */ | 354 */ |
325 remoting.ServerLogEntry.makeSessionIdOld = function(sessionId, mode) { | 355 remoting.ServerLogEntry.makeSessionIdOld = function(sessionId, mode) { |
326 var entry = new remoting.ServerLogEntry(); | 356 var entry = new remoting.ServerLogEntry(); |
327 entry.set_(remoting.ServerLogEntry.KEY_ROLE_, | 357 entry.set_(remoting.ServerLogEntry.KEY_ROLE_, |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
508 case remoting.DesktopConnectedView.Mode.IT2ME: | 538 case remoting.DesktopConnectedView.Mode.IT2ME: |
509 return remoting.ServerLogEntry.VALUE_MODE_IT2ME_; | 539 return remoting.ServerLogEntry.VALUE_MODE_IT2ME_; |
510 case remoting.DesktopConnectedView.Mode.ME2ME: | 540 case remoting.DesktopConnectedView.Mode.ME2ME: |
511 return remoting.ServerLogEntry.VALUE_MODE_ME2ME_; | 541 return remoting.ServerLogEntry.VALUE_MODE_ME2ME_; |
512 case remoting.DesktopConnectedView.Mode.APP_REMOTING: | 542 case remoting.DesktopConnectedView.Mode.APP_REMOTING: |
513 return remoting.ServerLogEntry.VALUE_MODE_APP_REMOTING_; | 543 return remoting.ServerLogEntry.VALUE_MODE_APP_REMOTING_; |
514 default: | 544 default: |
515 return remoting.ServerLogEntry.VALUE_MODE_UNKNOWN_; | 545 return remoting.ServerLogEntry.VALUE_MODE_UNKNOWN_; |
516 } | 546 } |
517 }; | 547 }; |
OLD | NEW |