-
Notifications
You must be signed in to change notification settings - Fork 58
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
Running samply 'in-proc' #158
Comments
This is tricky. For macOS, this is doable because For Linux and Windows, What you could do though is implement the macOS approach for in-proc usage for all platforms. This would be a stub that knows how to suspend its own process' threads and capture a stack, and then forward it to the rest of samply's machinery for processing and converting into a format that the front end can consume. This wouldn't be a huge amount of effort to get something basic running (this is basically what Firefox does, I believe). The macOS code in |
What Vlad said is exactly right - for macOS, an in-process implementation would be relatively straightforward, but an Windows and Linux it would be a fully separate implementation. That said, the Gecko profiler that is built into Firefox is an in-process implementation. The two hard bits are:
The first one is tricky because libraries can be unloaded in a racy manner from different threads, and getting library information often involves groveling around the library's loaded bytes, so you must be sure that those bytes don't go away while you're looking. Interrupting threads and getting their state is done with |
Heyo, I'm also interested in "in-proc" functionality. However, I'm mostly interested in a way to profile my binary without having to ship a separate binary for the sampling - I don't actually care if the sampling is truly in-process or through an OS subsystem. Is it possible to use ETW/perf to self-sample, or if there was some fundamental reason why that couldn't work? |
It's possible -- I'm not as familiar with perf, but with ETW, any captured etl file with the same providers that samply sets up (see |
After a convo earlier this week, I wonder if folks familiar with the code base here know what would it take to have run samply in-process. At a reduce sample rate in order to manage the overhead and have it run in production.
The text was updated successfully, but these errors were encountered: