<commit_before>#!/usr/bin/env python
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

""" Run the Skia bench_pictures executable. """

from utils import shell_utils
from build_step import BuildStep
from run_bench import BenchArgs
from run_bench import RunBench
from run_bench import PreBench
import os
import sys


# Skipping these for now to avoid excessively long cycle times.
RUNNING_ALL_CONFIGURATIONS = False


class BenchPictures(RunBench):
  def __init__(self, args, attempts=1, timeout=16800):
    super(BenchPictures, self).__init__(args, attempts=attempts,
                                        timeout=timeout)

  def _BuildDataFile(self, perf_dir, args):
    data_file = '%s_skp_%s' % (
        super(BenchPictures, self)._BuildDataFile(perf_dir),
        '_'.join(args).replace('-', '').replace(':', '-'))
    return data_file

  def _GetSkpDir(self):
    return self._skp_dir

  def _GetPerfDataDir(self):
    return self._perf_data_dir

  def _DoBenchPictures(self, args):
    cmd = [self._PathToBinary('bench_pictures'), self._GetSkpDir()] + args
    if self._GetPerfDataDir():
      PreBench(self._GetPerfDataDir())
      cmd += BenchArgs(repeats=self.BENCH_REPEAT_COUNT,
                       data_file=self._BuildDataFile(self._GetPerfDataDir(),
                                                     args))
    shell_utils.Bash(cmd)

  def _Run(self):
    # Default mode: tiled bitmap
    self._DoBenchPictures(['--device', 'bitmap',
                           '--mode', 'tile', str(self.TILE_X),
                                             str(self.TILE_Y)])

    # Run bitmap in tiled mode, in different numbers of threads
    for threads in [2, 3, 4]:
      self._DoBenchPictures(['--device', 'bitmap',
                             '--mode', 'tile', str(self.TILE_X),
                                               str(self.TILE_Y),
                             '--multi', str(threads)])

    # Maybe run gpu config
    gyp_defines = os.environ.get('GYP_DEFINES', '')
    if ('skia_gpu=0' not in gyp_defines and \
        (not hasattr(self, '_device') or self._device != 'nexus_s')):
      self._DoBenchPictures(['--device', 'gpu',
                             '--mode', 'tile', str(self.TILE_X),
                                               str(self.TILE_Y)])

    # copyTiles mode
    self._DoBenchPictures(['--device', 'bitmap',
                           '--mode', 'copyTile', str(self.TILE_X),
                                                 str(self.TILE_Y)])

    # Record mode
    self._DoBenchPictures(['--device', 'bitmap',
                           '--mode', 'record'])

    # Run with different bounding box heirarchies
    configs_to_run_bbh = ['tile', 'record']
    # Don't run playbackCreation on Android<commit_msg>In Debug mode, only run bench_pictures once<commit_after>#!/usr/bin/env python
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

""" Run the Skia bench_pictures executable. """

from utils import shell_utils
from build_step import BuildStep
from run_bench import BenchArgs
from run_bench import RunBench
from run_bench import PreBench
import os
import sys


# Skipping these for now to avoid excessively long cycle times.
RUNNING_ALL_CONFIGURATIONS = False


class BenchPictures(RunBench):
  def __init__(self, args, attempts=1, timeout=16800):
    super(BenchPictures, self).__init__(args, attempts=attempts,
                                        timeout=timeout)

  def _BuildDataFile(self, perf_dir, args):
    data_file = '%s_skp_%s' % (
        super(BenchPictures, self)._BuildDataFile(perf_dir),
        '_'.join(args).replace('-', '').replace(':', '-'))
    return data_file

  def _GetSkpDir(self):
    return self._skp_dir

  def _GetPerfDataDir(self):
    return self._perf_data_dir

  def _DoBenchPictures(self, args):
    cmd = [self._PathToBinary('bench_pictures'), self._GetSkpDir()] + args
    if self._GetPerfDataDir():
      PreBench(self._GetPerfDataDir())
      cmd += BenchArgs(repeats=self.BENCH_REPEAT_COUNT,
                       data_file=self._BuildDataFile(self._GetPerfDataDir(),
                                                     args))
    shell_utils.Bash(cmd)

  def _Run(self):
    # Default mode: tiled bitmap
    self._DoBenchPictures(['--device', 'bitmap',
                           '--mode', 'tile', str(self.TILE_X),
                                             str(self.TILE_Y)])

    if self._configuration == 'Debug':
      return

    # Run bitmap in tiled mode, in different numbers of threads
    for threads in [2, 3, 4]:
      self._DoBenchPictures(['--device', 'bitmap',
                             '--mode', 'tile', str(self.TILE_X),
                                               str(self.TILE_Y),
                             '--multi', str(threads)])

    # Maybe run gpu config
    gyp_defines = os.environ.get('GYP_DEFINES', '')
    if ('skia_gpu=0' not in gyp_defines and \
        (not hasattr(self, '_device') or self._device != 'nexus_s')):
      self._DoBenchPictures(['--device', 'gpu',
                             '--mode', 'tile', str(self.TILE_X),
                                               str(self.TILE_Y)])

    # copyTiles mode
    self._DoBenchPictures(['--device', 'bitmap',
                           '--mode', 'copyTile', str(self.TILE_X),
                                                 str(self.TILE_Y)])

    # Record mode
    self._DoBenchPictures(['--device', 'bitmap',
                           '--mode', 'record'])

    # Run with different bounding box heirarchies
    configs_to_run_bbh = ['tile', 'record']
    # Don't run playbackCreation on Android
{'fraction_non_alphanumeric': 0.11731460866586745, 'fraction_numerical': 0.004795341668093852, 'mean_word_length': 2.0965005302226936, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 22, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4615388', 'n_tokens_mistral': 1788, 'n_tokens_neox': 1707, 'n_words': 419}