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

Unified Diff: tools/profviz/composer.js

Issue 23736004: Add better consistency check and error output to plot script. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: addressed comments Created 7 years, 3 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 | « tools/plot-timer-events ('k') | tools/profviz/profviz.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/profviz/composer.js
diff --git a/tools/profviz/composer.js b/tools/profviz/composer.js
index fe0bf00e7821ae0c3fa71154d69df3721d3f6e00..44dd7639de84b327331082696a2f2da5822660ae 100644
--- a/tools/profviz/composer.js
+++ b/tools/profviz/composer.js
@@ -31,7 +31,7 @@ Array.prototype.top = function() {
}
-function PlotScriptComposer(kResX, kResY) {
+function PlotScriptComposer(kResX, kResY, error_output) {
// Constants.
var kV8BinarySuffixes = ["/d8", "/libv8.so"];
var kStackFrames = 8; // Stack frames to display in the plot.
@@ -149,7 +149,10 @@ function PlotScriptComposer(kResX, kResY) {
// Utility functions.
function assert(something, message) {
- if (!something) print(new Error(message).stack);
+ if (!something) {
+ var error = new Error(message);
+ error_output(error.stack);
+ }
}
function FindCodeKind(kind) {
@@ -208,10 +211,15 @@ function PlotScriptComposer(kResX, kResY) {
// Public methods.
this.collectData = function(input, distortion_per_entry) {
+ var last_timestamp = 0;
+
// Parse functions.
var parseTimeStamp = function(timestamp) {
+ int_timestamp = parseInt(timestamp);
+ assert(int_timestamp >= last_timestamp, "Inconsistent timestamps.");
+ last_timestamp = int_timestamp;
distortion += distortion_per_entry;
- return parseInt(timestamp) / 1000 - distortion;
+ return int_timestamp / 1000 - distortion;
}
var processTimerEventStart = function(name, start) {
@@ -260,65 +268,6 @@ function PlotScriptComposer(kResX, kResY) {
code_map.deleteCode(address);
};
- var processSharedLibrary = function(name, start, end) {
- var code_entry = new CodeMap.CodeEntry(end - start, name);
- code_entry.kind = -2; // External code kind.
- for (var i = 0; i < kV8BinarySuffixes.length; i++) {
- var suffix = kV8BinarySuffixes[i];
- if (name.indexOf(suffix, name.length - suffix.length) >= 0) {
- code_entry.kind = -1; // V8 runtime code kind.
- break;
- }
- }
- code_map.addLibrary(start, code_entry);
- };
-
- var processTimerEventStart = function(name, start) {
- // Find out the thread id.
- var new_event = TimerEvents[name];
- if (new_event === undefined) return;
- var thread_id = new_event.thread_id;
-
- start = Math.max(last_time_stamp[thread_id] + kMinRangeLength, start);
-
- // Last event on this thread is done with the start of this event.
- var last_event = event_stack[thread_id].top();
- if (last_event !== undefined) {
- var new_range = new Range(last_time_stamp[thread_id], start);
- last_event.ranges.push(new_range);
- }
- event_stack[thread_id].push(new_event);
- last_time_stamp[thread_id] = start;
- };
-
- var processTimerEventEnd = function(name, end) {
- // Find out about the thread_id.
- var finished_event = TimerEvents[name];
- var thread_id = finished_event.thread_id;
- assert(finished_event === event_stack[thread_id].pop(),
- "inconsistent event stack");
-
- end = Math.max(last_time_stamp[thread_id] + kMinRangeLength, end);
-
- var new_range = new Range(last_time_stamp[thread_id], end);
- finished_event.ranges.push(new_range);
- last_time_stamp[thread_id] = end;
- };
-
- var processCodeCreateEvent = function(type, kind, address, size, name) {
- var code_entry = new CodeMap.CodeEntry(size, name);
- code_entry.kind = kind;
- code_map.addCode(address, code_entry);
- };
-
- var processCodeMoveEvent = function(from, to) {
- code_map.moveCode(from, to);
- };
-
- var processCodeDeleteEvent = function(address) {
- code_map.deleteCode(address);
- };
-
var processCodeDeoptEvent = function(time, size) {
deopts.push(new Deopt(time, size));
}
« no previous file with comments | « tools/plot-timer-events ('k') | tools/profviz/profviz.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698