<commit_before># Copyright 2016 Google Inc.
#
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

from _hardware import HardwareException, Expectation
from _hardware_android import HardwareAndroid

CPU_CLOCK_RATE = 1836000
GPU_EMC_PROFILE = '0c: core 921 MHz emc 1600 MHz a A d D *'
GPU_EMC_PROFILE_ID = '0c'

class HardwarePixelC(HardwareAndroid):
  def __init__(self, adb):
    HardwareAndroid.__init__(self, adb)

  def __enter__(self):
    HardwareAndroid.__enter__(self)
    if not self._adb.is_root():
      return self

    self._adb.shell('\n'.join([
      # turn on and lock the first 3 cores.
      '''
      for N in 0 1 2; do
        echo 1 > /sys/devices/system/cpu/cpu$N/online
        echo userspace > /sys/devices/system/cpu/cpu$N/cpufreq/scaling_governor
        echo %i > /sys/devices/system/cpu/cpu$N/cpufreq/scaling_max_freq
        echo %i > /sys/devices/system/cpu/cpu$N/cpufreq/scaling_min_freq
        echo %i > /sys/devices/system/cpu/cpu$N/cpufreq/scaling_setspeed
      done''' % tuple(CPU_CLOCK_RATE for _ in range(3)),

      # turn off the fourth core.
      '''
      echo 0 > /sys/devices/system/cpu/cpu3/online''',

      # lock gpu/emc clocks.
      '''<commit_msg>[skpbench] Use android's perf settings for Pixel C<commit_after># Copyright 2016 Google Inc.
#
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

from _hardware import HardwareException, Expectation
from _hardware_android import HardwareAndroid

CPU_CLOCK_RATE = 1326000
# If you run adb cat /sys/devices/57000000.gpu/pstate it shows all
# possible configurations, with a * next to the current one.
GPU_EMC_PROFILE = '04: core 307 MHz emc 1065 MHz a A d D *'
GPU_EMC_PROFILE_ID = '04'

class HardwarePixelC(HardwareAndroid):
  def __init__(self, adb):
    HardwareAndroid.__init__(self, adb)

  def __enter__(self):
    HardwareAndroid.__enter__(self)
    if not self._adb.is_root():
      return self

    self._adb.shell('\n'.join([
      # pylint: disable=line-too-long
      # Based on https://android.googlesource.com/platform/frameworks/base/+/master/libs/hwui/tests/scripts/prep_ryu.sh
      # All CPUs have the same scaling settings, so we only need to set it once
      '''
      stop thermal-engine
      stop perfd

      echo userspace > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
      echo %i > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
      echo %i > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
      echo %i > /sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed
      ''' % tuple(CPU_CLOCK_RATE for _ in range(3)),
      # turn off the fourth core. This will hopefully produce less heat, allowing
      # for more consistent results.  3 cores should be enough to run Ganesh,
      # the graphics driver, and the OS.
      '''
      echo 0 > /sys/devices/system/cpu/cpu3/online''',

      # lock gpu/emc clocks.
      '''
{'fraction_non_alphanumeric': 0.10121049092131809, 'fraction_numerical': 0.02219233355749832, 'mean_word_length': 3.1147994467496543, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 14, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6327109', 'n_tokens_mistral': 1049, 'n_tokens_neox': 968, 'n_words': 277}