Ejemplo n.º 1
0
def main():
    data = JSONDict(
      FLAGS.properties + \
      ['key', JSONDict(FLAGS.key + \
                       ['bench_type', 'playback', \
                        'source_type', 'skp'])])

    for src in FLAGS.sources:
        with open(src, mode='r') as infile:
            for line in infile:
                match = BenchResult.match(line)
                if not match:
                    continue
                if match.sample_ms != 50:
                    raise Exception("%s: unexpected sample_ms != 50" %
                                    match.sample_ms)
                for result in ('accum', 'median', 'min', 'max'):
                    data['results'][match.bench][match.config] \
                        ['%s_%s_%s' % (result, match.clock, match.metric)] = \
                        getattr(match, result)

    if FLAGS.outfile != '-':
        with open(FLAGS.outfile, 'w+') as outfile:
            data.emit(outfile)
    else:
        data.emit(sys.stdout)
Ejemplo n.º 2
0
 def parse_file(self, infile):
     for line in infile:
         match = BenchResult.match(line)
         if not match:
             continue
         if self.metric is None:
             self.metric = match.metric
         elif match.metric != self.metric:
             raise ValueError(
                 'results have mismatched metrics (%s and %s)' %
                 (self.metric, match.metric))
         if self.samples is None:
             self.samples = match.samples
         elif not FLAGS.force and match.samples != self.samples:
             raise ValueError('results have mismatched number of samples. '
                              '(use --force to ignore)')
         if self.sample_ms is None:
             self.sample_ms = match.sample_ms
         elif not FLAGS.force and match.sample_ms != self.sample_ms:
             raise ValueError('results have mismatched sampling times. '
                              '(use --force to ignore)')
         if not match.config in self.configs:
             self.configs.append(match.config)
         self.rows[match.bench][match.config] = match.get_string(
             FLAGS.result)
         self.cols[match.config][match.bench] = getattr(match, FLAGS.result)
Ejemplo n.º 3
0
def main():
  data = JSONDict(
    FLAGS.properties + \
    ['key', JSONDict(FLAGS.key + \
                     ['bench_type', 'playback', \
                      'source_type', 'skp'])])

  for src in FLAGS.sources:
    with open(src, mode='r') as infile:
      for line in infile:
        match = BenchResult.match(line)
        if not match:
          continue
        if match.sample_ms != 50:
          raise Exception("%s: unexpected sample_ms != 50" % match.sample_ms)
        for result in ('accum', 'median'):
          data['results'][match.bench][match.config] \
              ['%s_%s_%s' % (result, match.clock, match.metric)] = \
              getattr(match, result)

  if FLAGS.outfile != '-':
    with open(FLAGS.outfile, 'w+') as outfile:
      data.emit(outfile)
  else:
    data.emit(sys.stdout)
Ejemplo n.º 4
0
 def execute(self):
   self.start()
   while True:
     message = self._queue.get()
     if message.message == Message.READLINE:
       result = BenchResult.match(message.value)
       if result:
         self.__process_result(result)
       else:
         print(message.value)
       sys.stdout.flush()
       continue
     if message.message == Message.EXIT:
       self.join()
       break
Ejemplo n.º 5
0
 def run_warmup(cls, warmup_time):
   if not warmup_time:
     return
   print('running %i second warmup...' % warmup_time, file=sys.stderr)
   commandline = cls.ARGV + ['--duration', str(warmup_time * 1000),
                             '--config', 'gpu',
                             '--skp', 'warmup']
   dump_commandline_if_verbose(commandline)
   output = subprocess.check_output(commandline).decode('utf-8')
   # validate the warmup run output.
   for line in output.split('\n'):
     match = BenchResult.match(line.rstrip())
     if match and match.bench == 'warmup':
       return
   raise Exception('Invalid warmup output:\n%s' % output)
Ejemplo n.º 6
0
  def run_warmup(cls, warmup_time, config):
    if not warmup_time:
      return
    print('running %i second warmup...' % warmup_time, file=sys.stderr)
    commandline = cls.ARGV + ['--duration', str(warmup_time * 1000),
                              '--config', config,
                              '--skp', 'warmup']
    dump_commandline_if_verbose(commandline)
    output = subprocess.check_output(commandline, stderr=subprocess.STDOUT)

    # validate the warmup run output.
    for line in output.decode('utf-8').split('\n'):
      match = BenchResult.match(line.rstrip())
      if match and match.bench == 'warmup':
        return
    raise Exception('Invalid warmup output:\n%s' % output)
