From: Arnaldo Carvalho de Melo <acme-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
To: Erik Ekman <yarrick-UYDU3/A3LUY@public.gmane.org>
Cc: dwarves-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: Creating ELF function/file size statistics
Date: Thu, 31 Jan 2008 10:23:45 -0200 [thread overview]
Message-ID: <20080131122345.GJ1819@ghostprotocols.net> (raw)
> I am doing some developing in C and want to see ELF size per function,
> file and directory. Right now I extract the sizes of functions and
> fields from objdump and use an ugly sed hack to find the file of each
> function/object, and then a python script that does some matching.
> I read about the DWARF format and it seems it includes the things I
> need. The output from objdump -W and eu-readelf -w shows that
> functions and object are tied to a file in some way.
> Does any of the existing dwarf programs do this? pdwtags looked as a
> best fit from reading the OLS paper. I have not fetched the latest
> source yet due to some workplace firewalls. If no tool does this and
> it is possible, then I am interested in developing one.
> Please cc me, i am not on the list.
I had to look up your address on the net and only saw your message today
because I don't use the newsgroups interface regularly, anyway:
pfunct is the tool, look at this, the top 5 functions per .o file on a
directory hierarchy:
[acme@doppio pahole]$ find examples -name "*.o" | while read file ; do \
echo "---> $file" ; \
pfunct --sizes $file | sort -k2 -nr | head -5 ; \
echo "--------" ; done
---> examples/qsize.o
operator<<: 164
operator>>: 83
q_atomic_decrement: 25
--------
---> examples/prototype1.o
main: 50
--------
---> examples/qsettings.o
getPath: 1233
checkAccess: 762
globalMutex: 277
iniChopTrailingSpaces: 259
unusedCacheFunc: 229
--------
---> examples/multi-cu/main.o
main: 63
--------
---> examples/multi-cu/a.o
a_foo_print: 29
--------
---> examples/prototype2.o
foo: 27
--------
[acme@doppio pahole]$
There are more options, some useful, some just for laughs, like
--function_name_len:
----------------------------- 8< -------------------------------------------
[acme@doppio pahole]$ pfunct --help
Usage: pfunct [OPTION...] -e [FILE] {[FUNCTION]}
-c, --class=CLASS functions that have CLASS pointer parameters
-E, --externals show just external functions
-f, --function=FUNCTION show just FUNCTION
-g, --goto_labels show number of goto labels
-G, --cc_uninlined declared inline, uninlined by compiler
-H, --cc_inlined not declared inline, inlined by compiler
-i, --inline_expansions show inline expansions
-I, --inline_expansions_stats show inline expansions stats
-l, --decl_info show source code info
-N, --function_name_len show size of functions names
-p, --nr_parms show number of parameters
-s, --sizes show size of functions
-S, --nr_variables show number of variables
-t, --total_inline_stats show Multi-CU total inline expansions stats
-T, --variables show variables
-V, --verbose be verbose
Input selection options:
--debuginfo-path=PATH Search path for separate debuginfo files
-e, --executable=FILE Find addresses in FILE
-k, --kernel Find addresses in the running kernel
-K, --offline-kernel[=RELEASE] Kernel with all modules
-M, --linux-process-map=FILE Find addresses in files mapped as read from
FILE in Linux /proc/PID/maps format
--pid=PID Find addresses in files mapped into process PID
-?, --help Give this help list
--usage Give a short usage message
Mandatory or optional arguments to long options are also mandatory or optional
for any corresponding short options.
----------------------------- 8< -------------------------------------------
- Arnaldo
next reply other threads:[~2008-01-31 12:23 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-01-31 12:23 Arnaldo Carvalho de Melo [this message]
-- strict thread matches above, loose matches on Subject: below --
2008-01-28 15:31 Creating ELF function/file size statistics Erik Ekman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20080131122345.GJ1819@ghostprotocols.net \
--to=acme-h+wxahxf7alqt0dzr+alfa@public.gmane.org \
--cc=dwarves-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=yarrick-UYDU3/A3LUY@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).