aboutsummaryrefslogtreecommitdiff
path: root/Examples/hotuser_example.txt
blob: c038acd6cda8a69541446cb47d7eb11cef7c095c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
The following are demonstrations of the hotuser DTrace program.


Here, hotuser is run on a test program called "dofuncs", which is hard coded
to spend half its time in delta(), a third in beta() and a sixth in alpha().

   # ./hotuser -c ./dofuncs
   Sampling... Hit Ctrl-C to end.
   ^C
   FUNCTION                                                COUNT   PCNT
   dofuncs`alpha                                             511  16.5%
   dofuncs`beta                                             1029  33.3%
   dofuncs`delta                                            1552  50.2%

hotuser has accurately sampled which user-level functions are on the CPU,
producing a report of the expected breakdown. The hottest user-level function
is delta(), which was sampled 1552 times - 50.2% of the total samples.



Now hotuser is run on gunzip, to find which functions are most often
on the CPU,

   # ./hotuser -c 'gunzip contents.gz'
   Sampling... Hit Ctrl-C to end.
   
   FUNCTION                                                COUNT   PCNT
   libc.so.1`_free_unlocked                                    1   0.1%
   gunzip`unzip                                                1   0.1%
   ld.so.1`strcmp                                              1   0.1%
   gunzip`inflate_dynamic                                      1   0.1%
   libc.so.1`_write                                            1   0.1%
   gunzip`write_buf                                            1   0.1%
   gunzip`0x2d990                                              2   0.3%
   libc.so.1`write                                             2   0.3%
   gunzip`0x2d994                                              2   0.3%
   ld.so.1`rtld_db_preinit                                     3   0.4%
   gunzip`0x2d98c                                              7   0.9%
   gunzip`huft_build                                           9   1.2%
   libc_psr.so.1`memcpy                                      138  18.5%
   gunzip`inflate_codes                                      233  31.2%
   gunzip`updcrc                                             344  46.1%

This shows that updcrc() was sampled 344 times, and 46.1% of the total
samples.



A -l option will provide a breakdown on libraries only. hotuser
is run on gzip to show library usage only,
   
   # ./hotuser -lc 'gzip contents'
   Sampling... Hit Ctrl-C to end.

   LIBRARY                                                 COUNT   PCNT
   libc.so.1                                                   2   0.0%
   libc_psr.so.1                                              37   0.9%
   gzip                                                     4113  99.1%

This shows that code in the gzip binary itself was on the CPU 99.1% of
the sample times, with libc_psr.so.1 code on the CPU 0.9% of the time.



The following shows library usage of mozilla. The pgrep command is used to
match the most recent PID of mozilla-bin.

   # ./hotuser -lp `pgrep -n mozilla-bin`
   Sampling... Hit Ctrl-C to end.
   ^C
   LIBRARY                                                 COUNT   PCNT
   libplds4.so                                                 1   0.1%
   libappcomps.so                                              1   0.1%
   libi18n.so                                                  1   0.1%
   libuconv.so                                                 1   0.1%
   libpref.so                                                  1   0.1%
   libblueprint.so                                             1   0.1%
   libz.so.1                                                   2   0.2%
   libcaps.so                                                  2   0.2%
   libXrender.so.1                                             2   0.2%
   libimglib2.so                                               2   0.2%
   libXft.so.2                                                 3   0.3%
   libCrun.so.1                                                3   0.3%
   libdocshell.so                                              3   0.3%
   libplc4.so                                                  4   0.4%
   libgtk-x11-2.0.so.0.400.9                                   5   0.5%
   libjsd.so                                                   5   0.5%
   libX11.so.4                                                 5   0.5%
   libnecko.so                                                 8   0.9%
   libwidget_gtk2.so                                           9   1.0%
   libgkgfx.so                                                13   1.4%
   libglib-2.0.so.0.400.1                                     14   1.5%
   libgfx_gtk.so                                              18   2.0%
   libnspr4.so                                                20   2.2%
   libxpconnect.so                                            22   2.4%
   libgdk-x11-2.0.so.0.400.9                                  23   2.5%
   libgobject-2.0.so.0.400.1                                  25   2.7%
   libhtmlpars.so                                             27   3.0%
   libfontconfig.so.1                                         41   4.5%
   libxpcom.so                                                49   5.4%
   mozilla-bin                                                55   6.0%
   libmozjs.so                                                80   8.8%
   libc.so.1                                                 115  12.6%
   libgklayout.so                                            352  38.6%

This shows that 352 samples found code from libgklayout.so running, which
was 38.6% of the samples.