Ejemplo n.º 7
0
    def execute(self, hardware):
        hardware.sanity_check()
        self._schedule_hardware_poll()

        commandline = self.ARGV + [
            '--config', self.config, '--skp', self.skp, '--suppressHeader',
            'true'
        ]
        if FLAGS.write_path:
            pngfile = _path.join(FLAGS.write_path, self.config,
                                 _path.basename(self.skp) + '.png')
            commandline.extend(['--png', pngfile])
        if (FLAGS.verbosity >= 4):
            quoted = [
                '\'%s\'' % re.sub(r'([\\\'])', r'\\\1', x) for x in commandline
            ]
            print(' '.join(quoted), file=sys.stderr)
        self._proc = subprocess.Popen(commandline, stdout=subprocess.PIPE)
        self._monitor = SubprocessMonitor(self._queue, self._proc)
        self._monitor.start()

        while True:
            message = self._queue.get()
            if message.message == Message.READLINE:
                result = BenchResult.match(message.value)
                if result:
                    hardware.sanity_check()
                    self._process_result(result)
                else:
                    print(message.value)
                sys.stdout.flush()
                continue
            if message.message == Message.POLL_HARDWARE:
                hardware.sanity_check()
                self._schedule_hardware_poll()
                continue
            if message.message == Message.EXIT:
                self._monitor.join()
                self._proc.wait()
                if self._proc.returncode != 0:
                    raise Exception(
                        "skpbench exited with nonzero exit code %i" %
                        self._proc.returncode)
                self._proc = None
                break
Ejemplo n.º 8
0
    def execute(self, hardware):
        hardware.sanity_check()
        self._schedule_hardware_poll()

        commandline = self.ARGV + [
            '--config', self.config, '--src', self.src, '--suppressHeader',
            'true'
        ]
        if FLAGS.write_path:
            pngfile = _path.join(FLAGS.write_path, self.config,
                                 _path.basename(self.src) + '.png')
            commandline.extend(['--png', pngfile])
        dump_commandline_if_verbose(commandline)
        self._proc = subprocess.Popen(commandline,
                                      stdout=subprocess.PIPE,
                                      stderr=subprocess.STDOUT)
        self._monitor = SubprocessMonitor(self._queue, self._proc)
        self._monitor.start()

        while True:
            message = self._queue.get()
            if message.message == Message.READLINE:
                result = BenchResult.match(message.value)
                if result:
                    hardware.sanity_check()
                    self._process_result(result)
                elif hardware.filter_line(message.value):
                    print(message.value, file=sys.stderr)
                continue
            if message.message == Message.POLL_HARDWARE:
                hardware.sanity_check()
                self._schedule_hardware_poll()
                continue
            if message.message == Message.EXIT:
                self._monitor.join()
                self._proc.wait()
                if self._proc.returncode != 0:
                    raise Exception(
                        "skpbench exited with nonzero exit code %i" %
                        self._proc.returncode)
                self._proc = None
                break
Ejemplo n.º 9
0
  def parse_file(self, infile):
    for line in infile:
      match = BenchResult.match(line)
      if not match:
        continue

      fullconfig = FullConfig(*(match.get_string(x)
                                for x in FullConfig._fields))
      if not fullconfig in self.fullconfigs:
        self.fullconfigs.append(fullconfig)

      for qualifier, value in self.sheet_qualifiers.items():
        if value is None:
          self.sheet_qualifiers[qualifier] = match.get_string(qualifier)
        elif value != match.get_string(qualifier):
          del self.sheet_qualifiers[qualifier]
          self.config_qualifiers.add(qualifier)

      self.rows[match.bench][fullconfig] = match.get_string(FLAGS.result)
      self.cols[fullconfig][match.bench] = getattr(match, FLAGS.result)
Ejemplo n.º 10
0
def main():
    data = parse_key_value_pairs(FLAGS.properties + [
        'key',
        parse_key_value_pairs(FLAGS.key), 'results',
        defaultdict(dict)
    ])

    for src in FLAGS.sources:
        with open(src, mode='r') as infile:
            for line in infile:
                match = BenchResult.match(line)
                if match:
                    data['results'][match.bench][
                        match.config] = skiaperf_result(match)

    if FLAGS.outfile != '-':
        with open(FLAGS.outfile, 'w+') as outfile:
            emit_as_json(data, outfile)
    else:
        emit_as_json(data, sys.stdout)
Ejemplo n.º 11
0
  def execute(self, hardware):
    hardware.sanity_check()
    self._schedule_hardware_poll()

    commandline = self.ARGV + ['--config', self.config,
                               '--skp', self.skp,
                               '--suppressHeader', 'true']
    if FLAGS.write_path:
      pngfile = _path.join(FLAGS.write_path, self.config,
                           _path.basename(self.skp) + '.png')
      commandline.extend(['--png', pngfile])
    dump_commandline_if_verbose(commandline)
    self._proc = subprocess.Popen(commandline, stdout=subprocess.PIPE)
    self._monitor = SubprocessMonitor(self._queue, self._proc)
    self._monitor.start()

    while True:
      message = self._queue.get()
      if message.message == Message.READLINE:
        result = BenchResult.match(message.value)
        if result:
          hardware.sanity_check()
          self._process_result(result)
        else:
          print(message.value, file=sys.stderr)
        sys.stdout.flush()
        continue
      if message.message == Message.POLL_HARDWARE:
        hardware.sanity_check()
        self._schedule_hardware_poll()
        continue
      if message.message == Message.EXIT:
        self._monitor.join()
        self._proc.wait()
        if self._proc.returncode != 0:
          raise Exception("skpbench exited with nonzero exit code %i" %
                          self._proc.returncode)
        self._proc = None
        break