Index: remoting/webapp/me2mom/debug_log.js |
diff --git a/remoting/webapp/me2mom/debug_log.js b/remoting/webapp/me2mom/debug_log.js |
index 3e0fd4716c751d50e5d4b41c4fad6426578640bc..25472435221fed05cb7f162c0352c2995a16c8d7 100644 |
--- a/remoting/webapp/me2mom/debug_log.js |
+++ b/remoting/webapp/me2mom/debug_log.js |
@@ -38,6 +38,21 @@ remoting.DebugLog.prototype.REMOTING_DIRECTORY_SERVICE_BOT = |
'remoting@bot.talk.google.com'; |
/** |
+ * The host attributes in a log entry. |
+ * |
+ * @private |
+ */ |
+remoting.DebugLog.prototype.LOG_ENTRY_HOST_ATTRIBUTES_ = |
+ 'cpu,os-name,browser-version,webapp-version'; |
+ |
+/** |
+ * The id attribute in a log entry. |
+ * |
+ * @private |
+ */ |
+remoting.DebugLog.prototype.LOG_ENTRY_ID_ATTRIBUTE_ = 'id'; |
+ |
+/** |
* Add the given message to the debug log. |
* |
* @param {number} indentLevel The indention level for this message. |
@@ -90,7 +105,7 @@ remoting.DebugLog.prototype.toggle = function() { |
*/ |
remoting.DebugLog.prototype.updateStatistics = function(stats) { |
var units = ''; |
- var videoBandwidth = stats['video_bandwidth']; |
+ var videoBandwidth = stats[remoting.ClientSession.STATS_KEY_VIDEO_BANDWIDTH]; |
if (videoBandwidth < 1024) { |
units = 'Bps'; |
} else if (videoBandwidth < 1048576) { |
@@ -108,13 +123,24 @@ remoting.DebugLog.prototype.updateStatistics = function(stats) { |
this.statsElement.innerText = |
'Bandwidth: ' + videoBandwidth.toFixed(2) + units + |
', Frame Rate: ' + |
- (stats['video_frame_rate'] ? |
- stats['video_frame_rate'].toFixed(2) + ' fps' : 'n/a') + |
- ', Capture: ' + stats['capture_latency'].toFixed(2) + 'ms' + |
- ', Encode: ' + stats['encode_latency'].toFixed(2) + 'ms' + |
- ', Decode: ' + stats['decode_latency'].toFixed(2) + 'ms' + |
- ', Render: ' + stats['render_latency'].toFixed(2) + 'ms' + |
- ', Latency: ' + stats['roundtrip_latency'].toFixed(2) + 'ms'; |
+ (stats[remoting.ClientSession.STATS_KEY_VIDEO_FRAME_RATE] ? |
+ stats[remoting.ClientSession.STATS_KEY_VIDEO_FRAME_RATE].toFixed(2) |
+ + ' fps' : 'n/a') + |
+ ', Capture: ' + |
+ stats[remoting.ClientSession.STATS_KEY_CAPTURE_LATENCY].toFixed(2) + |
+ 'ms' + |
+ ', Encode: ' + |
+ stats[remoting.ClientSession.STATS_KEY_ENCODE_LATENCY].toFixed(2) + |
+ 'ms' + |
+ ', Decode: ' + |
+ stats[remoting.ClientSession.STATS_KEY_DECODE_LATENCY].toFixed(2) + |
+ 'ms' + |
+ ', Render: ' + |
+ stats[remoting.ClientSession.STATS_KEY_RENDER_LATENCY].toFixed(2) + |
+ 'ms' + |
+ ', Latency: ' + |
+ stats[remoting.ClientSession.STATS_KEY_ROUNDTRIP_LATENCY].toFixed(2) + |
+ 'ms'; |
}; |
/** |
@@ -663,37 +689,94 @@ remoting.DebugLog.prototype.prettyIqSet = function(action, iq_list) { |
/** @type {Node} */ |
var entry = log.childNodes[0]; |
- if (!this.verifyAttributes(entry, 'role,event-name,session-state,cpu,' + |
- 'os-name,browser-version,webapp-version,id')) { |
- return false; |
- } |
var role = entry.getAttribute('role'); |
if (role != 'client') { |
return false; |
} |
var event_name = entry.getAttribute('event-name'); |
- if (event_name != 'session-state') { |
- return false; |
- } |
- var session_state = entry.getAttribute('session-state'); |
- this.prettyIqHeading(action, '?', 'log session-state ' + session_state, |
- null); |
- |
- var os_name = entry.getAttribute('os-name'); |
- var cpu = entry.getAttribute('cpu'); |
- var browser_version = entry.getAttribute('browser-version'); |
- var webapp_version = entry.getAttribute('webapp-version'); |
- this.logIndent(1, os_name + ' ' + cpu + ' Chromium_v' + browser_version + |
- ' Chromoting_v' + webapp_version); |
- var remoting_id = entry.getAttribute('id'); |
- if (remoting_id) { |
- this.logIndent(1, 'id: ' + remoting_id); |
+ if (event_name == 'session-state') { |
Jamie
2011/12/09 06:58:34
This feels unnecessary to me. My understanding of
simonmorris
2011/12/09 18:40:36
Done.
|
+ if (!this.verifyAttributes(entry, |
+ 'role,event-name,session-state,' + |
+ this.LOG_ENTRY_HOST_ATTRIBUTES_ + ',' + |
+ this.LOG_ENTRY_ID_ATTRIBUTE_)) { |
+ return false; |
+ } |
+ var session_state = entry.getAttribute('session-state'); |
+ this.prettyIqHeading(action, '?', 'log session-state ' + session_state, |
+ null); |
+ this.prettyLogEntryHostAttributes(entry); |
+ this.prettyLogEntryIdAttribute(entry); |
+ return true; |
+ } else if (event_name == 'connection-statistics') { |
+ if (!this.verifyAttributes(entry, |
+ 'role,event-name,video-bandwidth,capture-latency,encode-latency,' + |
+ 'decode-latency,render-latency,roundtrip-latency,' + |
+ this.LOG_ENTRY_HOST_ATTRIBUTES_ + ',' + |
+ this.LOG_ENTRY_ID_ATTRIBUTE_)) { |
+ return false; |
+ } |
+ this.prettyIqHeading(action, '?', 'log connection-statistics', null); |
+ var video_bandwidth = entry.getAttribute('video-bandwidth'); |
+ if (video_bandwidth) { |
+ this.logIndent(1, 'video bandwidth: ' + video_bandwidth); |
+ } |
+ var capture_latency = entry.getAttribute('capture-latency'); |
+ if (capture_latency) { |
+ this.logIndent(1, 'capture latency: ' + capture_latency); |
+ } |
+ var encode_latency = entry.getAttribute('encode-latency'); |
+ if (encode_latency) { |
+ this.logIndent(1, 'encode latency: ' + encode_latency); |
+ } |
+ var decode_latency = entry.getAttribute('decode-latency'); |
+ if (decode_latency) { |
+ this.logIndent(1, 'decode latency: ' + decode_latency); |
+ } |
+ var render_latency = entry.getAttribute('render-latency'); |
+ if (render_latency) { |
+ this.logIndent(1, 'render latency: ' + render_latency); |
+ } |
+ var roundtrip_latency = entry.getAttribute('roundtrip-latency'); |
+ if (roundtrip_latency) { |
+ this.logIndent(1, 'roundtrip latency: ' + roundtrip_latency); |
+ } |
+ this.prettyLogEntryHostAttributes(entry); |
+ this.prettyLogEntryIdAttribute(entry); |
+ return true; |
} |
- return true; |
+ return false; |
} |
} |
return false; |
-} |
+}; |
+ |
+/** |
+ * Print out the host attributes in a log entry. |
+ * |
+ * @private |
+ * @param {Node} entry |
+ */ |
+remoting.DebugLog.prototype.prettyLogEntryHostAttributes = function(entry) { |
+ var os_name = entry.getAttribute('os-name'); |
+ var cpu = entry.getAttribute('cpu'); |
+ var browser_version = entry.getAttribute('browser-version'); |
+ var webapp_version = entry.getAttribute('webapp-version'); |
+ this.logIndent(1, os_name + ' ' + cpu + ' Chromium_v' + browser_version + |
+ ' Chromoting_v' + webapp_version); |
+}; |
+ |
+/** |
+ * Print out the id attribute in a log entry. |
+ * |
+ * @private |
+ * @param {Node} entry |
+ */ |
+remoting.DebugLog.prototype.prettyLogEntryIdAttribute = function(entry) { |
+ var remoting_id = entry.getAttribute('id'); |
+ if (remoting_id) { |
+ this.logIndent(1, 'id: ' + remoting_id); |
+ } |
+}; |
/** |
* Print out an iq 'error'-type node. |