forked from mmeeks/dwarfprofile
-
Notifications
You must be signed in to change notification settings - Fork 1
/
README
89 lines (60 loc) · 2.54 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
dwarfprofile
============
Profile binary sizes using dwarf info
Invocation
==========
dwarfprofile -e <path/to/binary/or/dso> # analyse a single object
dwarfprofile -p <pid> # profile running process
Dependencies
============
openSUSE:
sudo zypper in libdw-devel libelf-devel
Fedora:
sudo yum install elfutils-libelf-devel elfutils-libelf elfutils-libs elfutils-devel
Versions
========
elfutils versions prior to 0.157 do not correctly handle the DWARF
output generated by current compilers. This is exhibited by having -ve
lengths for sections and lexical blocks with null names.
The source for elfutils is available from
https://fedorahosted.org/releases/e/l/elfutils/0.158/
The current version (0.158) builds correctly (usual ./configure && make)
regardless of libc and binutils versions.
LO output format
================
This profile is *purely* the actual used text (no data). It indicates the
cumulative total size (in bytes) and usage count for each component
(function/method) in a heirachical structure.
A method may have one or more lexical dwarf blocks within it, the
storage in these blocks is credited to the enclosing scope (the
method) but will increase the use count of the parent function
incorrectly. Because of this small use counts may be off by one and
alter the average excessively.
The output is repeated at different depths. A | indicates that the
line includes all the elements below that depth.
For example:
Breakdown at depth 2
Total Size Count Av. M Element
23214997 2001524 11 ssd1
23211463 2001366 11 lo
17425180 1739325 10 | master-suse
5786283 262041 22 | android
2176 110 19 ndk-toolchain
2176 110 19 | src
shows the beginning of a depth 2 output which means any elements below
a depth of two are merged togetehr. In this case it shows that the
ssd1/lo/master-suse source directory produced 17425180 bytes of code
in 1739325 references
Callgrind format
================
Some rough notes on the callgrind format. Details and examples are here:
http://valgrind.org/docs/manual/cl-format.html
The 'main' function is magic for kcachegrind it seems; so we need to
rename existing 'main' functions and insert a top-level to which
everything belongs.
Mach-o x86 binaries
===================
Mach-o apple binaries ship their dwarf section in a separate binary.
The objconv[1] tool can be used to convert these into elf binaries
which dwarfprofile can read.
[1] http://www.agner.org/optimize/#objconv