flamegraph icon indicating copy to clipboard operation
flamegraph copied to clipboard

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

Open stepancheg opened this issue 6 years ago • 4 comments
trafficstars

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.

stepancheg avatar Mar 20 '19 02:03 stepancheg

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)

jonas-schievink avatar Dec 06 '19 14:12 jonas-schievink

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

bjorn3 avatar Dec 06 '19 15:12 bjorn3

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

jonas-schievink avatar Dec 06 '19 15:12 jonas-schievink

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".

bjorn3 avatar Dec 08 '19 11:12 bjorn3