Reviewers: danno,

Message:
Hi Danno,
I would appreciate it if you could review my change.
Thanks!

Description:
Extend tick-processor utility to generate an execution timeline based on the
reported VM states
BUG=none
TEST=none

Please review this at https://codereview.chromium.org/11359048/

SVN Base: http://v8.googlecode.com/svn/branches/bleeding_edge/

Affected files:
  M     tools/tickprocessor.js


Index: tools/tickprocessor.js
===================================================================
--- tools/tickprocessor.js      (revision 12764)
+++ tools/tickprocessor.js      (working copy)
@@ -185,6 +185,7 @@
       'begin-code-region': null,
       'end-code-region': null });

+  this.timeline_ = "";
   this.cppEntriesProvider_ = cppEntriesProvider;
   this.callGraphSize_ = callGraphSize;
   this.ignoreUnknown_ = ignoreUnknown;
@@ -347,6 +348,16 @@
   return this.stateFilter_ == null || this.stateFilter_ == vmState;
 };

+TickProcessor.prototype.recordTickTimeline = function(vmState) {
+  if (vmState == TickProcessor.VmStates.JS) this.timeline_ += "J";
+  else if (vmState == TickProcessor.VmStates.GC) this.timeline_ += "G";
+ else if (vmState == TickProcessor.VmStates.COMPILER) this.timeline_ += "C"; + else if (vmState == TickProcessor.VmStates.PARALLEL_COMPILER_PROLOGUE) this.timeline_ += "|";
+  else if (vmState == TickProcessor.VmStates.OTHER) this.timeline_ += "O";
+ else if (vmState == TickProcessor.VmStates.EXTERNAL) this.timeline_ += ".";
+  else this.timeline_ += "U";
+}
+
 TickProcessor.prototype.processTick = function(pc,
                                                sp,
                                                is_external_callback,
@@ -354,6 +365,7 @@
                                                vmState,
                                                stack) {
   this.ticks_.total++;
+  this.recordTickTimeline(vmState);
   if (vmState == TickProcessor.VmStates.GC) this.ticks_.gc++;
   if (!this.includeTick(vmState)) {
     this.ticks_.excluded++;
@@ -465,6 +477,14 @@
       return rec2.totalTime - rec1.totalTime ||
           (rec2.internalFuncName < rec1.internalFuncName ? -1 : 1); });
   this.printHeavyProfile(heavyView.head.children);
+
+  print('Visual Execution Timeline: ');
+  var sliceLength = 80;
+  var sliceStart = 0;
+  while (sliceStart < this.timeline_.length) {
+    print(this.timeline_.slice(sliceStart, sliceStart + sliceLength));
+    sliceStart += sliceLength;
+  }
 };




--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to