DTrace freezes the system?


When I try the DTrace examples in the chapter, all the scripts will cause my MacBook Pro system to pretty slow, the mouse cursor movement is responding slow, and kernel_task/dtrace process is high CPU. This happens to even relative cheap probe like “proc:::exec-success”. This almost makes the whole system can’t be used. Is this expected? If so, this seems to significant reduce the usefulness of DTrace. Windows ETW is much better in this perspective…


I saw the “jumpy mouse” thing a year or two ago, but it seemed to have gone away.

Are you running dtrace with sudo or from a terminal logged in as root? Sometimes dtrace isn’t as happy when running from a sudo session.


No, it’s just a normal terminal running with “sudo dtrace -s foo.d”.
Btw: I am new to Mac, one weird thing about Mac is that one process high CPU can cause the whole system to be sluggish even I have 8 cores. On Windows, the other CPUs can always keep your mouse/UI operations responsive.


try making a shell with “sudo bash”, and then running your dtrace script from there.


Nevermind, after restarting my macbook I did not see the high CPU anymore. Thanks for confirming this is not expected behavior!


Most excellent! Unfortunately these days reboots are a more common occurence. I used to regularly have 60 day uptimes on my work laptop, but I don’t think I have gotten beyond 20 or 30, either due to some serious OS security update, or Xcode gets solidly wedged again.