1 Star2 Stars3 Stars4 Stars5 Stars (还没有评分)
Loading...

在macOS上使用DTrace

因为macOS默认打开System Integrity Protection,所以无法使用DTrace

$ dtrace -l
dtrace: system integrity protection is on, some features will not be available
dtrace: failed to initialize dtrace: DTrace requires additional privileges

所以如果要使用DTrace,需要关闭System Integrity Protection功能:参考Disabling and Enabling System Integrity Protection。需要注意的是,进入Recovery mode.在苹果处理器和英特尔处理器是不一样的。在关闭System Integrity Protection后,DTrace就可以使用了:

$ dtrace -l
dtrace: failed to initialize dtrace: DTrace requires additional privileges
$ sudo dtrace -l | more
Password:
   ID   PROVIDER            MODULE                          FUNCTION NAME
    1     dtrace                                                     BEGIN
    2     dtrace                                                     END
    3     dtrace                                                     ERROR
    ......

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.