aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/profiling/bloat/bloat_diff.py
diff options
context:
space:
mode:
Diffstat (limited to 'tools/profiling/bloat/bloat_diff.py')
-rwxr-xr-xtools/profiling/bloat/bloat_diff.py76
1 files changed, 35 insertions, 41 deletions
diff --git a/tools/profiling/bloat/bloat_diff.py b/tools/profiling/bloat/bloat_diff.py
index 9b40685e90..91611c2ca4 100755
--- a/tools/profiling/bloat/bloat_diff.py
+++ b/tools/profiling/bloat/bloat_diff.py
@@ -23,12 +23,11 @@ import subprocess
import sys
sys.path.append(
- os.path.join(
- os.path.dirname(sys.argv[0]), '..', '..', 'run_tests', 'python_utils'))
+ os.path.join(
+ os.path.dirname(sys.argv[0]), '..', '..', 'run_tests', 'python_utils'))
import comment_on_pr
-argp = argparse.ArgumentParser(
- description='Perform diff on microbenchmarks')
+argp = argparse.ArgumentParser(description='Perform diff on microbenchmarks')
argp.add_argument(
'-d',
@@ -36,64 +35,59 @@ argp.add_argument(
type=str,
help='Commit or branch to compare the current one to')
-argp.add_argument(
- '-j',
- '--jobs',
- type=int,
- default=multiprocessing.cpu_count())
+argp.add_argument('-j', '--jobs', type=int, default=multiprocessing.cpu_count())
args = argp.parse_args()
LIBS = [
- 'libgrpc.so',
- 'libgrpc++.so',
+ 'libgrpc.so',
+ 'libgrpc++.so',
]
+
def build(where):
- subprocess.check_call('make -j%d' % args.jobs,
- shell=True, cwd='.')
- shutil.rmtree('bloat_diff_%s' % where, ignore_errors=True)
- os.rename('libs', 'bloat_diff_%s' % where)
+ subprocess.check_call('make -j%d' % args.jobs, shell=True, cwd='.')
+ shutil.rmtree('bloat_diff_%s' % where, ignore_errors=True)
+ os.rename('libs', 'bloat_diff_%s' % where)
+
build('new')
if args.diff_base:
old = 'old'
where_am_i = subprocess.check_output(
- ['git', 'rev-parse', '--abbrev-ref', 'HEAD']).strip()
+ ['git', 'rev-parse', '--abbrev-ref', 'HEAD']).strip()
subprocess.check_call(['git', 'checkout', args.diff_base])
subprocess.check_call(['git', 'submodule', 'update'])
try:
- try:
- build('old')
- except subprocess.CalledProcessError, e:
- subprocess.check_call(['make', 'clean'])
- build('old')
+ try:
+ build('old')
+ except subprocess.CalledProcessError, e:
+ subprocess.check_call(['make', 'clean'])
+ build('old')
finally:
- subprocess.check_call(['git', 'checkout', where_am_i])
- subprocess.check_call(['git', 'submodule', 'update'])
+ subprocess.check_call(['git', 'checkout', where_am_i])
+ subprocess.check_call(['git', 'submodule', 'update'])
-subprocess.check_call('make -j%d' % args.jobs,
- shell=True, cwd='third_party/bloaty')
+subprocess.check_call(
+ 'make -j%d' % args.jobs, shell=True, cwd='third_party/bloaty')
text = ''
for lib in LIBS:
- text += '****************************************************************\n\n'
- text += lib + '\n\n'
- old_version = glob.glob('bloat_diff_old/opt/%s' % lib)
- new_version = glob.glob('bloat_diff_new/opt/%s' % lib)
- assert len(new_version) == 1
- cmd = 'third_party/bloaty/bloaty -d compileunits,symbols'
- if old_version:
- assert len(old_version) == 1
- text += subprocess.check_output('%s %s -- %s' %
- (cmd, new_version[0], old_version[0]),
- shell=True)
- else:
- text += subprocess.check_output('%s %s' %
- (cmd, new_version[0]),
- shell=True)
- text += '\n\n'
+ text += '****************************************************************\n\n'
+ text += lib + '\n\n'
+ old_version = glob.glob('bloat_diff_old/opt/%s' % lib)
+ new_version = glob.glob('bloat_diff_new/opt/%s' % lib)
+ assert len(new_version) == 1
+ cmd = 'third_party/bloaty/bloaty -d compileunits,symbols'
+ if old_version:
+ assert len(old_version) == 1
+ text += subprocess.check_output(
+ '%s %s -- %s' % (cmd, new_version[0], old_version[0]), shell=True)
+ else:
+ text += subprocess.check_output(
+ '%s %s' % (cmd, new_version[0]), shell=True)
+ text += '\n\n'
print text
comment_on_pr.comment_on_pr('```\n%s\n```' % text)