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

Unified 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, 6 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/android/method_count.py
diff --git a/build/android/method_count.py b/build/android/method_count.py
new file mode 100755
index 0000000000000000000000000000000000000000..93250b5c542fb28d60574b3ed4ba2e615a53c29b
--- /dev/null
+++ b/build/android/method_count.py
@@ -0,0 +1,55 @@
+#! /usr/bin/env python
+# Copyright 2015 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import argparse
+import os
+import re
+import sys
+
+from pylib import constants
+from pylib.sdk import dexdump
+
+sys.path.append(os.path.join(constants.DIR_SOURCE_ROOT, 'build', 'util', 'lib',
+ 'common'))
+import perf_tests_results_helper
+
+
+_METHOD_IDS_SIZE_RE = re.compile(r'^method_ids_size +: +(\d+)$')
+
+def MethodCount(dexfile):
+ for line in dexdump.DexDump(dexfile, file_summary=True):
+ m = _METHOD_IDS_SIZE_RE.match(line)
+ if m:
+ return m.group(1)
+ raise Exception('"method_ids_size" not found in dex dump of %s' % dexfile)
+
+def main():
+ parser = argparse.ArgumentParser()
+ parser.add_argument(
+ '--apk-name', help='Name of the APK to which the dexfile corresponds.')
+ parser.add_argument('dexfile')
+
+ args = parser.parse_args()
+
+ if not args.apk_name:
+ dirname, basename = os.path.split(args.dexfile)
+ while basename:
+ if 'apk' in basename:
+ args.apk_name = basename
+ break
+ dirname, basename = os.path.split(dirname)
+ else:
+ parser.error(
+ 'Unable to determine apk name from %s, '
+ 'and --apk-name was not provided.' % args.dexfile)
+
+ method_count = MethodCount(args.dexfile)
+ perf_tests_results_helper.PrintPerfResult(
+ '%s_methods' % args.apk_name, 'total', [method_count], 'methods')
+ return 0
+
+if __name__ == '__main__':
+ sys.exit(main())
+
« 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