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

Make --prof toggleable #154

Closed
davidmarkclements opened this issue Feb 13, 2018 · 10 comments
Closed

Make --prof toggleable #154

davidmarkclements opened this issue Feb 13, 2018 · 10 comments
Labels

Comments

@davidmarkclements
Copy link
Member

As #150 – however since perf support in V8 is supposedly deprecated (as mentioned in #148) this could be the more important flag moving forward

@davidmarkclements
Copy link
Member Author

(also because interpreted frames – #150 (comment))

@ryzokuken
Copy link

@hashseed would you be open to a PR making --prof toggleable? Would love to give this one a shot.

@ryzokuken
Copy link

@hashseed ping.

@davidmarkclements
Copy link
Member Author

Hey @ryzokuken - Just to say I discussed this with @hashseed in person - it's really non-trivial (aside from other the internal implementation complexities think about the log format - if it's toggglable when do you get the code creation events? Those have to be collected and stored right? So even if it's off there's an increased cost, and likely more memory consumption)

Even given a viable approach that doesn't have unreasonable cost, --prof is internal/private to V8 so we can't currently expect the V8 team to have the same resources to invest in this than public apis

@mmarchini
Copy link
Contributor

Just want to point out that it's possible to implement this feature with no memory overhead if you iterate the heap and get all codes generated when you start the profiler (which is already done when we use --prof to collect codes loaded from V8's snapshot). The only overhead will be for users of the toggling feature, which is acceptable. If I'm not mistaken, @mcollina was also asking for this feature.

@ofrobots
Copy link
Contributor

FYI @hashseed is presently on vacation. He may not be able to respond to this thread until he's back.

@slonka
Copy link

slonka commented Sep 27, 2019

Any updates on this?

@kwasimensah
Copy link

ping. Just ran into this. I'm trying to profile code but don't want my setup code in the profile

@mmarchini
Copy link
Contributor

--prof is a V8 flag, so for those interested in this feature the best place to request it is in the V8 issue tracker: https://bugs.chromium.org/p/v8/issues/list.


@kwasimensah thera are a few alternatives to --prof if you need to profile your code on demand (without startup):

  1. You can use the Inspector Protocol to trigger V8 CPU Profile and open the output on Chrome DevTools. This can be achieved either with the Inspector API, npm modules like thetool, or completely on-demand connecting to the Inspector Protocol websocket and exchanging messages (I'm not aware of any guides for this last one though)
  2. You can use the C++ API to trigger a V8 CPU Profile. This is essentially the same as 1, but it uses the C++ API instead of the Inspector Protocol. There's probably an npm module with bindings for this
  3. If you are on Linux, you can use Linux perf in combination with --interpreted-frames-native-stack and --perf-basic-prof flags, as described here: https://nodejs.org/en/docs/guides/diagnostics-flamegraph/

@github-actions
Copy link

This issue is stale because it has been open many days with no activity. It will be closed soon unless the stale label is removed or a comment is made.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants