简体   繁体   中英

Chrome web inspector : CPU profiler

在此处输入图片说明

My program takes about 20 sec to load (lot of svg objects). I am trying to profile using chrome web inspector. It shows a total of 19.16 sec, but the breakdown doesn't quite add up. I tried bottom up, top down and sorted in different combination. Still cannot identify the bottle neck. I could see the data receive within few milliseconds from server, but takes long to render it.

Also in the %ge view, the total is 98%, but the rest is less than 0.05% individually and doesn't seems right.

In my previous qn , I asked how to show #calls and average. I doubt a recursive call may cause this, but at the same time the total time should reflect that.

在此处输入图片说明 How can I identify the function which causes this delay. Any help appreciated.

You can use this function to log time differences between calls:

var timeVal = new Date().getTime();
var log = function(name){
    var str = new Date().toLocaleTimeString();
    var newTime = new Date().getTime();
    str += " (" + (newTime - timeVal) + "ms)";
    timeVal = newTime;
    console.log(str, name)
}

Use it like this:

log("prepare for something")
// do something
log("something happened");

Output:

16:57:46 (2496ms) prepare for something
16:57:46 (130ms) something happened

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM