Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(305)

Side by Side Diff: tools/binary_size/README.txt

Issue 132233017: Fix bug in binary_size script and cosmetic updates (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | tools/binary_size/run_binary_size_analysis.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 ================================================================================ 1 ================================================================================
2 __________ .__ 2 __________ .__
3 \______ \ |__| ____ _____ _______ ___.__. 3 \______ \ |__| ____ _____ _______ ___.__.
4 | | _/ | | / \ \__ \ \_ __ \ < | | 4 | | _/ | | / \ \__ \ \_ __ \ < | |
5 | | \ | | | | \ / __ \_ | | \/ \___ | 5 | | \ | | | | \ / __ \_ | | \/ \___ |
6 |______ / |__| |___| / (____ / |__| / ____| 6 |______ / |__| |___| / (____ / |__| / ____|
7 \/ \/ \/ \/ 7 \/ \/ \/ \/
8 _________ .__ ___________ .__ 8 _________ .__ ___________ .__
9 / _____/ |__| ________ ____ \__ ___/ ____ ____ | | 9 / _____/ |__| ________ ____ \__ ___/ ____ ____ | |
10 \_____ \ | | \___ / _/ __ \ | | / _ \ / _ \ | | 10 \_____ \ | | \___ / _/ __ \ | | / _ \ / _ \ | |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 44
45 1. Build your product as you normally would, e.g.: 45 1. Build your product as you normally would, e.g.:
46 ninja -C out/Release -j 100 content_shell_apk 46 ninja -C out/Release -j 100 content_shell_apk
47 47
48 2. Build the "binary_size_tool" target from ../../build/all_android.gyp, e.g.: 48 2. Build the "binary_size_tool" target from ../../build/all_android.gyp, e.g.:
49 ninja -C out/Release binary_size_tool 49 ninja -C out/Release binary_size_tool
50 50
51 3. Run the tool specifying the library and the output report directory. 51 3. Run the tool specifying the library and the output report directory.
52 This command will run the analysis on the Content Shell native library for 52 This command will run the analysis on the Content Shell native library for
53 Android using the nm/addr2line binaries from the Android NDK for ARM, 53 Android using the nm/addr2line binaries from the Android NDK for ARM,
54 producing an HTMl report in /tmp/report: 54 producing an HTML report in /tmp/report:
55 tools/binary_size/run_binary_size_analysis.py \ 55 tools/binary_size/run_binary_size_analysis.py \
56 --library out/Release/lib/libcontent_shell_content_view.so \ 56 --library out/Release/lib/libcontent_shell_content_view.so \
57 --destdir /tmp/report \ 57 --destdir /tmp/report \
58 --arch android-arm 58 --arch android-arm
59 59
60 Of course, there are additional options that you can see by running the tool 60 Of course, there are additional options that you can see by running the tool
61 with "--help". 61 with "--help".
62 62
63 This whole process takes about an hour on a modern (circa 2014) quad-core 63 This whole process takes about an hour on a modern (circa 2014) quad-core
64 machine. If you have LOTS of RAM, you can use the "--jobs" argument to 64 machine. If you have LOTS of RAM, you can use the "--jobs" argument to
(...skipping 15 matching lines...) Expand all
80 The report is completely standalone. No external resources are required, so the 80 The report is completely standalone. No external resources are required, so the
81 report may be saved and viewed offline with no problems. 81 report may be saved and viewed offline with no problems.
82 82
83 -------------------------------------------------------------------------------- 83 --------------------------------------------------------------------------------
84 Caveats 84 Caveats
85 -------------------------------------------------------------------------------- 85 --------------------------------------------------------------------------------
86 The tool is not perfect and has several shortcomings: 86 The tool is not perfect and has several shortcomings:
87 87
88 * Not all space in the binary is accounted for. The cause is still under 88 * Not all space in the binary is accounted for. The cause is still under
89 investigation. 89 investigation.
90 * When dealing with inlining and such, the size cost is attributed to the
91 resource in which the code gets inlined. Depending upon your goals for
92 analysis, this may be either good or bad; fundamentally, the more trickery
93 that the compiler and/or linker do, the less simple the relationship
94 between the original source and the resultant binary.
90 * The tool is partly written in Java, temporarily tying it to Android 95 * The tool is partly written in Java, temporarily tying it to Android
91 purely and solely because it needs Java build logic which is only defined 96 purely and solely because it needs Java build logic which is only defined
92 in the Android part of the build system. The Java portions need to be 97 in the Android part of the build system. The Java portions need to be
93 rewritten in Python so we can decouple from Android, or we need to find 98 rewritten in Python so we can decouple from Android, or we need to find
94 an alternative (readelf, linker maps, etc) to running nm/addr2line. 99 an alternative (readelf, linker maps, etc) to running nm/addr2line.
95 * The Java code assumes that the library file is within a Chromium release 100 * The Java code assumes that the library file is within a Chromium release
96 directory. This limits it to Chromium-based binaries only. 101 directory. This limits it to Chromium-based binaries only.
97 * The Java code has a hack to accurately identify the source of ICU data 102 * The Java code has a hack to accurately identify the source of ICU data
98 within the Chromium source tree due to missing symbols in the ICU ASM 103 within the Chromium source tree due to missing size information in the ICU
99 output. 104 ASM output in some build variants.
100 * The Python script assumes that arm-based and mips-based nm/addr2line 105 * The Python script assumes that arm-based and mips-based nm/addr2line
101 binaries exist in ../../third_party. This is true only when dealing with 106 binaries exist in ../../third_party/android_tools/ndk/toolchains. This is
102 Android and again limits the tool to Chromium-based binaries. 107 true only when dealing with Android and again limits the tool to
108 Chromium-based binaries.
103 * The Python script uses build system variables to construct the classpath 109 * The Python script uses build system variables to construct the classpath
104 for running the Java code. 110 for running the Java code.
105 * The Javascript code in the HTML report Assumes code lives in Chromium for 111 * The Javascript code in the HTML report Assumes code lives in Chromium for
106 generated hyperlinks and will not hyperlink any file that starts with the 112 generated hyperlinks and will not hyperlink any file that starts with the
107 substring "out". 113 substring "out".
108 114
109 -------------------------------------------------------------------------------- 115 --------------------------------------------------------------------------------
110 Feature Requests and Bug Reports 116 Feature Requests and Bug Reports
111 -------------------------------------------------------------------------------- 117 --------------------------------------------------------------------------------
112 Please file bugs and feature requests here, making sure to use the label 118 Please file bugs and feature requests here, making sure to use the label
113 "Binary-Size-Tool": 119 "Binary-Size-Tool":
114 https://code.google.com/p/chromium/issues/entry?labels=Binary-Size-Tool 120 https://code.google.com/p/chromium/issues/entry?labels=Binary-Size-Tool
115 121
116 View all open issues here: 122 View all open issues here:
117 https://code.google.com/p/chromium/issues/list?can=2&q=label:Binary-Size-Tool 123 https://code.google.com/p/chromium/issues/list?can=2&q=label:Binary-Size-Tool
OLDNEW
« no previous file with comments | « no previous file | tools/binary_size/run_binary_size_analysis.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698