flamegraph-rs / flamegraph

Easy flamegraphs for Rust projects and everything else, without Perl or pipes <3
Apache License 2.0
4.77k stars 147 forks source link

Option to use `sample` on macos instead of `dtrace` #30

Open stepancheg opened 5 years ago

stepancheg commented 5 years ago

dtrace is not available on macOS when "system integrity protection is on"

% sudo flamegraph ls
dtrace: system integrity protection is on, some features will not be available

dtrace: failed to execute ls: dtrace cannot control executables signed with restricted entitlements
failed to sample program

It would be helpful if flamegraph could also use sample program for collecting samples.

jonas-schievink commented 4 years ago

Inferno already has support for sample, so this should not be terribly difficult to implement. I just realized how horrible the UX of using DTrace on macOS is, so PRs are very welcome! (though I can't test this personally)

bjorn3 commented 4 years ago

dtrace is not available on macOS when "system integrity protection is on"

Actually it only doesn't work for executables with restricted entitlements (like many system executables)

dtrace cannot control executables signed with restricted entitlements

jonas-schievink commented 4 years ago

@bjorn3 are you sure? I've found conflicting information about this. If that's the case that would be great though.

bjorn3 commented 4 years ago

I just tried it, and running dtrace as root with a non system binary works. When running as normal user, it says: "dtrace: failed to initialize dtrace: DTrace requires additional privileges".