Can't view profile results in latest Chrome dev tools
In latest Chrome (36.0.1985.125 for me, OS X version) I can't see anything after loading the cpuprofile file generated from example/cpu-blocking.js. The Chart is all empty, and Tree and Heavy reports seems to show not all the information.
Looks like the format of cpuprofile has changed in previous months or chrome-cpu-profiler doesn't fill all the needed fields.
@bardt Thanks for the heads up, its always going to be a uphill struggle with breaking changes in chrome. Which version of node are you using?
@tomgco I use v0.10.29, as I know it is the latest stable version.
@bardt Ok I will have to acquire a machine with chrome 36 on it, the joys of using a chromebook :p
Just for my reference this is what the output of Chrome 35's profiler:
{"head":{"functionName":"(root)","scriptId":"0","url":"","lineNumber":0,"columnNumber":0,"hitCount":0,"callUID":3359039674,"children":[{"functionName":"(program)","scriptId":"0","url":"","lineNumber":0,"columnNumber":0,"hitCount":1,"callUID":231890484,"children":[],"deoptReason":"","id":2},{"functionName":"(idle)","scriptId":"0","url":"","lineNumber":0,"columnNumber":0,"hitCount":744,"callUID":2379442959,"children":[],"deoptReason":"","id":3}],"deoptReason":"","id":1},"startTime":1405936810.872133,"endTime":1405936811.691427,"samples":[2,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3]}
Most likely the chrome team has changed the following JSON spec.
@tomgco on my machine, startTime, endTime and samples are all empty. Probably the issue is with my environment somehow. I will be happy to provide any debug information you need to diagnose this issue.
@bardt Interesting, Could you try the v0.1.3 version and see if that works?
@tomgco on v0.1.3 I get startTime and endTime now, but samples field is absent at all. Chart view in dev tool doesn't help much.

