Add sizes.py metrics to resource_sizes.py |
|||
Issue description
sizes.py reports the per-section breakdown of libchrome.so. However, we don't run this script on the bots.
Rather than run the script, it would be a bit nicer to integrate this with resource_sizes.py (so that all the breakdowns is available on the perf dashboard under one category).
sizes.py uses the "size" command to report section sizes. For libchrome.so, this outputs:
src/out-gn/Release (master)$ size libchrome.so
text data bss dec hex filename
47420056 2038620 1341704 50800380 30726fc libchrome.so
However, running bloaty on libchrome.so gives:
$ ~/ssd/git/bloaty/bloaty libchrome.so -s file
VM SIZE FILE SIZE
-------------- --------------
72.5% 35.1Mi .text 35.1Mi 74.5%
11.6% 5.62Mi .rodata 5.62Mi 11.9%
5.3% 2.58Mi .rel.dyn 2.58Mi 5.5%
3.1% 1.49Mi .ARM.exidx 1.49Mi 3.2%
2.2% 1.05Mi .data.rel.ro 1.05Mi 2.2%
1.6% 776Ki .data.rel.ro.local 776Ki 1.6%
0.4% 190Ki .ARM.extab 190Ki 0.4%
0.3% 136Ki .dynstr 136Ki 0.3%
0.2% 95.4Ki .data 95.4Ki 0.2%
0.1% 45.2Ki .got 45.2Ki 0.1%
0.1% 39.8Ki .dynsym 39.8Ki 0.1%
0.0% 18.0Ki .hash 18.0Ki 0.0%
0.0% 4.98Ki .gnu.version 4.98Ki 0.0%
0.0% 4.20Ki .plt 4.20Ki 0.0%
0.0% 116 [Unmapped] 3.55Ki 0.0%
0.0% 2.79Ki .rel.plt 2.79Ki 0.0%
0.0% 340 [ELF Headers] 1.43Ki 0.0%
2.6% 1.28Mi [Other] 622 0.0%
0.0% 304 .dynamic 304 0.0%
0.0% 0 .shstrtab 286 0.0%
0.0% 8 [None] 0 0.0%
100.0% 48.4Mi TOTAL 47.2Mi 100.0%
Note: $ ls -l libchrome.so
-rwxr-xr-x 1 agrieve eng 49464272 Jan 13 10:36 libchrome.so*
Running size with -A gives:
$ size -A libchrome.so
libchrome.so :
section size addr
.interp 19 340
.note.gnu.build-id 36 360
.dynsym 40768 396
.dynstr 139868 41164
.hash 18412 181032
.gnu.version 5096 199444
.gnu.version_d 28 204540
.gnu.version_r 96 204568
.rel.dyn 2704608 204664
.rel.plt 2856 2909272
.plt 4304 2912128
.text 36855940 2916480
.ARM.exidx 1559496 39772420
.rodata 5893237 41331968
.ARM.extab 195292 47225208
.data.rel.ro.local 794680 47428112
.data.rel.ro 1099432 48222800
.init_array 220 49322232
.fini_array 8 49322452
.dynamic 304 49322460
.got 46320 49322768
.data 97656 49369088
.bss 1341704 49466752
.comment 127 0
.note.gnu.gold-version 28 0
.ARM.attributes 60 0
Total 50800595
This aligns with bloaty with the exception that "bss" is 1MB vs 0. If you take size total (50800595) - bss (1341704) = 49458891, which is very close to the actual file size. So, I think bloaty is wrong about .bss, and the actual size of it is 0.
Just in case there aren't enough options yet, you can also use readelf:
$ readelf -S libchrome.so
There are 28 section headers, starting at offset 0x2f2bf70:
Section Headers:
[Nr] Name Type Addr Off Size ES Flg Lk Inf Al
[ 0] NULL 00000000 000000 000000 00 0 0 0
[ 1] .interp PROGBITS 00000154 000154 000013 00 A 0 0 1
[ 2] .note.gnu.build-i NOTE 00000168 000168 000024 00 A 0 0 4
[ 3] .dynsym DYNSYM 0000018c 00018c 009f40 10 A 4 1 4
[ 4] .dynstr STRTAB 0000a0cc 00a0cc 02225c 00 A 0 0 1
[ 5] .hash HASH 0002c328 02c328 0047ec 04 A 3 0 4
[ 6] .gnu.version VERSYM 00030b14 030b14 0013e8 02 A 3 0 2
[ 7] .gnu.version_d VERDEF 00031efc 031efc 00001c 00 A 4 1 4
[ 8] .gnu.version_r VERNEED 00031f18 031f18 000060 00 A 4 3 4
[ 9] .rel.dyn REL 00031f78 031f78 2944e0 08 A 3 0 4
[10] .rel.plt REL 002c6458 2c6458 000b28 08 AI 3 11 4
[11] .plt PROGBITS 002c6f80 2c6f80 0010d0 00 AX 0 0 4
[12] .text PROGBITS 002c8080 2c8080 2326084 00 AX 0 0 64
[13] .ARM.exidx ARM_EXIDX 025ee104 25ee104 17cbc8 08 AL 12 0 4
[14] .rodata PROGBITS 0276ad00 276ad00 59ec75 00 A 0 0 256
[15] .ARM.extab PROGBITS 02d09978 2d09978 02fadc 00 A 0 0 4
[16] .data.rel.ro.loca PROGBITS 02d3b210 2d3a210 0c2038 00 WA 0 0 16
[17] .data.rel.ro PROGBITS 02dfd250 2dfc250 10c6a8 00 WA 0 0 16
[18] .init_array INIT_ARRAY 02f098f8 2f088f8 0000dc 00 WA 0 0 4
[19] .fini_array FINI_ARRAY 02f099d4 2f089d4 000008 00 WA 0 0 4
[20] .dynamic DYNAMIC 02f099dc 2f089dc 000130 08 WA 4 0 4
[21] .got PROGBITS 02f09b10 2f08b10 00b4f0 00 WA 0 0 4
[22] .data PROGBITS 02f15000 2f14000 017d78 00 WA 0 0 16
[23] .bss NOBITS 02f2cd80 2f2bd78 147908 00 WA 0 0 32
[24] .comment PROGBITS 00000000 2f2bd78 00007f 01 MS 0 0 1
[25] .note.gnu.gold-ve NOTE 00000000 2f2bdf8 00001c 00 0 0 4
[26] .ARM.attributes ARM_ATTRIBUTES 00000000 2f2be14 00003c 00 0 0 1
[27] .shstrtab STRTAB 00000000 2f2be50 00011e 00 0 0 1
Key to Flags:
W (write), A (alloc), X (execute), M (merge), S (strings)
I (info), L (link order), G (group), T (TLS), E (exclude), x (unknown)
O (extra OS processing required) o (OS specific), p (processor specific)
Bottom line, I think we should:
1. Run "readelf -S libchrome.so" on the main native library found by resource_sizes.py
2. Report sizes of:
a) text = .text
b) data = .data + .rodata
c) relocations = .rel.dyn + .rel.plt + data.rel.ro + dat.rel.ro.local
d) unwind = .ARM.extab + .ARM.exidx
e) symbols = .dynsym + .dynstr + .dynamic + .shstrtab + .got + .plt
f) other = whatever else. (minus .bss, which doesn't actually take up space)
,
Jan 19 2017
,
Feb 3 2017
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/51583da63dae5f4c3baa9a229160b2c027afffb4 commit 51583da63dae5f4c3baa9a229160b2c027afffb4 Author: estevenson <estevenson@chromium.org> Date: Fri Feb 03 14:35:58 2017 Add main lib section sizes to resource_sizes.py. This CL adds detailed metrics for the main native library section sizes, grouped into "text", "data", "relocations", "unwind", "symbols", and "other" sections. These categories are added under a new subtest: "_MainLibInfo". BUG= 681153 Review-Url: https://codereview.chromium.org/2675703003 Cr-Commit-Position: refs/heads/master@{#447991} [modify] https://crrev.com/51583da63dae5f4c3baa9a229160b2c027afffb4/build/android/resource_sizes.py
,
Feb 3 2017
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/9f800ec0044b9c7c7c88553f406cc5e146e72516 commit 9f800ec0044b9c7c7c88553f406cc5e146e72516 Author: estevenson <estevenson@chromium.org> Date: Fri Feb 03 15:08:59 2017 Revert of Add main lib section sizes to resource_sizes.py. (patchset #5 id:80001 of https://codereview.chromium.org/2675703003/ ) Reason for revert: Breaks some Cronet builders because their native lib has different sections: https://build.chromium.org/p/chromium.android/builders/Android%20Cronet%20ARM64%20Builder/builds/48257 Original issue's description: > Add main lib section sizes to resource_sizes.py. > > This CL adds detailed metrics for the main native library section sizes, > grouped into "text", "data", "relocations", "unwind", "symbols", and > "other" sections. These categories are added under a new subtest: > "_MainLibInfo". > > BUG= 681153 > > Review-Url: https://codereview.chromium.org/2675703003 > Cr-Commit-Position: refs/heads/master@{#447991} > Committed: https://chromium.googlesource.com/chromium/src/+/51583da63dae5f4c3baa9a229160b2c027afffb4 TBR=agrieve@chromium.org # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG= 681153 TBR=agrieve@chromium.org Review-Url: https://codereview.chromium.org/2673043002 Cr-Commit-Position: refs/heads/master@{#447999} [modify] https://crrev.com/9f800ec0044b9c7c7c88553f406cc5e146e72516/build/android/resource_sizes.py
,
Feb 3 2017
readelf -S --wide libchrome.so on 64 bit chrome: There are 24 section headers, starting at offset 0x40a0c28: Section Headers: [Nr] Name Type Address Off Size ES Flg Lk Inf Al [ 0] NULL 0000000000000000 000000 000000 00 0 0 0 [ 1] .note.gnu.build-id NOTE 00000000006681c8 0001c8 000024 00 A 0 0 4 [ 2] .hash HASH 00000000006681f0 0001f0 003154 04 A 3 0 8 [ 3] .dynsym DYNSYM 000000000066b348 003348 00c960 18 A 4 3 8 [ 4] .dynstr STRTAB 0000000000677ca8 00fca8 01ca3f 00 A 0 0 1 [ 5] .gnu.version VERSYM 00000000006946e8 02c6e8 0010c8 02 A 3 0 2 [ 6] .gnu.version_r VERNEED 00000000006957b0 02d7b0 000060 00 A 4 3 8 [ 7] .rela.dyn LOOS+2 0000000000695810 02d810 12e068 01 A 3 0 8 [ 8] .rela.plt RELA 00000000007c3878 15b878 0026b8 18 AI 3 9 8 [ 9] .plt PROGBITS 00000000007c5f30 15df30 0019f0 10 AX 0 0 16 [10] .text PROGBITS 00000000007c7940 15f940 35f7960 00 AX 0 0 64 [11] .rodata PROGBITS 0000000003dbf300 3757300 5a4f50 00 A 0 0 256 [12] .eh_frame_hdr PROGBITS 0000000004364250 3cfc250 00187c 00 A 0 0 4 [13] .eh_frame PROGBITS 0000000004365ad0 3cfdad0 006db0 00 A 0 0 8 [14] .gcc_except_table PROGBITS 000000000436c880 3d04880 008a74 00 A 0 0 4 [15] .init_array INIT_ARRAY 0000000004386070 3d0e070 000230 00 WA 0 0 8 [16] .fini_array FINI_ARRAY 00000000043862a0 3d0e2a0 000010 00 WA 0 0 8 [17] .data.rel.ro PROGBITS 00000000043862b0 3d0e2b0 352758 00 WA 0 0 16 [18] .dynamic DYNAMIC 00000000046d8a08 4060a08 000230 10 WA 4 0 8 [19] .got PROGBITS 00000000046d8c38 4060c38 0163c0 08 WA 0 0 8 [20] .data PROGBITS 00000000046ef000 4077000 029ae0 00 WA 0 0 32 [21] .bss NOBITS 0000000004718ae0 40a0ae0 167400 00 WA 0 0 32 [22] .comment PROGBITS 0000000000000000 40a0ae0 000064 01 MS 0 0 1 [23] .shstrtab STRTAB 0000000000000000 40a0b44 0000e3 00 0 0 1 Key to Flags: W (write), A (alloc), X (execute), M (merge), S (strings) I (info), L (link order), G (group), T (TLS), E (exclude), x (unknown) O (extra OS processing required) o (OS specific), p (processor specific) Categories to add: - relocations: .rela.dyn, .rela.plt - other: .eh_frame_hdr, eh_frame, .gcc_except_table
,
Feb 3 2017
ChromePublic arm 64: There are 24 section headers, starting at offset 0x40a0c28: Section Headers: [Nr] Name Type Address Off Size ES Flg Lk Inf Al [ 0] NULL 0000000000000000 000000 000000 00 0 0 0 [ 1] .note.gnu.build-id NOTE 00000000006681c8 0001c8 000024 00 A 0 0 4 [ 2] .hash HASH 00000000006681f0 0001f0 003154 04 A 3 0 8 [ 3] .dynsym DYNSYM 000000000066b348 003348 00c960 18 A 4 3 8 [ 4] .dynstr STRTAB 0000000000677ca8 00fca8 01ca3f 00 A 0 0 1 [ 5] .gnu.version VERSYM 00000000006946e8 02c6e8 0010c8 02 A 3 0 2 [ 6] .gnu.version_r VERNEED 00000000006957b0 02d7b0 000060 00 A 4 3 8 [ 7] .rela.dyn LOOS+2 0000000000695810 02d810 12e068 01 A 3 0 8 [ 8] .rela.plt RELA 00000000007c3878 15b878 0026b8 18 AI 3 9 8 [ 9] .plt PROGBITS 00000000007c5f30 15df30 0019f0 10 AX 0 0 16 [10] .text PROGBITS 00000000007c7940 15f940 35f7960 00 AX 0 0 64 [11] .rodata PROGBITS 0000000003dbf300 3757300 5a4f50 00 A 0 0 256 [12] .eh_frame_hdr PROGBITS 0000000004364250 3cfc250 00187c 00 A 0 0 4 [13] .eh_frame PROGBITS 0000000004365ad0 3cfdad0 006db0 00 A 0 0 8 [14] .gcc_except_table PROGBITS 000000000436c880 3d04880 008a74 00 A 0 0 4 [15] .init_array INIT_ARRAY 0000000004386070 3d0e070 000230 00 WA 0 0 8 [16] .fini_array FINI_ARRAY 00000000043862a0 3d0e2a0 000010 00 WA 0 0 8 [17] .data.rel.ro PROGBITS 00000000043862b0 3d0e2b0 352758 00 WA 0 0 16 [18] .dynamic DYNAMIC 00000000046d8a08 4060a08 000230 10 WA 4 0 8 [19] .got PROGBITS 00000000046d8c38 4060c38 0163c0 08 WA 0 0 8 [20] .data PROGBITS 00000000046ef000 4077000 029ae0 00 WA 0 0 32 [21] .bss NOBITS 0000000004718ae0 40a0ae0 167400 00 WA 0 0 32 [22] .comment PROGBITS 0000000000000000 40a0ae0 000064 01 MS 0 0 1 [23] .shstrtab STRTAB 0000000000000000 40a0b44 0000e3 00 0 0 1 Key to Flags: W (write), A (alloc), X (execute), M (merge), S (strings) I (info), L (link order), G (group), T (TLS), E (exclude), x (unknown) O (extra OS processing required) o (OS specific), p (processor specific) ChromePublic arm: There are 28 section headers, starting at offset 0x290c71c: Section Headers: [Nr] Name Type Addr Off Size ES Flg Lk Inf Al [ 0] NULL 00000000 000000 000000 00 0 0 0 [ 1] .interp PROGBITS 00237154 000154 000013 00 A 0 0 1 [ 2] .note.gnu.build-id NOTE 00237168 000168 000024 00 A 0 0 4 [ 3] .dynsym DYNSYM 0023718c 00018c 008400 10 A 4 1 4 [ 4] .dynstr STRTAB 0023f58c 00858c 01c040 00 A 0 0 1 [ 5] .hash HASH 0025b5cc 0245cc 00411c 04 A 3 0 4 [ 6] .gnu.version VERSYM 0025f6e8 0286e8 001080 02 A 3 0 2 [ 7] .gnu.version_d VERDEF 00260768 029768 00001c 00 A 4 1 4 [ 8] .gnu.version_r VERNEED 00260784 029784 000060 00 A 4 3 4 [ 9] .rel.dyn LOOS+1 002607e4 0297e4 051a40 01 A 3 0 4 [10] .rel.plt REL 002b2224 07b224 000b18 08 AI 3 11 4 [11] .plt PROGBITS 002b2d3c 07bd3c 0010b8 00 AX 0 0 4 [12] .text PROGBITS 002b3e00 07ce00 2125f18 00 AX 0 0 64 [13] .rodata PROGBITS 023d9e00 21a2e00 57c29e 00 A 0 0 256 [14] .ARM.exidx ARM_EXIDX 029560a0 271f0a0 0012b8 08 AL 12 0 4 [15] .ARM.extab PROGBITS 02957358 2720358 003614 00 A 0 0 4 [16] .data.rel.ro.local PROGBITS 0295bd00 2723d00 0b5488 00 WA 0 0 8 [17] .data.rel.ro PROGBITS 02a11190 27d9190 10ab90 00 WA 0 0 16 [18] .init_array INIT_ARRAY 02b1bd20 28e3d20 00011c 00 WA 0 0 4 [19] .fini_array FINI_ARRAY 02b1be3c 28e3e3c 000008 00 WA 0 0 4 [20] .dynamic DYNAMIC 02b1be44 28e3e44 000130 08 WA 4 0 4 [21] .got PROGBITS 02b1bf80 28e3f80 00b080 00 WA 0 0 4 [22] .data PROGBITS 02b27000 28ef000 01d53c 00 WA 0 0 32 [23] .bss NOBITS 02b44540 290c53c 178868 00 WA 0 0 32 [24] .comment PROGBITS 00000000 290c53c 000065 01 MS 0 0 1 [25] .note.gnu.gold-version NOTE 00000000 290c5a4 00001c 00 0 0 4 [26] .ARM.attributes ARM_ATTRIBUTES 00000000 290c5c0 00003c 00 0 0 1 [27] .shstrtab STRTAB 00000000 290c5fc 00011e 00 0 0 1 Key to Flags: W (write), A (alloc), X (execute), M (merge), S (strings) I (info), L (link order), G (group), T (TLS), E (exclude), x (unknown) O (extra OS processing required) o (OS specific), p (processor specific)
,
Feb 6 2017
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/b57a134073e5e119fdd498025050feda8c0c5353 commit b57a134073e5e119fdd498025050feda8c0c5353 Author: estevenson <estevenson@chromium.org> Date: Mon Feb 06 11:34:23 2017 Reland of Add main lib section sizes to resource_sizes.py. Reverted in: https://codereview.chromium.org/2673043002/. Reason for reland: |_ExtractMainLibSectionSizesFromApk()| now handles multiline readelf output and missing section headers. This CL adds more detailed metrics for the main native library section sizes. The new metrics are added under a new subtest: "_MainLibInfo". BUG= 681153 Review-Url: https://codereview.chromium.org/2673023003 Cr-Commit-Position: refs/heads/master@{#448229} [modify] https://crrev.com/b57a134073e5e119fdd498025050feda8c0c5353/build/android/resource_sizes.py
,
Feb 10 2017
|
|||
►
Sign in to add a comment |
|||
Comment 1 by agrieve@chromium.org
, Jan 16 2017