davidmarkclements / 0x

🔥 single-command flamegraph profiling 🔥

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Ability to visualize profiling info from v8 profiler

slonka opened this issue · comments

Hi,

V8 profiler has methods called StartProfiling, StopProfiling (https://v8docs.nodesource.com/node-10.6/d2/d34/classv8_1_1_cpu_profiler.html#ab78880137fc43d636cca23c81567b52d). There are modules that allow accessing these methods: https://github.com/hyj1991/v8-profiler-next/blob/master/src/cpu_profile.cc. I created a converter that can convert that format into something that is acceptable by 0x (generates a tree structure similar to the one generated here: https://github.com/davidmarkclements/0x/blob/master/lib/render.js#L19).

Would you be interested in including that functionality? (you can preview the code here: slonka@a9c848c and I'll create a PR if you want)

BTW I'm just wondering why did you only use --prof as a means of collecting stack information? How does it differ from CpuProfiler::StartProfiling?

Would you be interested in including that functionality? (you can preview the code here: slonka/0x@a9c848c and I'll create a PR if you want)

I think so! Can you add a screenshot here of how that would look like?

BTW I'm just wondering why did you only use --prof as a means of collecting stack information? How does it differ from CpuProfiler::StartProfiling?

I think because we need no native addon to start that. @davidmarkclements definitely knows more!

I think so! Can you add a screenshot here of how that would look like?

Yeah sure. Here is a flamegraph of a simple server responding with a string hello under 10RPS.
screen shot 2018-11-06 at 10 39 37

To run it you simply invoke:
0x --visualize-v8-profile v8-profiler-output.json

I think because we need no native addon to start that. @davidmarkclements definitely knows more!

I was more interested in the profiling data that is provided. Does --prof call CpuProfiler::StartProfiling underneath?

@slonka send the PR over. In your PR can you please add an example on how to generate that output?

I was more interested in the profiling data that is provided. Does --prof call CpuProfiler::StartProfiling underneath?

I never investigated in depth. The actual output looks very similar anyway.

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

This issue was closed because it has been stalled for 5 days with no activity.