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 29 matching lines...) Expand all Loading... | |
40 /** @private */ | 40 /** @private */ |
41 remoting.ServerLogEntry.KEY_SESSION_STATE_ = 'session-state'; | 41 remoting.ServerLogEntry.KEY_SESSION_STATE_ = 'session-state'; |
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_TIME_TO_REACH_A_SESSION_STATE_MS_ = |
51 'signal-strategy-elapsed-time'; | 51 'time-to-reach-state'; |
Jamie
2015/02/26 20:32:06
I think simply "elapsed-time" is a better name for
anandc
2015/02/26 22:47:11
Done.
| |
52 | |
53 | |
52 | 54 |
53 /** | 55 /** |
54 * @private | 56 * @private |
55 * @param {remoting.ClientSession.State} state | 57 * @param {remoting.ClientSession.State} state |
56 * @return {string} | 58 * @return {string} |
57 */ | 59 */ |
58 remoting.ServerLogEntry.getValueForSessionState_ = function(state) { | 60 remoting.ServerLogEntry.getValueForSessionState_ = function(state) { |
59 switch(state) { | 61 switch(state) { |
60 case remoting.ClientSession.State.UNKNOWN: | 62 case remoting.ClientSession.State.UNKNOWN: |
61 return 'unknown'; | 63 return 'unknown'; |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
308 * @param {remoting.StatsAccumulator} statsAccumulator | 310 * @param {remoting.StatsAccumulator} statsAccumulator |
309 * @return {boolean} whether the statistic is non-zero | 311 * @return {boolean} whether the statistic is non-zero |
310 */ | 312 */ |
311 remoting.ServerLogEntry.prototype.addStatsField_ = function( | 313 remoting.ServerLogEntry.prototype.addStatsField_ = function( |
312 entryKey, statsKey, statsAccumulator) { | 314 entryKey, statsKey, statsAccumulator) { |
313 var val = statsAccumulator.calcMean(statsKey); | 315 var val = statsAccumulator.calcMean(statsKey); |
314 this.set_(entryKey, val.toFixed(2)); | 316 this.set_(entryKey, val.toFixed(2)); |
315 return (val != 0); | 317 return (val != 0); |
316 }; | 318 }; |
317 | 319 |
320 | |
Jamie
2015/02/26 20:32:06
No need for an extra blank line here.
anandc
2015/02/26 22:47:11
Done.
| |
318 /** | 321 /** |
319 * Makes a log entry for a "this session ID is old" event. | 322 * Makes a log entry for a "this session ID is old" event. |
320 * | 323 * |
321 * @param {string} sessionId | 324 * @param {string} sessionId |
322 * @param {remoting.DesktopConnectedView.Mode} mode | 325 * @param {remoting.DesktopConnectedView.Mode} mode |
323 * @return {remoting.ServerLogEntry} | 326 * @return {remoting.ServerLogEntry} |
324 */ | 327 */ |
325 remoting.ServerLogEntry.makeSessionIdOld = function(sessionId, mode) { | 328 remoting.ServerLogEntry.makeSessionIdOld = function(sessionId, mode) { |
326 var entry = new remoting.ServerLogEntry(); | 329 var entry = new remoting.ServerLogEntry(); |
327 entry.set_(remoting.ServerLogEntry.KEY_ROLE_, | 330 entry.set_(remoting.ServerLogEntry.KEY_ROLE_, |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
364 function(sessionId, strategyType, progress, elapsedTimeInMs) { | 367 function(sessionId, strategyType, progress, elapsedTimeInMs) { |
365 var entry = new remoting.ServerLogEntry(); | 368 var entry = new remoting.ServerLogEntry(); |
366 entry.set_(remoting.ServerLogEntry.KEY_ROLE_, | 369 entry.set_(remoting.ServerLogEntry.KEY_ROLE_, |
367 remoting.ServerLogEntry.VALUE_ROLE_CLIENT_); | 370 remoting.ServerLogEntry.VALUE_ROLE_CLIENT_); |
368 entry.set_( | 371 entry.set_( |
369 remoting.ServerLogEntry.KEY_EVENT_NAME_, | 372 remoting.ServerLogEntry.KEY_EVENT_NAME_, |
370 remoting.ServerLogEntry.VALUE_EVENT_NAME_SIGNAL_STRATEGY_PROGRESS_); | 373 remoting.ServerLogEntry.VALUE_EVENT_NAME_SIGNAL_STRATEGY_PROGRESS_); |
371 entry.addSessionIdField(sessionId); | 374 entry.addSessionIdField(sessionId); |
372 entry.set_(remoting.ServerLogEntry.KEY_SIGNAL_STRATEGY_TYPE_, strategyType); | 375 entry.set_(remoting.ServerLogEntry.KEY_SIGNAL_STRATEGY_TYPE_, strategyType); |
373 entry.set_(remoting.ServerLogEntry.KEY_SIGNAL_STRATEGY_PROGRESS_, progress); | 376 entry.set_(remoting.ServerLogEntry.KEY_SIGNAL_STRATEGY_PROGRESS_, progress); |
374 entry.set_(remoting.ServerLogEntry.KEY_SIGNAL_STRATEGY_ELAPSED_TIME_, | |
375 String(elapsedTimeInMs)); | |
376 | 377 |
377 return entry; | 378 return entry; |
378 }; | 379 }; |
379 | 380 |
380 /** | 381 /** |
381 * Adds a session ID field to this log entry. | 382 * Adds a session ID field to this log entry. |
382 * | 383 * |
383 * @param {string} sessionId | 384 * @param {string} sessionId |
384 */ | 385 */ |
385 remoting.ServerLogEntry.prototype.addSessionIdField = function(sessionId) { | 386 remoting.ServerLogEntry.prototype.addSessionIdField = function(sessionId) { |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
460 return { | 461 return { |
461 'os_name': remoting.ServerLogEntry.VALUE_OS_NAME_CHROMEOS_, | 462 'os_name': remoting.ServerLogEntry.VALUE_OS_NAME_CHROMEOS_, |
462 'os_version': match[2], | 463 'os_version': match[2], |
463 'cpu': match[1] | 464 'cpu': match[1] |
464 }; | 465 }; |
465 } | 466 } |
466 return null; | 467 return null; |
467 }; | 468 }; |
468 | 469 |
469 /** | 470 /** |
471 * Adds a field to this log entry specifying the elapsed time since the start of | |
472 * the session to the current session state. | |
473 * @param {number} elapsedTimeInMs | |
474 */ | |
475 remoting.ServerLogEntry.prototype.addTimeToReachStateMs = | |
476 function(elapsedTimeInMs) { | |
477 this.set_(remoting.ServerLogEntry.KEY_TIME_TO_REACH_A_SESSION_STATE_MS_, | |
478 String(elapsedTimeInMs)); | |
479 }; | |
480 | |
481 | |
482 /** | |
470 * Adds a field specifying the browser version to this log entry. | 483 * Adds a field specifying the browser version to this log entry. |
471 */ | 484 */ |
472 remoting.ServerLogEntry.prototype.addChromeVersionField = function() { | 485 remoting.ServerLogEntry.prototype.addChromeVersionField = function() { |
473 var version = remoting.getChromeVersion(); | 486 var version = remoting.getChromeVersion(); |
474 if (version != null) { | 487 if (version != null) { |
475 this.set_(remoting.ServerLogEntry.KEY_BROWSER_VERSION_, version); | 488 this.set_(remoting.ServerLogEntry.KEY_BROWSER_VERSION_, version); |
476 } | 489 } |
477 }; | 490 }; |
478 | 491 |
479 /** | 492 /** |
(...skipping 28 matching lines...) Expand all Loading... | |
508 case remoting.DesktopConnectedView.Mode.IT2ME: | 521 case remoting.DesktopConnectedView.Mode.IT2ME: |
509 return remoting.ServerLogEntry.VALUE_MODE_IT2ME_; | 522 return remoting.ServerLogEntry.VALUE_MODE_IT2ME_; |
510 case remoting.DesktopConnectedView.Mode.ME2ME: | 523 case remoting.DesktopConnectedView.Mode.ME2ME: |
511 return remoting.ServerLogEntry.VALUE_MODE_ME2ME_; | 524 return remoting.ServerLogEntry.VALUE_MODE_ME2ME_; |
512 case remoting.DesktopConnectedView.Mode.APP_REMOTING: | 525 case remoting.DesktopConnectedView.Mode.APP_REMOTING: |
513 return remoting.ServerLogEntry.VALUE_MODE_APP_REMOTING_; | 526 return remoting.ServerLogEntry.VALUE_MODE_APP_REMOTING_; |
514 default: | 527 default: |
515 return remoting.ServerLogEntry.VALUE_MODE_UNKNOWN_; | 528 return remoting.ServerLogEntry.VALUE_MODE_UNKNOWN_; |
516 } | 529 } |
517 }; | 530 }; |
OLD | NEW |