diff options
author | Muxi Yan <mxyan@google.com> | 2018-06-08 14:27:08 -0700 |
---|---|---|
committer | Muxi Yan <mxyan@google.com> | 2018-07-10 09:53:51 -0700 |
commit | 252359bbdca17dc4654db2f6e3e682a9864cda1a (patch) | |
tree | 3ba241bd321633d7c2be55aabd554557f3785aa1 /tools/profiling | |
parent | 4ba4d18960ccc762d5228a314c574050afadddac (diff) |
CI integration
Diffstat (limited to 'tools/profiling')
-rwxr-xr-x | tools/profiling/ios_bin/binary_size.py (renamed from tools/profiling/ios_bin/binary_diff.py) | 42 |
1 files changed, 31 insertions, 11 deletions
diff --git a/tools/profiling/ios_bin/binary_diff.py b/tools/profiling/ios_bin/binary_size.py index 6d5ae65e46..693b3c4d2e 100755 --- a/tools/profiling/ios_bin/binary_diff.py +++ b/tools/profiling/ios_bin/binary_size.py @@ -28,6 +28,9 @@ sys.path.append( os.path.dirname(sys.argv[0]), '..', '..', 'run_tests', 'python_utils')) import comment_on_pr +# Only show diff 1KB or greater +diff_threshold = 1000 + size_labels = ('Core', 'ObjC', 'BoringSSL', 'Protobuf', 'Total') argp = argparse.ArgumentParser( @@ -104,22 +107,39 @@ for frameworks in [False, True]: subprocess.check_call(['git', 'checkout', where_am_i]) subprocess.check_call(['git', 'submodule', 'update']) - text += ('****************FRAMEWORKS*****************\n' - if frameworks else '******************STATIC*******************\n') + text += ('***************FRAMEWORKS****************\n' + if frameworks else '*****************STATIC******************\n') row_format = "{:>10}{:>15}{:>15}" + '\n' text += row_format.format('New size', '', 'Old size') - for i in range(0, len(size_labels)): - if old_size == None: - diff_sign = ' ' - elif new_size[i] == old_size[i]: - diff_sign = ' (=)' - elif new_size[i] > old_size[i]: + if old_size == None: + for i in range(0, len(size_labels)): + text += ('\n' if i == len(size_labels) - 1 else '') + row_format.format( + '{:,}'.format(new_size[i]), size_labels[i], '') + else: + has_diff = False + for i in range(0, len(size_labels) - 1): + if abs(new_size[i] - old_size[i]) < diff_threshold: + continue + if new_size[i] > old_size[i]: + diff_sign = ' (>)' + else: + diff_sign = ' (<)' + has_diff = True + text += row_format.format( + '{:,}'.format(new_size[i]), size_labels[i] + diff_sign, + '{:,}'.format(old_size[i])) + i = len(size_labels) - 1 + if new_size[i] > old_size[i]: diff_sign = ' (>)' - else: + elif new_size[i] < old_size[i]: diff_sign = ' (<)' - text += ('\n' if i == len(size_labels) - 1 else '') + row_format.format( + else: + diff_sign = ' (=)' + text += ('\n' if has_diff else '') + row_format.format( '{:,}'.format(new_size[i]), size_labels[i] + diff_sign, - '{:,}'.format(old_size[i]) if old_size != None else '') + '{:,}'.format(old_size[i])) + if not has_diff: + text += '\n No significant differences in binary sizes\n' text += '\n' print text |