示例#1
0
文件: bm_main.py 项目: yashykt/grpc
def main(args):

    bm_build.build('new', args.benchmarks, args.jobs, args.counters)

    old = args.old
    if args.diff_base:
        old = 'old'
        where_am_i = subprocess.check_output(
            ['git', 'rev-parse', '--abbrev-ref', 'HEAD']).strip()
        subprocess.check_call(['git', 'checkout', args.diff_base])
        try:
            bm_build.build(old, args.benchmarks, args.jobs, args.counters)
        finally:
            subprocess.check_call(['git', 'checkout', where_am_i])
            subprocess.check_call(['git', 'submodule', 'update'])

    jobs_list = []
    jobs_list += bm_run.create_jobs('new', args.benchmarks, args.loops,
                                    args.regex, args.counters)
    jobs_list += bm_run.create_jobs(old, args.benchmarks, args.loops,
                                    args.regex, args.counters)

    # shuffle all jobs to eliminate noise from GCE CPU drift
    random.shuffle(jobs_list, random.SystemRandom().random)
    jobset.run(jobs_list, maxjobs=args.jobs)

    diff, note, significance = bm_diff.diff(args.benchmarks, args.loops,
                                            args.regex, args.track, old, 'new',
                                            args.counters)
    if diff:
        text = '[%s] Performance differences noted:\n%s' % (
            args.pr_comment_name, diff)
    else:
        text = '[%s] No significant performance differences' % args.pr_comment_name
    if note:
        text = note + '\n\n' + text
    print('%s' % text)
    check_on_pr.check_on_pr('Benchmark', '```\n%s\n```' % text)
    check_on_pr.label_significance_on_pr('perf-change', significance)
示例#2
0
def main(args):

    bm_build.build('new', args.benchmarks, args.jobs, args.counters)

    old = args.old
    if args.diff_base:
        old = 'old'
        where_am_i = subprocess.check_output(
            ['git', 'rev-parse', '--abbrev-ref', 'HEAD']).strip()
        subprocess.check_call(['git', 'checkout', args.diff_base])
        try:
            bm_build.build(old, args.benchmarks, args.jobs, args.counters)
        finally:
            subprocess.check_call(['git', 'checkout', where_am_i])
            subprocess.check_call(['git', 'submodule', 'update'])

    jobs_list = []
    jobs_list += bm_run.create_jobs('new', args.benchmarks, args.loops,
                                    args.regex, args.counters)
    jobs_list += bm_run.create_jobs(old, args.benchmarks, args.loops,
                                    args.regex, args.counters)

    # shuffle all jobs to eliminate noise from GCE CPU drift
    random.shuffle(jobs_list, random.SystemRandom().random)
    jobset.run(jobs_list, maxjobs=args.jobs)

    diff, note = bm_diff.diff(args.benchmarks, args.loops, args.regex,
                              args.track, old, 'new', args.counters)
    if diff:
        text = '[%s] Performance differences noted:\n%s' % (
            args.pr_comment_name, diff)
    else:
        text = '[%s] No significant performance differences' % args.pr_comment_name
    if note:
        text = note + '\n\n' + text
    print('%s' % text)
    comment_on_pr.comment_on_pr('```\n%s\n```' % text)