Question

Say I have a function OfInterest, called by functions A and B, and that calls function X and Y. I'm looking for a way of viewing:

OfInterest -- 200 ms total time
    X -- 150 ms total time
    Y -- 50 ms total time

...such that it includes both the calls to OfInterest by A and B.

In the Chrome profiler, this would be the top-down view zoomed in on OfInterest, except that AFAIK there's no way of including calls to OfInterest from both A + B at the same time. The bottom-up view gets the right total time for OfInterest, but AFAIK there's no way of seeing X + Y in that view.

Is there a way of getting Chrome to spit this out, or using a different profiler such as Firebug to see this?

No correct solution

OTHER TIPS

This github project gives top down tree for jvascript call stat

https://github.com/brucespang/jsprof

When i was looking for a javascript function call profiler i found a small script, which i modified as per my need, this script is very simple it will show statistics of all global functions in that window object though it doesnt list names of nested functions called.

function callLog() {

var functionPool = {} 

for( var func in window ) 
{

if (typeof(window[func]) === 'function') 

  {
    functionPool[func] = window[func]; 
    (function(){ 
         var functionName = func;
         var totalTime= 0;
         var noOfTimes =0;
         var minTime= 0;
         var maxTime =0;

         window[functionName] = function(){ 
         var args = [].splice.call(arguments,0); 
         var startTime = +new Date;        
         functionPool[functionName].apply(window, args );    
         var duration = new Date - startTime;

            if (duration> maxTime)
                maxTime= duration;
            if (duration< minTime)
                minTime= duration;

         totalTime = totalTime + duration;
         noOfTimes++ ;
         console.log('Executed: ' + functionName + '('+args.join(',')+')' + "   Time[" + duration + "ms]"+"  Total Time[" + totalTime +"ms]" +"   No of Times[" + noOfTimes + "]" + "max Time [" + maxTime+ "ms]" + "min Time [" +minTime +"ms]");               

        }
      })();
  }
}

}

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top