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

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

Issue 8865005: The chromoting client logs connection statistics to the server. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Review. 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 * Module to support logging debug messages. 7 * Module to support logging debug messages.
8 */ 8 */
9 9
10 'use strict'; 10 'use strict';
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 debugLog.hidden = true; 83 debugLog.hidden = true;
84 } 84 }
85 }; 85 };
86 86
87 /** 87 /**
88 * Update the statistics panel. 88 * Update the statistics panel.
89 * @param {Object.<string, number>} stats The connection statistics. 89 * @param {Object.<string, number>} stats The connection statistics.
90 */ 90 */
91 remoting.DebugLog.prototype.updateStatistics = function(stats) { 91 remoting.DebugLog.prototype.updateStatistics = function(stats) {
92 var units = ''; 92 var units = '';
93 var videoBandwidth = stats['video_bandwidth']; 93 var videoBandwidth = stats[remoting.ClientSession.STATS_KEY_VIDEO_BANDWIDTH];
94 if (videoBandwidth < 1024) { 94 if (videoBandwidth < 1024) {
95 units = 'Bps'; 95 units = 'Bps';
96 } else if (videoBandwidth < 1048576) { 96 } else if (videoBandwidth < 1048576) {
97 units = 'KiBps'; 97 units = 'KiBps';
98 videoBandwidth = videoBandwidth / 1024; 98 videoBandwidth = videoBandwidth / 1024;
99 } else if (videoBandwidth < 1073741824) { 99 } else if (videoBandwidth < 1073741824) {
100 units = 'MiBps'; 100 units = 'MiBps';
101 videoBandwidth = videoBandwidth / 1048576; 101 videoBandwidth = videoBandwidth / 1048576;
102 } else { 102 } else {
103 units = 'GiBps'; 103 units = 'GiBps';
104 videoBandwidth = videoBandwidth / 1073741824; 104 videoBandwidth = videoBandwidth / 1073741824;
105 } 105 }
106 106
107 var statistics = document.getElementById('statistics'); 107 var statistics = document.getElementById('statistics');
108 this.statsElement.innerText = 108 this.statsElement.innerText =
109 'Bandwidth: ' + videoBandwidth.toFixed(2) + units + 109 'Bandwidth: ' + videoBandwidth.toFixed(2) + units +
110 ', Frame Rate: ' + 110 ', Frame Rate: ' +
111 (stats['video_frame_rate'] ? 111 (stats[remoting.ClientSession.STATS_KEY_VIDEO_FRAME_RATE] ?
112 stats['video_frame_rate'].toFixed(2) + ' fps' : 'n/a') + 112 stats[remoting.ClientSession.STATS_KEY_VIDEO_FRAME_RATE].toFixed(2)
113 ', Capture: ' + stats['capture_latency'].toFixed(2) + 'ms' + 113 + ' fps' : 'n/a') +
114 ', Encode: ' + stats['encode_latency'].toFixed(2) + 'ms' + 114 ', Capture: ' +
115 ', Decode: ' + stats['decode_latency'].toFixed(2) + 'ms' + 115 stats[remoting.ClientSession.STATS_KEY_CAPTURE_LATENCY].toFixed(2) +
116 ', Render: ' + stats['render_latency'].toFixed(2) + 'ms' + 116 'ms' +
117 ', Latency: ' + stats['roundtrip_latency'].toFixed(2) + 'ms'; 117 ', Encode: ' +
118 stats[remoting.ClientSession.STATS_KEY_ENCODE_LATENCY].toFixed(2) +
119 'ms' +
120 ', Decode: ' +
121 stats[remoting.ClientSession.STATS_KEY_DECODE_LATENCY].toFixed(2) +
122 'ms' +
123 ', Render: ' +
124 stats[remoting.ClientSession.STATS_KEY_RENDER_LATENCY].toFixed(2) +
125 'ms' +
126 ', Latency: ' +
127 stats[remoting.ClientSession.STATS_KEY_ROUNDTRIP_LATENCY].toFixed(2) +
128 'ms';
118 }; 129 };
119 130
120 /** 131 /**
121 * Check for the debug toggle hot-key. 132 * Check for the debug toggle hot-key.
122 * 133 *
123 * @param {Event} event The keyboard event. 134 * @param {Event} event The keyboard event.
124 * @return {void} Nothing. 135 * @return {void} Nothing.
125 */ 136 */
126 remoting.DebugLog.onKeydown = function(event) { 137 remoting.DebugLog.onKeydown = function(event) {
127 var element = /** @type {Element} */ (event.target); 138 var element = /** @type {Element} */ (event.target);
(...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after
645 return false; 656 return false;
646 } 657 }
647 var type = session.getAttribute('type'); 658 var type = session.getAttribute('type');
648 if (type != 'initiate') { 659 if (type != 'initiate') {
649 return false; 660 return false;
650 } 661 }
651 // Silently ignore contents of 'session' node. 662 // Silently ignore contents of 'session' node.
652 return true; 663 return true;
653 } 664 }
654 } 665 }
655 } else if (child.nodeName == 'gr:log') {
Jamie 2011/12/09 19:47:56 Has this code really all gone, or does it still ex
simonmorris 2011/12/09 21:12:12 All gone, as requested in the previous review. The
656 var log = child;
657 if (log.childNodes.length != 1) {
658 return false;
659 }
660 if (!this.verifyAttributes(log, 'xmlns:gr')) {
661 return false;
662 }
663
664 /** @type {Node} */
665 var entry = log.childNodes[0];
666 if (!this.verifyAttributes(entry, 'role,event-name,session-state,cpu,' +
667 'os-name,browser-version,webapp-version,id')) {
668 return false;
669 }
670 var role = entry.getAttribute('role');
671 if (role != 'client') {
672 return false;
673 }
674 var event_name = entry.getAttribute('event-name');
675 if (event_name != 'session-state') {
676 return false;
677 }
678 var session_state = entry.getAttribute('session-state');
679 this.prettyIqHeading(action, '?', 'log session-state ' + session_state,
680 null);
681
682 var os_name = entry.getAttribute('os-name');
683 var cpu = entry.getAttribute('cpu');
684 var browser_version = entry.getAttribute('browser-version');
685 var webapp_version = entry.getAttribute('webapp-version');
686 this.logIndent(1, os_name + ' ' + cpu + ' Chromium_v' + browser_version +
687 ' Chromoting_v' + webapp_version);
688 var remoting_id = entry.getAttribute('id');
689 if (remoting_id) {
690 this.logIndent(1, 'id: ' + remoting_id);
691 }
692 return true;
693 } 666 }
694 } 667 }
695 return false; 668 return false;
696 } 669 };
697 670
698 /** 671 /**
699 * Print out an iq 'error'-type node. 672 * Print out an iq 'error'-type node.
700 * 673 *
701 * @param {string} action String describing action (send/receive). 674 * @param {string} action String describing action (send/receive).
702 * @param {NodeList} iq_list Node containing the 'error' xml. 675 * @param {NodeList} iq_list Node containing the 'error' xml.
703 * 676 *
704 * @return {boolean} True if the data was logged successfully. 677 * @return {boolean} True if the data was logged successfully.
705 */ 678 */
706 remoting.DebugLog.prototype.prettyIqError = function(action, iq_list) { 679 remoting.DebugLog.prototype.prettyIqError = function(action, iq_list) {
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
819 remoting.DebugLog.prototype.logIq = function(send, message) { 792 remoting.DebugLog.prototype.logIq = function(send, message) {
820 if (!this.prettyIq(send, message)) { 793 if (!this.prettyIq(send, message)) {
821 // Fall back to showing the raw stanza. 794 // Fall back to showing the raw stanza.
822 var prefix = (send ? 'Sending Iq: ' : 'Receiving Iq: '); 795 var prefix = (send ? 'Sending Iq: ' : 'Receiving Iq: ');
823 this.log(prefix + message); 796 this.log(prefix + message);
824 } 797 }
825 }; 798 };
826 799
827 /** @type {remoting.DebugLog} */ 800 /** @type {remoting.DebugLog} */
828 remoting.debug = null; 801 remoting.debug = null;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698