示例#1
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'])

    bm_run.run('new', args.benchmarks, args.jobs, args.loops, args.repetitions,
               args.counters)
    bm_run.run(old, args.benchmarks, args.jobs, args.loops, args.repetitions,
               args.counters)

    diff, note = bm_diff.diff(args.benchmarks, args.loops, 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)
示例#2
0
文件: bm_main.py 项目: endobson/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'])

  bm_run.run('new', args.benchmarks, args.jobs, args.loops, args.regex, args.counters)
  bm_run.run(old, args.benchmarks, args.jobs, args.loops, args.regex, args.counters)

  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)