clinicjs / node-clinic

Clinic.js diagnoses your Node.js performance issues
https://clinicjs.org
MIT License
5.67k stars 125 forks source link

Question: Can we generate flamegraphs for async functions based on total time, similar to bubbleprof graphs? #453

Open Jason5Lee opened 1 year ago

Jason5Lee commented 1 year ago

I'm attempting to profile my NodeJS to identify the components slowing down my API, which might be due to an async operation. So far, all the flamegraph tools I've come across only consider CPU time. This led me to discover this project, with the bubbleprof graph proving quite useful.

However, I'm curious whether it's possible to use flamegraphs to illustrate the time taken by async operations? For instance, in the case of an API async function, I want to know which function call or which 'await' is the hot path. Would this be easy to integrate? Or does a tool already exist that accomplishes this?

RafaelGSS commented 1 year ago

You want to consider idle time + CPU time right? You can't do it with Clinic.js. You will need to instrument your app manually through performance.now() measurements or dynamic instrumentation.

Jason5Lee commented 1 year ago

You want to consider idle time + CPU time right? You can't do it with Clinic.js. You will need to instrument your app manually through performance.now() measurements or dynamic instrumentation.

What could be the rationale behind creating Bubbleprof graph for async operation analysis, as opposed to utilizing the existing Flamegraph?