Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
_hardware_pixel.py
Go to the documentation of this file.
1# Copyright 2017 Google Inc.
2#
3# Use of this source code is governed by a BSD-style license that can be
4# found in the LICENSE file.
5
6from _hardware import Expectation
7from _hardware_android import HardwareAndroid
8
9CPU_CLOCK_RATE = 1670400
10GPU_CLOCK_RATE = 315000000
11
13 def __init__(self, adb):
14 HardwareAndroid.__init__(self, adb)
15
16 def __enter__(self):
17 HardwareAndroid.__enter__(self)
18 if not self._adb.is_root():
19 return self
20
21 self._adb.shell('\n'.join([
22 # enable and lock the two fast cores.
23 '''
24 stop thermal-engine
25 stop perfd
26
27 for N in 3 2; do
28 echo 1 > /sys/devices/system/cpu/cpu$N/online
29 echo userspace > /sys/devices/system/cpu/cpu$N/cpufreq/scaling_governor
30 echo %i > /sys/devices/system/cpu/cpu$N/cpufreq/scaling_max_freq
31 echo %i > /sys/devices/system/cpu/cpu$N/cpufreq/scaling_min_freq
32 echo %i > /sys/devices/system/cpu/cpu$N/cpufreq/scaling_setspeed
33 done''' % tuple(CPU_CLOCK_RATE for _ in range(3)),
34
35 # turn off the two slow cores
36 '''
37 for N in 1 0; do
38 echo 0 > /sys/devices/system/cpu/cpu$N/online
39 done''',
40
41 # pylint: disable=line-too-long
42
43 # Set GPU bus and idle timer
44 # Set DDR frequency to max
45 # Set GPU to performance mode, 315 MHZ
46 # See https://android.googlesource.com/platform/frameworks/base/+/master/libs/hwui/tests/scripts/prep_marlfish.sh
47 '''
48 echo 0 > /sys/class/kgsl/kgsl-3d0/bus_split
49 echo 1 > /sys/class/kgsl/kgsl-3d0/force_clk_on
50 echo 10000 > /sys/class/kgsl/kgsl-3d0/idle_timer
51
52 echo 13763 > /sys/class/devfreq/soc:qcom,gpubw/min_freq
53
54 echo performance > /sys/class/kgsl/kgsl-3d0/devfreq/governor
55 echo %i > /sys/class/kgsl/kgsl-3d0/devfreq/max_freq
56 echo %i > /sys/class/kgsl/kgsl-3d0/devfreq/min_freq
57
58 echo 4 > /sys/class/kgsl/kgsl-3d0/max_pwrlevel
59 echo 4 > /sys/class/kgsl/kgsl-3d0/min_pwrlevel''' %
60 tuple(GPU_CLOCK_RATE for _ in range(2))]))
61
62 return self
63
64 def sanity_check(self):
65 HardwareAndroid.sanity_check(self)
66
67 if not self._adb.is_root():
68 return
69
70 result = self._adb.check(' '.join(
71 ['cat',
72 '/sys/class/power_supply/battery/capacity',
73 '/sys/devices/system/cpu/online'] + \
74 ['/sys/devices/system/cpu/cpu%i/cpufreq/scaling_cur_freq' % i
75 for i in range(2, 4)] + \
76 ['/sys/kernel/debug/clk/bimc_clk/measure',
77 '/sys/class/thermal/thermal_zone22/temp',
78 '/sys/class/thermal/thermal_zone23/temp']))
79
80 expectations = \
81 [Expectation(int, min_value=30, name='battery', sleeptime=30*60),
82 Expectation(str, exact_value='2-3', name='online cpus')] + \
83 [Expectation(int, exact_value=CPU_CLOCK_RATE, name='cpu_%i clock rate' %i)
84 for i in range(2, 4)] + \
85 [Expectation(long, min_value=902390000, max_value=902409999,
86 name='measured ddr clock', sleeptime=10),
87 Expectation(int, max_value=41000, name='pm8994_tz temperature'),
88 Expectation(int, max_value=40, name='msm_therm temperature')]
89
90 Expectation.check_all(expectations, result.splitlines())
#define check(reporter, ref, unref, make, kill)