Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[profiling] Collect the number of samples #2444

Closed
zen0wu opened this issue Oct 14, 2022 · 2 comments
Closed

[profiling] Collect the number of samples #2444

zen0wu opened this issue Oct 14, 2022 · 2 comments

Comments

@zen0wu
Copy link

zen0wu commented Oct 14, 2022

Google Chrome's profiler has this issue where, when looking at a particular function/line that takes a long time, it's really hard to differentiate
between

  • High number of calls with small cost
  • Single number of calls with large cost

Currently dd profiling has the same problem. It would be great that we can add the "number of samples" to the flamegraph, that'd really help a huge ton with our profiling.

@rochdev
Copy link
Member

rochdev commented Oct 17, 2022

Unfortunately the number of samples wouldn't help much, since both cases would result in exactly the same number of samples because sampling is done every ~10ms regardless of if the function was exited and reentered or not. Basically this is a general problem with profiling and not something we can fix, at least not short term without a completely custom profiler or an entirely new profiler added to Node or V8.

@zen0wu
Copy link
Author

zen0wu commented Oct 17, 2022

Thanks for that explanation, I think I understand a bit better now! You're basically saying that because the profiler works by inspecting the call stack every ~10ms, it's by no means measuring the actual # of calls to that function.

I thought firefox profiler has the # of samples hence assumed it was useful information.

I guess to get real tracing capabilities, what we really need is to have something like, dtrace/ebpf support, which node has been lacking compared to other languages, unfortunately. Actively waiting on nodejs/node#44550 to happen...

I'll be closing this one out, thanks again.

@zen0wu zen0wu closed this as completed Oct 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants