Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 14 Jan 2015 09:17:04 -0500
From:      John Baldwin <jhb@FreeBSD.org>
To:        "O'Connor, Daniel" <darius@dons.net.au>,  FreeBSD Stable Mailing List <freebsd-stable@freebsd.org>
Subject:   Re: DTrace and function names
Message-ID:  <54B67A60.2000708@FreeBSD.org>
In-Reply-To: <ED72FCF4-7917-4EA9-8331-A940F70E2578@dons.net.au>
References:  <ED72FCF4-7917-4EA9-8331-A940F70E2578@dons.net.au>

next in thread | previous in thread | raw e-mail | index | archive | help
On 1/12/15 7:20 PM, O'Connor, Daniel wrote:
> Hi,
> I am trying to debug why astro/gpsd uses a lot of CPU so I thought I'd try the 'hotuser' Dtrace toolkit script but the output looks like so..
> [midget 9:24] ~ >sudo  /usr/local/share/DTraceToolkit/hotuser -p 37690
> Password:
> Sampling... Hit Ctrl-C to end.
> ^C
> FUNCTION                                                COUNT   PCNT
> libc.so.7`0x801631777                                       1   0.0%
> libc.so.7`strtol                                            1   0.0%
> libc.so.7`0x801631658                                       1   0.0%
> libc.so.7`0x801631625                                       1   0.0%
> libc.so.7`0x801631636                                       1   0.0%
> libc.so.7`0x801631566                                       1   0.0%
> libc.so.7`0x801631623                                       1   0.0%
> gpsd`0x405ba6                                               1   0.0%
> gpsd`0x404fd6                                               1   0.0%
> libc.so.7`0x801631797                                      10   0.0%
> libc.so.7`0x8016315f9                                      50   0.2%
> libc.so.7`0x80163165c                                      63   0.2%
> libc.so.7`0x80163179b                                     115   0.4%
> libc.so.7`0x8016315b9                                     119   0.4%
> libc.so.7`0x801631794                                     135   0.5%
> libc.so.7`0x801631791                                     170   0.6%
> libc.so.7`0x801631601                                     212   0.8%
> libc.so.7`0x80163165d                                     226   0.8%
> libc.so.7`0x801631757                                     233   0.8%
> libc.so.7`0x8016315bd                                     235   0.8%
> gpsd`0x4028bc                                             237   0.8%
> libc.so.7`0x801631736                                     238   0.9%
> libc.so.7`0x80163156a                                     239   0.9%
> libc.so.7`0x801631617                                     243   0.9%
> gpsd`0x4084ea                                             246   0.9%
> gpsd`0x408508                                             251   0.9%
> libc.so.7`0x8016317a0                                     251   0.9%
> libc.so.7`0x801631571                                     252   0.9%
> libc.so.7`0x801631749                                     252   0.9%
> libc.so.7`0x801631583                                     253   0.9%
> libc.so.7`0x8016315c7                                     256   0.9%
> libc.so.7`0x801631727                                     259   0.9%
> gpsd`0x4084fa                                             261   0.9%
> libc.so.7`0x8016315ed                                     264   0.9%
> libc.so.7`0x8016315a6                                     264   0.9%
> libc.so.7`0x801631775                                     264   0.9%
> libc.so.7`0x801631789                                     266   1.0%
> libc.so.7`0x801631564                                     267   1.0%
> libc.so.7`0x8016316e4                                     268   1.0%
> libc.so.7`0x8016316eb                                     271   1.0%
> libc.so.7`0x8016315d9                                     274   1.0%
> libc.so.7`0x801631771                                     276   1.0%
> libc.so.7`0x801631656                                     278   1.0%
> libc.so.7`0x8016315dd                                     287   1.0%
> libc.so.7`0x8016316e0                                     288   1.0%
> libc.so.7`0x801631615                                     292   1.0%
> libc.so.7`0x801631782                                     295   1.1%
> libc.so.7`0x801631611                                     306   1.1%
> libc.so.7`0x80163175c                                     336   1.2%
> libc.so.7`0x801631790                                     349   1.3%
> libc.so.7`0x8016315b3                                     485   1.7%
> libc.so.7`0x80163177e                                     529   1.9%
> libc.so.7`0x801631767                                     550   2.0%
> libc.so.7`clock_gettime                                   769   2.8%
> libc.so.7`0x801631764                                     796   2.9%
> libc.so.7`0x8016315d5                                     800   2.9%
> libc.so.7`0x80163164f                                    1029   3.7%
> libc.so.7`0x801631607                                    1106   4.0%
> libc.so.7`0x801631593                                    1335   4.8%
> libc.so.7`0x8016315a0                                    1634   5.9%
> libc.so.7`0x80163159a                                    1849   6.6%
> libc.so.7`0x80163160c                                    2132   7.6%
> gpsd`gpsd_report                                         2162   7.8%
> libc.so.7`0x80163179d                                    3052  10.9%
> 
> So it shows _some_ function names from libc but mostly not.. Is there a way to improve it?

Build with debug symbols?  For libc you can do that via:

% cd /usr/src/lib/libc
% make cleandir
% make obj
# May want to use "-O -g" to reduce inlining
% make DEBUG_FLAGS="-g" depend all install

For gpsd you'll have to figure out a way to get it built with extra
symbols (if the port has a DEBUG option, enable that, otherwise you
might have to hack the port).

-- 
John Baldwin



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?54B67A60.2000708>