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

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

Issue 2101243005: Add a snapshot of flutter/engine/src/build to our sdk (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: add README.dart 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 | « build/android/locale_pak_resources.gypi ('k') | build/android/native_app_dependencies.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #! /usr/bin/env python
2 # Copyright 2015 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file.
5
6 import argparse
7 import os
8 import re
9 import sys
10
11 from pylib import constants
12 from pylib.sdk import dexdump
13
14 sys.path.append(os.path.join(constants.DIR_SOURCE_ROOT, 'build', 'util', 'lib',
15 'common'))
16 import perf_tests_results_helper
17
18
19 _METHOD_IDS_SIZE_RE = re.compile(r'^method_ids_size +: +(\d+)$')
20
21 def MethodCount(dexfile):
22 for line in dexdump.DexDump(dexfile, file_summary=True):
23 m = _METHOD_IDS_SIZE_RE.match(line)
24 if m:
25 return m.group(1)
26 raise Exception('"method_ids_size" not found in dex dump of %s' % dexfile)
27
28 def main():
29 parser = argparse.ArgumentParser()
30 parser.add_argument(
31 '--apk-name', help='Name of the APK to which the dexfile corresponds.')
32 parser.add_argument('dexfile')
33
34 args = parser.parse_args()
35
36 if not args.apk_name:
37 dirname, basename = os.path.split(args.dexfile)
38 while basename:
39 if 'apk' in basename:
40 args.apk_name = basename
41 break
42 dirname, basename = os.path.split(dirname)
43 else:
44 parser.error(
45 'Unable to determine apk name from %s, '
46 'and --apk-name was not provided.' % args.dexfile)
47
48 method_count = MethodCount(args.dexfile)
49 perf_tests_results_helper.PrintPerfResult(
50 '%s_methods' % args.apk_name, 'total', [method_count], 'methods')
51 return 0
52
53 if __name__ == '__main__':
54 sys.exit(main())
55
OLDNEW
« no previous file with comments | « build/android/locale_pak_resources.gypi ('k') | build/android/native_app_dependencies.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698