From 87cd994b0477e98c976e7b321b3c1f52666ab5e0 Mon Sep 17 00:00:00 2001 From: Mehrdad Afshari Date: Tue, 2 Jan 2018 14:40:00 -0800 Subject: Upgrade yapf to 0.20.0 Upgrade yapf version to 0.20.0 and reformat Python files. --- tools/profiling/microbenchmarks/bm2bq.py | 6 +++--- tools/profiling/microbenchmarks/bm_diff/bm_build.py | 6 ++++-- tools/profiling/microbenchmarks/bm_diff/bm_constants.py | 16 +++++++++------- tools/profiling/microbenchmarks/bm_diff/bm_diff.py | 3 ++- tools/profiling/microbenchmarks/bm_diff/bm_main.py | 3 ++- tools/profiling/microbenchmarks/bm_diff/bm_run.py | 15 +++++++++------ tools/profiling/microbenchmarks/bm_json.py | 3 ++- tools/profiling/qps/qps_diff.py | 7 ++++--- 8 files changed, 35 insertions(+), 24 deletions(-) (limited to 'tools/profiling') diff --git a/tools/profiling/microbenchmarks/bm2bq.py b/tools/profiling/microbenchmarks/bm2bq.py index 746b643b43..e084e28dcf 100755 --- a/tools/profiling/microbenchmarks/bm2bq.py +++ b/tools/profiling/microbenchmarks/bm2bq.py @@ -28,9 +28,9 @@ import subprocess columns = [] for row in json.loads( - subprocess.check_output([ - 'bq', '--format=json', 'show', 'microbenchmarks.microbenchmarks' - ]))['schema']['fields']: + subprocess.check_output( + ['bq', '--format=json', 'show', + 'microbenchmarks.microbenchmarks']))['schema']['fields']: columns.append((row['name'], row['type'].lower())) SANITIZE = { diff --git a/tools/profiling/microbenchmarks/bm_diff/bm_build.py b/tools/profiling/microbenchmarks/bm_diff/bm_build.py index a4cd61707d..4197ba3632 100755 --- a/tools/profiling/microbenchmarks/bm_diff/bm_build.py +++ b/tools/profiling/microbenchmarks/bm_diff/bm_build.py @@ -43,7 +43,8 @@ def _args(): '-n', '--name', type=str, - help='Unique name of this build. To be used as a handle to pass to the other bm* scripts' + help= + 'Unique name of this build. To be used as a handle to pass to the other bm* scripts' ) argp.add_argument('--counters', dest='counters', action='store_true') argp.add_argument('--no-counters', dest='counters', action='store_false') @@ -71,7 +72,8 @@ def build(name, benchmarks, jobs, counters): subprocess.check_call(_make_cmd('counters', benchmarks, jobs)) os.rename( 'bins', - 'bm_diff_%s' % name,) + 'bm_diff_%s' % name, + ) if __name__ == '__main__': diff --git a/tools/profiling/microbenchmarks/bm_diff/bm_constants.py b/tools/profiling/microbenchmarks/bm_diff/bm_constants.py index cff29dbe08..5719e42620 100644 --- a/tools/profiling/microbenchmarks/bm_diff/bm_constants.py +++ b/tools/profiling/microbenchmarks/bm_diff/bm_constants.py @@ -22,10 +22,12 @@ _AVAILABLE_BENCHMARK_TESTS = [ 'bm_metadata', 'bm_fullstack_trickle' ] -_INTERESTING = ( - 'cpu_time', 'real_time', 'call_initial_size-median', 'locks_per_iteration', - 'allocs_per_iteration', 'writes_per_iteration', 'atm_cas_per_iteration', - 'atm_add_per_iteration', 'nows_per_iteration', - 'cli_transport_stalls_per_iteration', 'cli_stream_stalls_per_iteration', - 'svr_transport_stalls_per_iteration', 'svr_stream_stalls_per_iteration', - 'http2_pings_sent_per_iteration') +_INTERESTING = ('cpu_time', 'real_time', 'call_initial_size-median', + 'locks_per_iteration', 'allocs_per_iteration', + 'writes_per_iteration', 'atm_cas_per_iteration', + 'atm_add_per_iteration', 'nows_per_iteration', + 'cli_transport_stalls_per_iteration', + 'cli_stream_stalls_per_iteration', + 'svr_transport_stalls_per_iteration', + 'svr_stream_stalls_per_iteration', + 'http2_pings_sent_per_iteration') diff --git a/tools/profiling/microbenchmarks/bm_diff/bm_diff.py b/tools/profiling/microbenchmarks/bm_diff/bm_diff.py index b8a3b22861..f975a8b402 100755 --- a/tools/profiling/microbenchmarks/bm_diff/bm_diff.py +++ b/tools/profiling/microbenchmarks/bm_diff/bm_diff.py @@ -65,7 +65,8 @@ def _args(): '--loops', type=int, default=20, - help='Number of times to loops the benchmarks. Must match what was passed to bm_run.py' + help= + 'Number of times to loops the benchmarks. Must match what was passed to bm_run.py' ) argp.add_argument( '-r', diff --git a/tools/profiling/microbenchmarks/bm_diff/bm_main.py b/tools/profiling/microbenchmarks/bm_diff/bm_main.py index 137c22bf8e..96c63ba060 100755 --- a/tools/profiling/microbenchmarks/bm_diff/bm_main.py +++ b/tools/profiling/microbenchmarks/bm_diff/bm_main.py @@ -78,7 +78,8 @@ def _args(): '--loops', type=int, default=10, - help='Number of times to loops the benchmarks. More loops cuts down on noise' + help= + 'Number of times to loops the benchmarks. More loops cuts down on noise' ) argp.add_argument( '-j', diff --git a/tools/profiling/microbenchmarks/bm_diff/bm_run.py b/tools/profiling/microbenchmarks/bm_diff/bm_run.py index 08894bbe4d..dfb9b178fa 100755 --- a/tools/profiling/microbenchmarks/bm_diff/bm_run.py +++ b/tools/profiling/microbenchmarks/bm_diff/bm_run.py @@ -51,7 +51,8 @@ def _args(): '-n', '--name', type=str, - help='Unique name of the build to run. Needs to match the handle passed to bm_build.py' + help= + 'Unique name of the build to run. Needs to match the handle passed to bm_build.py' ) argp.add_argument( '-r', @@ -64,7 +65,8 @@ def _args(): '--loops', type=int, default=20, - help='Number of times to loops the benchmarks. More loops cuts down on noise' + help= + 'Number of times to loops the benchmarks. More loops cuts down on noise' ) argp.add_argument('--counters', dest='counters', action='store_true') argp.add_argument('--no-counters', dest='counters', action='store_false') @@ -82,13 +84,14 @@ def _collect_bm_data(bm, cfg, name, regex, idx, loops): 'bm_diff_%s/%s/%s' % (name, cfg, bm), '--benchmark_list_tests', '--benchmark_filter=%s' % regex ]).splitlines(): - stripped_line = line.strip().replace("/", "_").replace( - "<", "_").replace(">", "_").replace(", ", "_") + stripped_line = line.strip().replace("/", + "_").replace("<", "_").replace( + ">", "_").replace(", ", "_") cmd = [ 'bm_diff_%s/%s/%s' % (name, cfg, bm), '--benchmark_filter=^%s$' % line, - '--benchmark_out=%s.%s.%s.%s.%d.json' % - (bm, stripped_line, cfg, name, idx), + '--benchmark_out=%s.%s.%s.%s.%d.json' % (bm, stripped_line, cfg, + name, idx), '--benchmark_out_format=json', ] jobs_list.append( diff --git a/tools/profiling/microbenchmarks/bm_json.py b/tools/profiling/microbenchmarks/bm_json.py index 1dd9f65dbf..497d7ca813 100644 --- a/tools/profiling/microbenchmarks/bm_json.py +++ b/tools/profiling/microbenchmarks/bm_json.py @@ -183,7 +183,8 @@ def expand_json(js, js2=None): context = js['context'] if 'label' in bm: labels_list = [ - s.split(':') for s in bm['label'].strip().split(' ') + s.split(':') + for s in bm['label'].strip().split(' ') if len(s) and s[0] != '#' ] for el in labels_list: diff --git a/tools/profiling/qps/qps_diff.py b/tools/profiling/qps/qps_diff.py index 55a81f034d..393f862b4d 100755 --- a/tools/profiling/qps/qps_diff.py +++ b/tools/profiling/qps/qps_diff.py @@ -48,7 +48,8 @@ def _args(): '--loops', type=int, default=4, - help='Number of loops for each benchmark. More loops cuts down on noise') + help='Number of loops for each benchmark. More loops cuts down on noise' + ) argp.add_argument( '-j', '--jobs', @@ -128,8 +129,8 @@ def diff(scenarios, loops, old, new): rows = [] for sn in scenarios: mdn_diff = abs(_median(new_data[sn]) - _median(old_data[sn])) - print('%s: %s=%r %s=%r mdn_diff=%r' % - (sn, new, new_data[sn], old, old_data[sn], mdn_diff)) + print('%s: %s=%r %s=%r mdn_diff=%r' % (sn, new, new_data[sn], old, + old_data[sn], mdn_diff)) s = bm_speedup.speedup(new_data[sn], old_data[sn], 10e-5) if abs(s) > 3 and mdn_diff > 0.5: rows.append([sn, '%+d%%' % s]) -- cgit v1.2.3