コード例 #1
0
ファイル: run_benchmark.py プロジェクト: zszyj/webkit
def start(args):
    if args.json_file:
        results_json = json.load(open(args.json_file, 'r'))
        if 'debugOutput' in results_json:
            del results_json['debugOutput']
        BenchmarkRunner.show_results(results_json, args.scale_unit,
                                     args.show_iteration_values)
        return
    if args.allplans:
        failed = []
        skipped = []
        planlist = BenchmarkRunner.available_plans()
        skippedfile = os.path.join(BenchmarkRunner.plan_directory(), 'Skipped')
        if not planlist:
            raise Exception('Cant find any .plan file in directory %s' %
                            BenchmarkRunner.plan_directory())
        if os.path.isfile(skippedfile):
            skipped = [
                line.strip() for line in open(skippedfile)
                if not line.startswith('#') and len(line) > 1
            ]
        for plan in sorted(planlist):
            if plan in skipped:
                _log.info(
                    'Skipping benchmark plan: %s because is listed on the Skipped file'
                    % plan)
                continue
            _log.info('Starting benchmark plan: %s' % plan)
            try:
                run_benchmark_plan(args, plan)
                _log.info('Finished benchmark plan: %s' % plan)
            except KeyboardInterrupt:
                raise
            except:
                failed.append(plan)
                _log.exception('Error running benchmark plan: %s' % plan)
        if failed:
            _log.error('The following benchmark plans have failed: %s' %
                       failed)
        return len(failed)
    if args.list_plans:
        list_benchmark_plans()
        return

    run_benchmark_plan(args, args.plan)
コード例 #2
0
def list_benchmark_plans():
    print "Available benchmark plans: "
    for plan in BenchmarkRunner.available_plans():
        print "\t%s" % plan