1. 15

  2. 3

    The author mentions that with perf you can get the functions but not the stacktrace of stuff in C running, in dtrace you can accomplish getting the stack traces (to some degree of success depending on how the binaries are compiled) with this:

    sudo dtrace -n 'profile-1001hz /arg1/ { @[ustack()] = count()}
                      tick-1s {trunc(@, 5); printa(@); trunc(@)}'

    This will store the stacktrace of whatever is running in underland 1001 times per second and store the count, then every second it will print the top 5 results then clear (so it will not be accumulative).