예제 #1
0
def all_events(interval:int=180*1000, warmup:int=15, vms=None):
  from perf import perftool
  events = perftool.get_events()
  print("monitoring events:", events)
  for vm in vms[1:]:
    vm.stop()
  vm = vms[0]
  vm.start()
  sleep(BOOT_TIME)
  cpu = topology.no_ht[0]
  vm.set_cpus([cpu])

  result = {}
  for bmark, cmd in basis.items():
    wait_idleness(IDLENESS*4)
    print("measuring", bmark)
    vm.Popen(cmd)
    sleep(warmup)

    ipc = vm.stat(interval=interval, events=events)
    result[bmark] = ipc

    ret = vm.pipe.poll()
    if ret is not None:
      print("Test {bmark} on {vm} died with {ret}! Manual intervention needed\n\n" \
            .format(bmark=bmark, vm=vm, ret=ret))
      import pdb; pdb.set_trace()
    vm.pipe.killall()

  print(result)
  return result
예제 #2
0
def isolated_perf(vms):
  from subprocess import check_call
  import shlex

  benchmarks = "matrix wordpress blosc static sdag sdagp pgbench ffmpeg".split()
  for bname, vm in zip(benchmarks, vms):
    #if bname != 'wordpress':
    #  continue
    wait_idleness(IDLENESS*6)
    cmd = basis[bname]
    pipe = vm.Popen(cmd, stdout=DEVNULL, stderr=DEVNULL)
    sleep(10)

    PERF = "/home/sources/perf_lite"
    CMD = "{perf} kvm stat -e instructions,cycles -o {out} -x, -I {subinterval} -p {pid} sleep {sleep}"
    out = "results/limit/isolated_perf_%s.csv" % bname
    cmd = CMD.format(perf=PERF, pid=vm.pid,
                     out=out, subinterval=100, sleep=180)
    check_call(shlex.split(cmd))

    ret = pipe.poll()
    if ret is not None:
      print("Test {bmark} on {vm} died with {ret}! Manual intervention needed\n\n" \
            .format(bmark=bname, vm=vm, ret=ret))
      import pdb; pdb.set_trace()
    pipe.killall()
예제 #3
0
파일: placer.py 프로젝트: kopchik/perftools
def stop_tasks(vms):
  for vm in vms:
    if vm.pipe:
      vm.pipe.killall()
      vm.bmark = None
      vm.pipe = None
  wait_idleness(IDLENESS*6)
예제 #4
0
 def __enter__(self):
   map = {}
   if not self.debug:
     wait_idleness(IDLENESS*6)
   for bname, vm in zip(self.benchmarks, self.vms):
     #print("{} for {} {}".format(bname, vm.name, vm.pid))
     cmd = basis[bname]
     vm.pipe = vm.Popen(cmd, stdout=DEVNULL, stderr=DEVNULL)
     vm.bname = bname
   return map
예제 #5
0
def dead_opt_new(nr_vms:int=4, nr_samples:int=10, repeat:int=10, vms=None):
  """ Like old one but reports more data. """
  sys_speedup = []
  reloc_speedup  = []
  all_speedup = []
  for x in range(repeat):
    prints("ITERATION {x} out of {repeat}")
    wait_idleness(IDLENESS*4)
    sys, vm, all = dead_opt1(nr_vms=nr_vms, nr_samples=nr_samples, vms=vms)
    sys_speedup.append(sys)
    reloc_speedup += vm
    all_speedup += all
  return Struct(sys_speedup=sys_speedup, reloc_speedup=reloc_speedup, all_speedup=all_speedup)
예제 #6
0
def interference(interval:int=180*1000, warmup:int=15, mode=None, vms=None):
  assert mode in ['sibling', 'distant']
  if mode == 'sibling':
    cpu1 = topology.no_ht[0]
    cpu2 = topology.ht_map[cpu1][0]
  else:
    cpu1, cpu2 = topology.no_ht[:2]

  print("stopping all but 2 vms because we need only two")
  for vm in vms[2:]:
    vm.stop()
  vm1, vm2 = vms[:2]
  vm1.start()
  vm2.start()

  sleep(13)
  vm1.set_cpus([cpu1])
  vm2.set_cpus([cpu2])

  benchmarks = list(sorted(basis))
  result = defaultdict(lambda: [None, None])
  for bmark1, bmark2 in product(benchmarks, repeat=2):
    if (bmark2, bmark1) in result:
      continue
    key = (bmark1, bmark2)
    print(key)

    wait_idleness(IDLENESS*6)
    p1 = vm1.Popen(basis[bmark1])
    sleep(1)  # reduce oscillation when two same applications are launched
    p2 = vm2.Popen(basis[bmark2])
    sleep(warmup)

    def get_ipc(idx, vm):
      ipc = vm.ipcstat(interval)
      result[key][idx] = ipc
    threadulator(get_ipc, [(0, vm1), (1, vm2)])

    print(result)
    for vm in [vm1, vm2]:
      ret = vm.pipe.poll()
      if ret is not None:
        print("Test {bmark} on {vm} died with {ret}! Manual intervention needed\n\n" \
              .format(bmark=vm.bname, vm=vm, ret=ret))
        import pdb; pdb.set_trace()

    p1.killall()
    p2.killall()
예제 #7
0
                      help="output file")
  args = parser.parse_args()

  log.main.info("config:", args)

  if args.debug:
    cfg.idleness = 1000
    cfg.sys_ipc_time = 0.1
  else:
    logfilter.rules = [
      ('profile.task.*', False)
    ]
  if args.output:
    out = open(args.output, 'at')

  wait_idleness(cfg.idleness, t=3)
  tasks = generate_load(num=len(topology.all))
  try_all_permutations(tasks, out)
  import sys; sys.exit()

  #warm-up
  sleep(cfg.warmup_time)

  # initial performance
  perf_before =  get_sys_perf()

  sys_optimize_dead_simple3(tasks)

  # after tasks were optimized
  perf_after =  get_sys_perf()
  improvement = (perf_after - perf_before) / perf_before * 100