dwarves.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Creating ELF function/file size statistics
@ 2008-01-28 15:31 Erik Ekman
  0 siblings, 0 replies; 2+ messages in thread
From: Erik Ekman @ 2008-01-28 15:31 UTC (permalink / raw)
  To: dwarves-u79uwXL29TY76Z2rM5mHXA

Hi

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.

/Erik

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Creating ELF function/file size statistics
@ 2008-01-31 12:23 Arnaldo Carvalho de Melo
  0 siblings, 0 replies; 2+ messages in thread
From: Arnaldo Carvalho de Melo @ 2008-01-31 12:23 UTC (permalink / raw)
  To: Erik Ekman; +Cc: dwarves-u79uwXL29TY76Z2rM5mHXA

> 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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-01-31 12:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-01-28 15:31 Creating ELF function/file size statistics Erik Ekman
2008-01-31 12:23 Arnaldo Carvalho de Melo

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).