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

Side by Side Diff: build/android/resource_sizes.py

Issue 2172303002: 🎫 Track uncompressed sizes in resource_sizes.py (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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 | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/python
2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2011 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """Prints the size of each given file and optionally computes the size of 6 """Prints the size of each given file and optionally computes the size of
7 libchrome.so without the dependencies added for building with android NDK. 7 libchrome.so without the dependencies added for building with android NDK.
8 Also breaks down the contents of the APK to determine the installed size 8 Also breaks down the contents of the APK to determine the installed size
9 and assign size contributions to different classes of file. 9 and assign size contributions to different classes of file.
10 """ 10 """
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 for group in FILE_GROUPS: 210 for group in FILE_GROUPS:
211 if re.search(group.regex, member.filename): 211 if re.search(group.regex, member.filename):
212 found_files[group].append(member) 212 found_files[group].append(member)
213 break 213 break
214 else: 214 else:
215 raise KeyError('No group found for file "%s"' % member.filename) 215 raise KeyError('No group found for file "%s"' % member.filename)
216 216
217 total_install_size = total_apk_size 217 total_install_size = total_apk_size
218 218
219 for group in FILE_GROUPS: 219 for group in FILE_GROUPS:
220 apk_size = sum(member.compress_size for member in found_files[group]) 220 uncompressed_size = sum(member.file_size for member in found_files[group])
221 install_size = apk_size 221 packed_size = sum(member.compress_size for member in found_files[group])
222 install_bytes = sum(f.file_size for f in found_files[group] 222 install_size = packed_size
223 if group.extracted(f.filename)) 223 install_bytes = sum(member.file_size for member in found_files[group]
224 if group.extracted(member.filename))
224 install_size += install_bytes 225 install_size += install_bytes
225 total_install_size += install_bytes 226 total_install_size += install_bytes
226 227
227 ReportPerfResult(chartjson, apk_basename + '_Breakdown', 228 ReportPerfResult(chartjson, apk_basename + '_Breakdown',
228 group.name + ' size', apk_size, 'bytes') 229 group.name + ' size', packed_size, 'bytes')
229 ReportPerfResult(chartjson, apk_basename + '_InstallBreakdown', 230 ReportPerfResult(chartjson, apk_basename + '_InstallBreakdown',
230 group.name + ' size', install_size, 'bytes') 231 group.name + ' size', install_size, 'bytes')
232 ReportPerfResult(chartjson, apk_basename + '_Uncompressed',
233 group.name + ' size', uncompressed_size, 'bytes')
231 234
232 transfer_size = _CalculateCompressedSize(apk_filename) 235 transfer_size = _CalculateCompressedSize(apk_filename)
233 ReportPerfResult(chartjson, apk_basename + '_InstallSize', 236 ReportPerfResult(chartjson, apk_basename + '_InstallSize',
234 'Estimated installed size', total_install_size, 'bytes') 237 'Estimated installed size', total_install_size, 'bytes')
235 ReportPerfResult(chartjson, apk_basename + '_InstallSize', 'APK size', 238 ReportPerfResult(chartjson, apk_basename + '_InstallSize', 'APK size',
236 total_apk_size, 'bytes') 239 total_apk_size, 'bytes')
237 ReportPerfResult(chartjson, apk_basename + '_TransferSize', 240 ReportPerfResult(chartjson, apk_basename + '_TransferSize',
238 'Transfer size (deflate)', transfer_size, 'bytes') 241 'Transfer size (deflate)', transfer_size, 'bytes')
239 242
240 243
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
451 454
452 if chartjson: 455 if chartjson:
453 results_path = os.path.join(options.output_dir, 'results-chart.json') 456 results_path = os.path.join(options.output_dir, 'results-chart.json')
454 logging.critical('Dumping json to %s', results_path) 457 logging.critical('Dumping json to %s', results_path)
455 with open(results_path, 'w') as json_file: 458 with open(results_path, 'w') as json_file:
456 json.dump(chartjson, json_file) 459 json.dump(chartjson, json_file)
457 460
458 461
459 if __name__ == '__main__': 462 if __name__ == '__main__':
460 sys.exit(main(sys.argv)) 463 sys.exit(main(sys.argv))
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698