Chromium Code Reviews| 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..f20ae126a935e24bb091db8764a6ad98cf02d4c3 |
| --- /dev/null |
| +++ b/build/android/method_count.py |
| @@ -0,0 +1,32 @@ |
| +#! /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 re |
| +import sys |
| + |
| +from pylib.sdk import dexdump |
| + |
| +_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('dexfile') |
| + |
| + args = parser.parse_args() |
| + |
| + print MethodCount(args.dexfile) |
|
mikecase (-- gone --)
2015/06/19 15:45:26
Can you use python logging here? Is something goin
jbudorick
2015/06/19 16:25:56
this actually needs to use build/util/lib/common/p
|
| + return 0 |
| + |
| +if __name__ == '__main__': |
| + sys.exit(main()) |
| + |