Solaris 10 で DTrace を使って pwd コマンドを実行して最もCPU時間を消費した関数を調べてみた。
bash-3.00# dtrace -qn ' pid$target:::entry { self->ts[probefunc] = timestamp; } pid$target:::return { @time[probefunc] = sum(timestamp - self->ts[probefunc]); } END { printa(@time); }' -c pwd setustack 7400 _getfp 7600 libc_fini 7600 caller 8000 sigon 8000 _cleanup 8200 atfork_init 9000 set_curthread 9000 strcpy 9000 fflush 9400 _caller 9800 _save_nv_regs 10000 elf_entry_pt 10200 _fflush_u 10400 strlen 10400 getpid 10800 mutex_setup 10800 strncpy 11400 getrlimit 17800 unused 19400 signal_init 19600 __getcontext 21000 mutex_lock 24600 get_lcinterface 24800 free 29000 visit 29000 alist_append 29600 mutex_unlock 30000 mutex_lock_impl 32000 _fflush_l_iops 32400 call_array 33000 defrag 34200 list_append 35800 plt_full_range 37600 tls_modinfo_alloc 39000 anon_map 43000 memcpy 43600 tls_setup 44400 memset 44600 _ld_libc 47600 lmutex_lock 49400 lmutex_unlock 52200 _syscall6 53800 getcwd 54200 rt_get_extern 58400 iflush_range 60200 dz_map 62800 sncmp 64800 is_dep_init 66200 elf_hash 68800 load_completion 74800 align 75400 split 76800 is_dep_ready 80600 rt_mutex_lock 80600 getbucketnum 82400 rt_bind_guard 83000 _ti_bind_guard 86000 expand 89400 _write 91200 rt_mutex_unlock 93000 set_thread_vars 97800 hdl_alloc 102600 _dep_visit 104400 _lwp_mutex_lock 105800 _lwp_mutex_unlock 106000 munmap 108200 strcmp 110400 mmap 116000 lfree 116800 hdl_add 123400 callable 134400 pthread_atfork 139400 expand_paths 160600 fmap_setup 170400 rt_bind_clear 171600 bind_one 182200 set_environ 189200 _ti_bind_clear 190200 call_init 197200 atexit 206000 call_fini 211600 dep_visit 216800 alist_insert 223800 elf_plt_write 263800 calloc 277800 hdl_create 345200 elf_find_sym 418400 write 452400 _elf_lookup_filtee 580200 elf_lookup_filtee 603600 atexit_fini 711200 enter 749400 tsort 899400 leave 1377200 _lookup_sym 1402400 _start 1602400 lookup_sym 1680200 _exithandle 1781000 initial_allocation 1915400 libc_init 1954800 __tls_static_mods 2162800 rt_thr_init 2172000 tls_statmod 2236400 lmalloc 2720400 elf_bndr 4005600 elf_rtbndr 4129000 rtld_db_preinit 2682252453484600 rd_event 2682252457207000 rtld_db_postinit 2682252462567400 setup 2682252462703200 _setup 2682252462716600 _rt_boot 2682252462751200
参考
- 漢(オトコ)のコンピュータ道: 賢いdtraceの使い方
- 漢(オトコ)のコンピュータ道: D言語基礎文法最速マスター(DTraceのほう)
- http://wikis.sun.com/display/JpOpenSolaris/DTrace+Day+2010.03
- http://download.oracle.com/docs/cd/E19253-01/819-0395/index.html
- カーネル挙動を追尾する「DTrace」の実力 (1/8) - ITmedia エンタープライズ
- Brendan's blog » DTrace book sample chapter: File Systems
- http://www.oracle.com/technology/global/jp/sdn/solaris/solaris10/dtrace.html
- http://blogs.oracle.com/oracle4engineer/material/product/solaris/dtrace/
- http://hub.opensolaris.org/bin/view/Community+Group+dtrace/dtracetoolkit