1The following are examples of sh_syscalls.d. 2 3This is a simple script to count Ruby methods and system calls. Here we trace 4an example program - Code/Ruby/func_abc.rb 5 6# rb_syscalls.d -c ./func_abc.rb 7Tracing... Hit Ctrl-C to end. 8Function A 9Function B 10Function C 11 12Calls for PID 146493, 13 14 FILE TYPE NAME COUNT 15 func_abc.rb method Object::func_a 1 16 func_abc.rb method Object::func_b 1 17 func_abc.rb method Object::func_c 1 18 func_abc.rb syscall getpid 1 19 func_abc.rb syscall getrlimit 1 20 func_abc.rb syscall getrlimit64 1 21 func_abc.rb syscall mmap 1 22 func_abc.rb syscall munmap 1 23 func_abc.rb syscall rexit 1 24 func_abc.rb syscall schedctl 1 25 func_abc.rb syscall sigpending 1 26 func_abc.rb syscall sysconfig 1 27 func_abc.rb syscall sysi86 1 28 func_abc.rb syscall write 1 29 func_abc.rb syscall llseek 2 30 func_abc.rb syscall read 2 31 func_abc.rb syscall setcontext 2 32 func_abc.rb method IO::write 3 33 func_abc.rb method Module::method_added 3 34 func_abc.rb method Object::print 3 35 func_abc.rb method Object::sleep 3 36 func_abc.rb syscall fstat64 3 37 func_abc.rb syscall getgid 3 38 func_abc.rb syscall getuid 3 39 func_abc.rb syscall ioctl 3 40 func_abc.rb syscall pollsys 3 41 func_abc.rb syscall close 4 42 func_abc.rb syscall lwp_sigmask 4 43 func_abc.rb syscall open64 4 44 func_abc.rb syscall gtime 6 45 func_abc.rb syscall sigaction 12 46 func_abc.rb syscall brk 56 47 48While tracing, three user-defined functions were called - func_a, func_b and 49func_c. There were 3 instances of the IO::write method being called. There 50were also many system calls made, including 56 brk()'s, and 12 sigaction()'s. 51 52This script can provide an insight to how a Ruby program is interacting 53with the system, by providing methods and system calls in the same output. 54 55