Exemple #1
0
def main():
  parser = ArgumentParser()
  parser.add_argument('-o', '--output', default=None, help="where to save image")
  parser.add_argument('--show', action='store_const', const=True, default=False, help="show plot?")
  parser.add_argument('-t', '--title', help="plot title")
  parser.add_argument('-a', '--annotations', default=None, nargs='+')
  parser.add_argument('--xlim', type=float, nargs=2, help="limit X axis of the plot")
  parser.add_argument('--ylim', type=float, nargs=2, help="limit Y axis of the plot")
  parser.add_argument('-x', '--xlabel', default=None)
  parser.add_argument('-y', '--ylabel', default=None)
  parser.add_argument('-f', '--freq', type=int, default=None, help="CPU frequency")
  parser.add_argument('-p', '--plots', nargs='+', default=[])
  parser.add_argument('-l', '--legacy', action='store_const', const=True, default=False,
                      help="legacy mode")
  args = parser.parse_args()
  print(args)

  if args.legacy:
    for plot in args.plots:
      func, params = invoke(plot, globals())
      print(params)
      func(**params)
  else:
    for plot in args.plots:
      results = pickle.load(open(plot, 'rb'))
      fname = results.f
      func  = globals()[fname]
      func(results.result)

  if args.output or args.show:
    p.legend(loc="best")
    p.tight_layout(pad=0.5)
    font = {'family' : 'normal',
            'weight' : 'bold',
            'size'   : 18}
    p.rc('font', **font)
    if args.xlabel: p.xlabel(args.xlabel)
    if args.ylabel: p.ylabel(args.ylabel)
    if args.xlim: p.xlim(args.xlim)
    if args.ylim: p.ylim(args.ylim)
    if args.title: p.title(args.title)
    if args.output:
      p.savefig(args.output, dpi=300, bbox_inches='tight')
    # p.tight_layout()
    if args.show: p.show()
Exemple #2
0
  parser.add_argument('-p', '--print', default=False, const=True, action='store_const', help='print result')
  parser.add_argument('-b', '--benches', nargs='*', default="matrix wordpress blosc static sdag sdagp pgbench ffmpeg".split(), help="which benchmarks to run")
  args = parser.parse_args()
  print("config:", args)

  assert not args.output or not exists(args.output), "output %s already exists" % args.output

  from perf.numa import pin_task
  import os
  pin_task(os.getpid(), 6)

  with Setup(VMS, args.benches, debug=args.debug):
    if not args.debug and args.benches:
      print("benches warm-up for %s seconds" % args.warmup)
      sleep(args.warmup)
    f, fargs = invoke(args.test, globals(), vms=VMS)
    print("invoking", f.__name__, "with", fargs)
    result = f(**fargs)
    if args.print:
      print(result)

    if args.output:
      fargs.pop('vms')
      if args.output == 'auto':
        string_fargs = ",".join('%s=%s' % (k,v) for k,v in sorted(fargs.items()))
        fname = 'results/{host}/{f}_{fargs}.pickle'  \
                .format(host=gethostname(), f=f.__name__, fargs=string_fargs)
      else:
        fname = args.output
      print("pickling to", fname)
      pickle.dump(Struct(f=f.__name__, fargs=fargs, result=result, prog_args=args),