Here is my cpuprofile content:
{"head":{"childrenCount":1,"callUid":3598459336,"selfSamplesCount":0,"totalSamplesCount":411,"selfTime":0,"totalTime":485.3394423910349,"lineNumber":0,"scriptName":"","functionName":"(root)","url":"","hitCount":0,"children":[{"childrenCount":1,"callUid":132503087,"selfSamplesCount":0,"totalSamplesCount":411,"selfTime":0,"totalTime":485.3394423910349,"lineNumber":27,"scriptName":"node.js","functionName":"(anonymous function)","url":"node.js","hitCount":0,"children":[{"childrenCount":1,"callUid":2733215073,"selfSamplesCount":0,"totalSamplesCount":411,"selfTime":0,"totalTime":485.3394423910349,"lineNumber":30,"scriptName":"node.js","functionName":"startup","url":"node.js","hitCount":0,"children":[{"childrenCount":1,"callUid":2275285979,"selfSamplesCount":0,"totalSamplesCount":411,"selfTime":0,"totalTime":485.3394423910349,"lineNumber":495,"scriptName":"module.js","functionName":"Module.runMain","url":"module.js","hitCount":0,"children":[{"childrenCount":1,"callUid":104851730,"selfSamplesCount":0,"totalSamplesCount":411,"selfTime":0,"totalTime":485.3394423910349,"lineNumber":275,"scriptName":"module.js","functionName":"Module._load","url":"module.js","hitCount":0,"children":[{"childrenCount":1,"callUid":690652982,"selfSamplesCount":0,"totalSamplesCount":411,"selfTime":0,"totalTime":485.3394423910349,"lineNumber":346,"scriptName":"module.js","functionName":"Module.load","url":"module.js","hitCount":0,"children":[{"childrenCount":1,"callUid":1624993896,"selfSamplesCount":0,"totalSamplesCount":411,"selfTime":0,"totalTime":485.3394423910349,"lineNumber":472,"scriptName":"module.js","functionName":"Module._extensions..js","url":"module.js","hitCount":0,"children":[{"childrenCount":1,"callUid":2073133298,"selfSamplesCount":0,"totalSamplesCount":411,"selfTime":0,"totalTime":485.3394423910349,"lineNumber":374,"scriptName":"module.js","functionName":"Module._compile","url":"module.js","hitCount":0,"children":[{"childrenCount":2,"callUid":672278205,"selfSamplesCount":1,"totalSamplesCount":411,"selfTime":1.1808745556959486,"totalTime":485.3394423910349,"lineNumber":0,"scriptName":"","functionName":"/Users/bardt/Projects/chrome-cpu-profiler/example/cpu-blocking.js","url":"","hitCount":1,"children":[{"childrenCount":1,"callUid":1231345901,"selfSamplesCount":0,"totalSamplesCount":1,"selfTime":0,"totalTime":1.1808745556959486,"lineNumber":41,"scriptName":"/Users/bardt/Projects/chrome-cpu-profiler/index.js","functionName":"profile.startProfiling","url":"/Users/bardt/Projects/chrome-cpu-profiler/index.js","hitCount":0,"children":[{"childrenCount":0,"callUid":4230898789,"selfSamplesCount":1,"totalSamplesCount":1,"selfTime":1.1808745556959486,"totalTime":1.1808745556959486,"lineNumber":88,"scriptName":"/Users/bardt/Projects/chrome-cpu-profiler/node_modules/strong-cpu-profiler/lib/strong-profiler.js","functionName":"exports.startProfiling","url":"/Users/bardt/Projects/chrome-cpu-profiler/node_modules/strong-cpu-profiler/lib/strong-profiler.js","hitCount":1,"children":[]}]},{"childrenCount":1,"callUid":2409117563,"selfSamplesCount":0,"totalSamplesCount":409,"selfTime":0,"totalTime":482.97769327964295,"lineNumber":4,"scriptName":"/Users/bardt/Projects/chrome-cpu-profiler/example/cpu-blocking.js","functionName":"bootstrap","url":"/Users/bardt/Projects/chrome-cpu-profiler/example/cpu-blocking.js","hitCount":0,"children":[{"childrenCount":1,"callUid":3681034886,"selfSamplesCount":1,"totalSamplesCount":409,"selfTime":1.1808745556959486,"totalTime":482.97769327964295,"lineNumber":5,"scriptName":"/Users/bardt/Projects/chrome-cpu-profiler/example/cpu-blocking.js","functionName":"pre","url":"/Users/bardt/Projects/chrome-cpu-profiler/example/cpu-blocking.js","hitCount":1,"children":[{"childrenCount":1,"callUid":2686404748,"selfSamplesCount":0,"totalSamplesCount":408,"selfTime":0,"totalTime":481.796818723947,"lineNumber":25,"scriptName":"/Users/bardt/Projects/chrome-cpu-profiler/example/cpu-blocking.js","functionName":"preInner","url":"/Users/bardt/Projects/chrome-cpu-profiler/example/cpu-blocking.js","hitCount":0,"children":[{"childrenCount":1,"callUid":2480584708,"selfSamplesCount":110,"totalSamplesCount":408,"selfTime":129.89620112655433,"totalTime":481.796818723947,"lineNumber":17,"scriptName":"/Users/bardt/Projects/chrome-cpu-profiler/example/cpu-blocking.js","functionName":"init","url":"/Users/bardt/Projects/chrome-cpu-profiler/example/cpu-blocking.js","hitCount":110,"children":[{"childrenCount":1,"callUid":1120599105,"selfSamplesCount":102,"totalSamplesCount":298,"selfTime":120.44920468098675,"totalTime":351.9006175973927,"lineNumber":26,"scriptName":"/Users/bardt/Projects/chrome-cpu-profiler/example/cpu-blocking.js","functionName":"initInner","url":"/Users/bardt/Projects/chrome-cpu-profiler/example/cpu-blocking.js","hitCount":102,"children":[{"childrenCount":1,"callUid":3681034886,"selfSamplesCount":2,"totalSamplesCount":196,"selfTime":2.361749111391897,"totalTime":231.45141291640593,"lineNumber":5,"scriptName":"/Users/bardt/Projects/chrome-cpu-profiler/example/cpu-blocking.js","functionName":"pre","url":"/Users/bardt/Projects/chrome-cpu-profiler/example/cpu-blocking.js","hitCount":2,"children":[{"childrenCount":1,"callUid":2008688371,"selfSamplesCount":0,"totalSamplesCount":194,"selfTime":0,"totalTime":229.08966380501403,"lineNumber":31,"scriptName":"/Users/bardt/Projects/chrome-cpu-profiler/example/cpu-blocking.js","functionName":"preInner","url":"/Users/bardt/Projects/chrome-cpu-profiler/example/cpu-blocking.js","hitCount":0,"children":[{"childrenCount":1,"callUid":2480584708,"selfSamplesCount":97,"totalSamplesCount":194,"selfTime":114.54483190250701,"totalTime":229.08966380501403,"lineNumber":17,"scriptName":"/Users/bardt/Projects/chrome-cpu-profiler/example/cpu-blocking.js","functionName":"init","url":"/Users/bardt/Projects/chrome-cpu-profiler/example/cpu-blocking.js","hitCount":97,"children":[{"childrenCount":0,"callUid":1398769603,"selfSamplesCount":97,"totalSamplesCount":97,"selfTime":114.54483190250701,"totalTime":114.54483190250701,"lineNumber":32,"scriptName":"/Users/bardt/Projects/chrome-cpu-profiler/example/cpu-blocking.js","functionName":"initInner","url":"/Users/bardt/Projects/chrome-cpu-profiler/example/cpu-blocking.js","hitCount":97,"children":[]}]}]}]}]}]}]}]}]}]}]}]}]}]}]}]}]}]},"startTime":1405941510.016,"endTime":1405941510.536}
Thanks for this, It looks like the samples field is required now to provide timing information within chrome.
V8 which is bundled with node v0.10 as far as I remember does not have API's in place to populate the samples array.
We could do is (stab in the dark):
Iterate the populated JSON
take the totalSampleCount for each level within the JSON,
Break down and estimate the number of samples it takes for each object using selfSamplesCount and selfTime within that levels totalTime
Based on the number of samples we calculated we would then add the scriptId of that method to the samples array.
@tomgco do you have enough time to look into this deeply? If not, I can suggest my help, but I will need more specific documentation on how all this fields are connected.
@bardt At this moment in time, not really - I might be able to look at this in a few days.
If it is possible to use 0.11v, as I believe that this was, what I have been using before.
If not then you could look at github.com/tomgco/cpu-profiler#1.0 or for information where these data structures come from:
Node 0.10: https://v8docs.nodesource.com/node-0.10/d9/d6e/classv8_1_1_cpu_profile_node.html Node 0.11 / Maybe chrome 36: https://v8docs.nodesource.com/node-0.11/d9/d6e/classv8_1_1_cpu_profile_node.html
@tomgco I was able to somehow fix the flame chart issue with this commit on node v0.10 (last stable) and Chrome 36: https://github.com/bardt/chrome-cpu-profiler/commit/3c95b1bda2ed2ee5543617fa08f3978c06451391
I know, that is not completely correct and pretty rude. But I ran the example code in browser, and profile flame chart is not much different comparing to the one I got from node.
The overall solution needs your review and approval.
Thanks @bardt, looks good at the first glance! I just need to test it and then it should be all good to merge.
Doesn't work for me either. Even with bardt merge.
Node v0.10.33 Chrome Version 38.0.2125.122 (64-bit)
@FelikZ I haven't tested it since Chrome 36. Probably, they changed something again. Will try look into it on the weekend.
Facing the same issue. Chrome: 39.0.2171.95 (64-bit) Node: 0.10.35