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 <liyuqian@google.com>
Commit-Queue: Yuqian Li <liyuqian@google.com>
This commit is contained in:
Yuqian Li 2017-10-17 16:26:32 -04:00 committed by Skia Commit-Bot
parent a0020f987e
commit 84366d22d6
4 changed files with 25 additions and 8 deletions

View File

@ -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": {

View File

@ -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()

View File

@ -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)

View File

@ -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()