From 84366d22d6535dd955d9aa14bb0f364381c3f45d Mon Sep 17 00:00:00 2001 From: Yuqian Li Date: Tue, 17 Oct 2017 16:26:32 -0400 Subject: Add concise option to Calmbench bot As \r doesn't work on bot output, the new output will be much more concise. TBR: borenet@google.com Bug: skia: Change-Id: I190daeae230ea6e0c4bfebc53c6c5c1fd46c503a Reviewed-on: https://skia-review.googlesource.com/60840 Reviewed-by: Yuqian Li Commit-Queue: Yuqian Li --- .../calmbench.expected/Calmbench-Debian9.json | 3 ++- infra/bots/recipes/calmbench.py | 3 ++- tools/calmbench/ab.py | 21 +++++++++++++++------ tools/calmbench/calmbench.py | 6 ++++++ 4 files changed, 25 insertions(+), 8 deletions(-) diff --git a/infra/bots/recipes/calmbench.expected/Calmbench-Debian9.json b/infra/bots/recipes/calmbench.expected/Calmbench-Debian9.json index 62455164d3..6170bcbc94 100644 --- a/infra/bots/recipes/calmbench.expected/Calmbench-Debian9.json +++ b/infra/bots/recipes/calmbench.expected/Calmbench-Debian9.json @@ -210,7 +210,8 @@ "--extraarg", "--svgs [START_DIR]/svg --skps [START_DIR]/skp", "--writedir", - "[CUSTOM_[SWARM_OUT_DIR]]" + "[CUSTOM_[SWARM_OUT_DIR]]", + "--concise" ], "cwd": "[CUSTOM_/_B_WORK]/skia", "env": { diff --git a/infra/bots/recipes/calmbench.py b/infra/bots/recipes/calmbench.py index bcfdc44729..0a75d0d057 100644 --- a/infra/bots/recipes/calmbench.py +++ b/infra/bots/recipes/calmbench.py @@ -31,7 +31,8 @@ def RunSteps(api): 'python', 'tools/calmbench/calmbench.py', 'modified', '--ninjadir', api.vars.skia_out.join("Release"), '--extraarg', extra_arg, - '--writedir', api.vars.swarming_out_dir + '--writedir', api.vars.swarming_out_dir, + '--concise' ] api.run(api.step, 'Run calmbench', cmd=command) api.run.check_failure() diff --git a/tools/calmbench/ab.py b/tools/calmbench/ab.py index 2ffb9e3ec3..e417414820 100644 --- a/tools/calmbench/ab.py +++ b/tools/calmbench/ab.py @@ -74,6 +74,10 @@ def parse_args(): parser.add_argument('noinit', type=str, help=("whether to skip running B" " ('true' or 'false')")) + parser.add_argument('--concise', dest='concise', action="store_true", + help="If set, no verbose thread info will be printed.") + parser.set_defaults(concise=False) + args = parser.parse_args() args.skip_b = args.skip_b == "true" args.noinit = args.noinit == "true" @@ -112,7 +116,8 @@ def append_times_from_file(args, name, filename): class ThreadRunner: """Simplest and stupidiest threaded executer.""" - def __init__(self): + def __init__(self, args): + self.concise = args.concise self.threads = [] def add(self, args, fn): @@ -138,12 +143,16 @@ class ThreadRunner: time.sleep(0.5) i += 1 - ts = Thread(target = spin); - ts.start() + if not self.concise: + ts = Thread(target = spin); + ts.start() + for t in self.threads: t.join() self.threads = [] - ts.join() + + if not self.concise: + ts.join() def split_arg(arg): @@ -183,7 +192,7 @@ def run(args, threadRunner, name, nano, arg, i): def init_run(args): - threadRunner = ThreadRunner() + threadRunner = ThreadRunner(args) for i in range(1, max(args.repeat, args.threads / 2) + 1): run(args, threadRunner, args.a, args.nano_a, args.arg_a, i) run(args, threadRunner, args.b, args.nano_b, args.arg_b, i) @@ -261,7 +270,7 @@ def test(): break print "Number of suspects at iteration %d: %d" % (it, len(suspects)) - threadRunner = ThreadRunner() + threadRunner = ThreadRunner(args) for j in range(1, max(1, args.threads / 2) + 1): run(args, threadRunner, args.a, args.nano_a, args.arg_a + suspects_arg(suspects), -j) diff --git a/tools/calmbench/calmbench.py b/tools/calmbench/calmbench.py index 4b484c905b..50208cc3fd 100644 --- a/tools/calmbench/calmbench.py +++ b/tools/calmbench/calmbench.py @@ -101,9 +101,12 @@ def parse_args(): help=skip_base_help) parser.add_argument('--noinit', dest='noinit', action="store_true", help=noinit_help) + parser.add_argument('--concise', dest='concise', action="store_true", + help="If set, no verbose thread info will be printed.") parser.set_defaults(no_compile=False); parser.set_defaults(skipbase=False); parser.set_defaults(noinit=False); + parser.set_defaults(concise=False); args = parser.parse_args() if not args.basearg: @@ -186,6 +189,9 @@ def main(): "true" if args.noinit else "false" ] + if args.concise: + command.append("--concise") + p = subprocess.Popen(command, cwd=args.skiadir) try: p.wait() -- cgit v1.2.3