Skip to content

Instantly share code, notes, and snippets.

@jamesbrink
Last active December 9, 2021 17:08
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jamesbrink/4537b99587927f43e586dfe1b33b5a78 to your computer and use it in GitHub Desktop.
Save jamesbrink/4537b99587927f43e586dfe1b33b5a78 to your computer and use it in GitHub Desktop.
Run Dtrace with gource.
Here is a quick visualization of file activity using Gource :)
This was run on OSx, linux users can use strace to watch for open files, much better performance.
# Using lsof in a loop (no sudo required)
(while :; do lsof |gsed -r "s#(\w+)\s+.*\s+(.+)#$(gdate +"%s")\|\1\|M\|\2#;t;d";done) | \
gource --realtime --filename-time 2 --highlight-users --1280x800 --log-format custom -
# Using Dtrace (better option, could replace with opensnoop possibly but still requires dtrace)
sudo dtrace -n 'syscall::open*:entry { printf("%u|%s|%s",walltimestamp,execname,copyinstr(arg0)); }' | \
gsed -r 's#.+ ([0-9]{10}).+\|(.+)\|(.+).+#\1\|\2\|M\|\3#;t;d' |\
gource --realtime --filename-time 2 --highlight-users --1280x800 --log-format custom -
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment