The following are examples of py_syscalls.d.
This is a simple script to count executed Python functions and system calls.
Here it traces an example program, Code/Pythong/func_abc.py.
# py_syscalls.d -c ./func_abc.py
Tracing... Hit Ctrl-C to end.
Function A
Function B
Function C
Calls for PID 145538,
FILE TYPE NAME COUNT
UserDict.py func ? 1
UserDict.py func DictMixin 1
UserDict.py func IterableUserDict 1
UserDict.py func UserDict 1
UserDict.py func __init__ 1
__init__.py func ? 1
__init__.py func CodecRegistryError 1
__init__.py func normalize_encoding 1
__init__.py func search_function 1
aliases.py func ? 1
ascii.py func ? 1
ascii.py func Codec 1
ascii.py func StreamConverter 1
ascii.py func StreamReader 1
ascii.py func StreamWriter 1
ascii.py func getregentry 1
codecs.py func ? 1
codecs.py func Codec 1
codecs.py func StreamReader 1
codecs.py func StreamReaderWriter 1
codecs.py func StreamRecoder 1
codecs.py func StreamWriter 1
copy_reg.py func ? 1
func_abc.py func ? 1
func_abc.py func func_a 1
func_abc.py func func_b 1
func_abc.py func func_c 1
func_abc.py syscall getrlimit 1
func_abc.py syscall gtime 1
func_abc.py syscall memcntl 1
func_abc.py syscall rexit 1
func_abc.py syscall sigpending 1
func_abc.py syscall sysi86 1
func_abc.py syscall write 1
func_abc.py syscall xstat 1
linecache.py func ? 1
os.py func ? 1
os.py func _Environ 1
os.py func __init__ 1
os.py func _get_exports_list 1
posixpath.py func ? 1
posixpath.py func basename 1
posixpath.py func dirname 1
site.py func ? 1
site.py func _Helper 1
site.py func _Printer 1
site.py func _init_pathinfo 1
site.py func abs__file__ 1
site.py func addsitepackages 1
site.py func aliasmbcs 1
site.py func execsitecustomize 1
site.py func main 1
site.py func removeduppaths 1
site.py func setcopyright 1
site.py func setencoding 1
site.py func sethelper 1
site.py func setquit 1
stat.py func ? 1
types.py func ? 1
types.py func _C 1
warnings.py func ? 1
warnings.py func _OptionError 1
warnings.py func _processoptions 1
func_abc.py syscall fcntl 2
func_abc.py syscall fsat 2
func_abc.py syscall getcwd 2
func_abc.py syscall getpid 2
func_abc.py syscall mprotect 2
func_abc.py syscall readlink 2
func_abc.py syscall resolvepath 2
func_abc.py syscall setcontext 2
posixpath.py func exists 2
posixpath.py func split 2
site.py func addsitedir 2
warnings.py func simplefilter 2
copy_reg.py func constructor 3
copy_reg.py func pickle 3
func_abc.py syscall munmap 3
func_abc.py syscall pollsys 3
site.py func __init__ 3
site.py func addpackage 3
func_abc.py syscall getdents64 4
func_abc.py syscall open 4
func_abc.py syscall sysconfig 4
func_abc.py syscall mmap 5
func_abc.py syscall lwp_exit 6
stat.py func S_IFMT 6
stat.py func S_ISDIR 6
posixpath.py func isdir 8
os.py func _exists 10
<string> func ? 11
posixpath.py func normcase 14
site.py func makepath 14
posixpath.py func join 20
posixpath.py func abspath 22
posixpath.py func isabs 22
posixpath.py func normpath 22
func_abc.py syscall ioctl 28
func_abc.py syscall llseek 34
func_abc.py syscall read 36
func_abc.py syscall close 41
func_abc.py syscall sigaction 52
func_abc.py syscall brk 58
func_abc.py syscall fstat64 74
func_abc.py syscall stat64 77
func_abc.py syscall open64 173
While tracing there were numerous system calls made, including 173 open64()'s,
and 77 stat64()'s. There were also many functions called, including 22 each
of abspath, isabs, and normpath by the posixpath.py library.
This script can provide an insight to how an application is interacting
with the system, by providing both application function calls and
system calls in the same output.