Training courses

Kernel and Embedded Linux

Bootlin training courses

Embedded Linux, kernel,
Yocto Project, Buildroot, real-time,
graphics, boot time, debugging...

Bootlin logo

Elixir Cross Referencer

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.