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

Issue 92120: Added ProfileView object for performing sorting, searching and filtering operations on a profile. (Closed)

Created:
11 years, 8 months ago by Mikhail Naganov
Modified:
9 years, 7 months ago
CC:
v8-dev
Visibility:
Public.

Description

Added ProfileView object for performing sorting, searching and filtering operations on a profile. It will be used both in the new tickprocessor and Dev Tools profiler. Committed: http://code.google.com/p/v8/source/detail?r=1786

Patch Set 1 #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+388 lines, -22 lines) Patch
M test/mjsunit/tools/profile.js View 1 chunk +2 lines, -1 line 0 comments Download
A test/mjsunit/tools/profileview.js View 1 chunk +95 lines, -0 lines 0 comments Download
M tools/profile.js View 13 chunks +107 lines, -21 lines 0 comments Download
A tools/profileview.js View 1 chunk +184 lines, -0 lines 2 comments Download

Messages

Total messages: 3 (0 generated)
Mikhail Naganov
11 years, 8 months ago (2009-04-24 08:48:33 UTC) #1
Søren Thygesen Gjesse
LGTM http://codereview.chromium.org/92120/diff/1/5 File tools/profileview.js (right): http://codereview.chromium.org/92120/diff/1/5#newcode54 Line 54: callTree.traverse(function(node, viewParent) { I woud prefer to ...
11 years, 8 months ago (2009-04-24 10:55:20 UTC) #2
Mikhail Naganov
11 years, 8 months ago (2009-04-24 11:34:23 UTC) #3
http://codereview.chromium.org/92120/diff/1/5
File tools/profileview.js (right):

http://codereview.chromium.org/92120/diff/1/5#newcode54
Line 54: callTree.traverse(function(node, viewParent) {
On 2009/04/24 10:55:20, Søren Gjesse wrote:
> I woud prefer to have this function defined as an inner function in
> devtools.profiler.ViewBuilder.prototype.buildView instead of being defined
> anonomous in the arguments list.

I see two obstacles to this. First, inside 'traverse', this function is called
within a global context (as callbacks usually do), thus it will be needed to use
an intermediate function that will reapply it in the context of an ViewBuilder
object.

Second, the visitor function initializes the 'head' variable available from its
lexical scope. I can make 'head' a property of ViewBuilder, but it seems not
very good to me, as it is a temporary var.

So, would I change a code as you propose, it will look like this:

devtools.profiler.ViewBuilder = function(samplingRate) {
   this.samplingRate = samplingRate;
   // Used inside cloningVisitor.
   this.head = null;
};

devtools.profiler.ViewBuilder.prototype.cloningVisitor = function(node,
viewParent) {
   // body of now anonymous function,
   // uses 'this' to access 'samplingRate' and 'head'.
}

...and inside devtools.profiler.ViewBuilder.prototype.buildView:

var self = this;
callTree.traverse(function(node, viewParent) { self.cloningVisitor.apply(self,
arguments); });


Frankly, I don't like it. If you don't have strong arguments for this change,
I'll better leave the code as is.

Powered by Google App Engine
This is Rietveld 408576698