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

Unified Diff: chrome/browser/resources/net_internals/log_view_painter.js

Issue 10825116: net-internals: Display time log dump was created at end of printed logs (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Fix comments, order Created 8 years, 5 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/resources/net_internals/source_entry.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/net_internals/log_view_painter.js
===================================================================
--- chrome/browser/resources/net_internals/log_view_painter.js (revision 148858)
+++ chrome/browser/resources/net_internals/log_view_painter.js (working copy)
@@ -24,7 +24,8 @@
* Adds a child pre element to the end of |parent|, and writes the
* formatted contents of |logEntries| to it.
*/
-printLogEntriesAsText = function(logEntries, parent, enableSecurityStripping) {
+printLogEntriesAsText = function(logEntries, parent, enableSecurityStripping,
+ logCreationTime) {
var entries = LogGroupEntry.createArrayFrom(logEntries);
var tablePrinter = new TablePrinter();
var parameterOutputter = new ParameterOutputter(tablePrinter);
@@ -41,17 +42,10 @@
// Avoid printing the END for a BEGIN that was immediately before, unless
// both have extra parameters.
if (!entry.isEnd() || !canCollapseBeginWithEnd(entry.begin)) {
- tablePrinter.addRow();
+ addRowWithTime(tablePrinter,
+ timeutil.convertTimeTicksToDate(entry.orig.time).getTime(),
+ startTime);
- tablePrinter.addCell('t=');
- var date = timeutil.convertTimeTicksToDate(entry.orig.time);
- var tCell = tablePrinter.addCell(date.getTime());
- tCell.alignRight = true;
- tablePrinter.addCell(' [st=');
- var stCell = tablePrinter.addCell(date.getTime() - startTime);
- stCell.alignRight = true;
- tablePrinter.addCell('] ');
-
for (var j = entry.getDepth(); j > 0; --j)
tablePrinter.addCell(' ');
@@ -80,11 +74,37 @@
}
}
+ // If viewing a saved log file, add row with just the time the log was
+ // created, if the event never completed.
+ if (logCreationTime != null && entries[entries.length - 1].getDepth() > 0)
+ addRowWithTime(tablePrinter, logCreationTime, startTime);
+
// Format the table for fixed-width text.
tablePrinter.toText(0, parent);
}
/**
+ * Adds a new row to the given TablePrinter, and adds five cells containing
+ * information about the time an event occured.
+ * Format is '[t=<UTC time in ms>] [st=<ms since the source started>]'.
+ * @param {TablePrinter} tablePrinter The table printer to add the cells to.
+ * @param {number} eventTime The time the event occured, as a UTC time in
+ * milliseconds.
+ * @param {number} startTime The time the first event for the source occured,
+ * as a UTC time in milliseconds.
+ */
+function addRowWithTime(tablePrinter, eventTime, startTime) {
mmenke 2012/07/31 20:45:42 Could move this over to ParameterOutputter (writeL
+ tablePrinter.addRow();
+ tablePrinter.addCell('t=');
+ var tCell = tablePrinter.addCell(eventTime);
+ tCell.alignRight = true;
+ tablePrinter.addCell(' [st=');
+ var stCell = tablePrinter.addCell(eventTime - startTime);
+ stCell.alignRight = true;
+ tablePrinter.addCell('] ');
+}
+
+/**
* |hexString| must be a string of hexadecimal characters with no whitespace,
* whose length is a multiple of two. Writes multiple lines to |out| with
* the hexadecimal characters from |hexString| on the left, in groups of
« no previous file with comments | « no previous file | chrome/browser/resources/net_internals/source_entry.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698