Skip to content

Instantly share code, notes, and snippets.

@mfazekas
Last active April 6, 2016 19:56
Show Gist options
  • Save mfazekas/1c4b487900ea3fc4cba7 to your computer and use it in GitHub Desktop.
Save mfazekas/1c4b487900ea3fc4cba7 to your computer and use it in GitHub Desktop.
DTrace scripts

rails hanged, why?

see what's ruby functions running

process id is 928

sudo dtrace -n \
  'ruby*:::method-entry {  printf("-> %s %s\n",copyinstr(arg0),copyinstr(arg1)) }' \
  -p 928

stats by function call (pressing ctrl+c should dump the stats)

sudo dtrace -n \
  'ruby*:::method-entry { @[copyinstr(arg0), copyinstr(arg1)] = count() }' \
  -p 928

use lldb to call rb_backtrace

lldb
(lldb) attach pid
(gdb) call (void)rb_backtrace()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment