1 The following are demonstrations of the hotuser DTrace program.
4 Here, hotuser is run on a test program called "dofuncs", which is hard coded
5 to spend half its time in delta(), a third in beta() and a sixth in alpha().
7 # ./hotuser -c ./dofuncs
8 Sampling... Hit Ctrl-C to end.
11 dofuncs`alpha 511 16.5%
12 dofuncs`beta 1029 33.3%
13 dofuncs`delta 1552 50.2%
15 hotuser has accurately sampled which user-level functions are on the CPU,
16 producing a report of the expected breakdown. The hottest user-level function
17 is delta(), which was sampled 1552 times - 50.2% of the total samples.
21 Now hotuser is run on gunzip, to find which functions are most often
24 # ./hotuser -c 'gunzip contents.gz'
25 Sampling... Hit Ctrl-C to end.
28 libc.so.1`_free_unlocked 1 0.1%
31 gunzip`inflate_dynamic 1 0.1%
32 libc.so.1`_write 1 0.1%
33 gunzip`write_buf 1 0.1%
35 libc.so.1`write 2 0.3%
37 ld.so.1`rtld_db_preinit 3 0.4%
39 gunzip`huft_build 9 1.2%
40 libc_psr.so.1`memcpy 138 18.5%
41 gunzip`inflate_codes 233 31.2%
42 gunzip`updcrc 344 46.1%
44 This shows that updcrc() was sampled 344 times, and 46.1% of the total
49 A -l option will provide a breakdown on libraries only. hotuser
50 is run on gzip to show library usage only,
52 # ./hotuser -lc 'gzip contents'
53 Sampling... Hit Ctrl-C to end.
60 This shows that code in the gzip binary itself was on the CPU 99.1% of
61 the sample times, with libc_psr.so.1 code on the CPU 0.9% of the time.
65 The following shows library usage of mozilla. The pgrep command is used to
66 match the most recent PID of mozilla-bin.
68 # ./hotuser -lp `pgrep -n mozilla-bin`
69 Sampling... Hit Ctrl-C to end.
77 libblueprint.so 1 0.1%
80 libXrender.so.1 2 0.2%
86 libgtk-x11-2.0.so.0.400.9 5 0.5%
90 libwidget_gtk2.so 9 1.0%
92 libglib-2.0.so.0.400.1 14 1.5%
95 libxpconnect.so 22 2.4%
96 libgdk-x11-2.0.so.0.400.9 23 2.5%
97 libgobject-2.0.so.0.400.1 25 2.7%
98 libhtmlpars.so 27 3.0%
99 libfontconfig.so.1 41 4.5%
104 libgklayout.so 352 38.6%
106 This shows that 352 samples found code from libgklayout.so running, which
107 was 38.6% of the samples.