Relocstat

From Apache OpenOffice Wiki
Revision as of 20:02, 15 November 2005 by Dkeskar (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

relocstat

This is a small Linux based perl tool using the output of various binutils tools, such as 'readelf' and 'objdump' to produce (hopefully) interesting statistics.

Where to get it

The source lives in ooo-build [here]. There is also a (mostly obsolete) tool 'preloc' there too for doing a simpler ranking of libraries wrt. unique named relocations. To run it you will need some version of binutils installed; and the readelf / objdump apps.

Sample output

$ relocstat ./libsb680li.so 
reading relocs .
./libsb680li.so total relocs 2106 external 95, internal weak 1142 (of which thnks 259), internal strong 869: saving 41%
.data:
 vtables: 90 size 11176 bytes - 35%
 rtti: 126 size 2072 bytes - 6.5%
 other: 250 size 18692 bytes - 59%

Data section contains 31944 bytes
reloc breakdown:
 vtables: 2493 - 33%
 rtti: 402 - 5.3%
 .data/non-vtable 3908 - 52%
 other: 724 - 9.6%
 grand-total: 7527

vtables breakdown
 vtables: 90
 slots / vtable: 25.5 slots
 self-impl / vtable: 10.1 slots
 parent-impl / vtable: 15.4 slots
 *extern-impl / vtable: 4.07 slots
 *extern-impl of self total: 0 slots

Caveats

while some of the data is accurate all the time; some of it is fragile. Particularly - the detection of what is & is not a vtable, is based on being able to detect all vtables by their symbol name. However visibility markup removes lots of this data - meaning we are likely to mis-characterize the .data section, and how it breaks down. Also - the joy of perl tooling is that you can read it yourself & fix bugs - send me patches (MM).

Personal tools