[recipes] Define variables in __init__

This may fix weird races in tests.

Bug: skia:
Change-Id: I41c36424c7b559301e915a0892590c74931ae463
Reviewed-on: https://skia-review.googlesource.com/93942
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Eric Boren <borenet@google.com>
This commit is contained in:
Eric Boren 2018-01-12 10:26:52 -05:00 committed by Skia Commit-Bot
parent 24be3166c4
commit 620c0b6378

View File

@ -28,6 +28,45 @@ class GNAndroidFlavorUtils(default_flavor.DefaultFlavorUtils):
svg_dir = self.m.vars.android_data_dir + 'svgs',
tmp_dir = self.m.vars.android_data_dir)
# A list of devices we can't root. If rooting fails and a device is not
# on the list, we fail the task to avoid perf inconsistencies.
self.rootable_blacklist = ['GalaxyS6', 'GalaxyS7_G930A', 'GalaxyS7_G930FD',
'MotoG4', 'NVIDIA_Shield']
# Maps device type -> CPU ids that should be scaled for nanobench.
# Many devices have two (or more) different CPUs (e.g. big.LITTLE
# on Nexus5x). The CPUs listed are the biggest cpus on the device.
# The CPUs are grouped together, so we only need to scale one of them
# (the one listed) in order to scale them all.
# E.g. Nexus5x has cpu0-3 as one chip and cpu4-5 as the other. Thus,
# if one wants to run a single-threaded application (e.g. nanobench), one
# can disable cpu0-3 and scale cpu 4 to have only cpu4 and 5 at the same
# frequency. See also disable_for_nanobench.
self.cpus_to_scale = {
'Nexus5x': [4],
'NexusPlayer': [0, 2], # has 2 identical chips, so scale them both.
'Pixel': [2],
'Pixel2XL': [4]
}
# Maps device type -> CPU ids that should be turned off when running
# single-threaded applications like nanobench. The devices listed have
# multiple, differnt CPUs. We notice a lot of noise that seems to be
# caused by nanobench running on the slow CPU, then the big CPU. By
# disabling this, we see less of that noise by forcing the same CPU
# to be used for the performance testing every time.
self.disable_for_nanobench = {
'Nexus5x': range(0, 4),
'Pixel': range(0, 2),
'Pixel2XL': range(0, 4),
'PixelC': range(0, 2)
}
self.gpu_scaling = {
"Nexus5": 450000000,
"Nexus5x": 600000000,
}
def _run(self, title, *cmd, **kwargs):
with self.m.context(cwd=self.m.vars.skia_dir):
return self.m.run(self.m.step, title, cmd=list(cmd), **kwargs)
@ -68,45 +107,6 @@ class GNAndroidFlavorUtils(default_flavor.DefaultFlavorUtils):
between_attempts_fn=wait_for_device,
**kwargs)
# A list of devices we can't root. If rooting fails and a device is not
# on the list, we fail the task to avoid perf inconsistencies.
rootable_blacklist = ['GalaxyS6', 'GalaxyS7_G930A', 'GalaxyS7_G930FD',
'MotoG4', 'NVIDIA_Shield']
# Maps device type -> CPU ids that should be scaled for nanobench.
# Many devices have two (or more) different CPUs (e.g. big.LITTLE
# on Nexus5x). The CPUs listed are the biggest cpus on the device.
# The CPUs are grouped together, so we only need to scale one of them
# (the one listed) in order to scale them all.
# E.g. Nexus5x has cpu0-3 as one chip and cpu4-5 as the other. Thus,
# if one wants to run a single-threaded application (e.g. nanobench), one
# can disable cpu0-3 and scale cpu 4 to have only cpu4 and 5 at the same
# frequency. See also disable_for_nanobench.
cpus_to_scale = {
'Nexus5x': [4],
'NexusPlayer': [0, 2], # has 2 identical chips, so scale them both.
'Pixel': [2],
'Pixel2XL': [4]
}
# Maps device type -> CPU ids that should be turned off when running
# single-threaded applications like nanobench. The devices listed have
# multiple, differnt CPUs. We notice a lot of noise that seems to be
# caused by nanobench running on the slow CPU, then the big CPU. By
# disabling this, we see less of that noise by forcing the same CPU
# to be used for the performance testing every time.
disable_for_nanobench = {
'Nexus5x': range(0, 4),
'Pixel': range(0, 2),
'Pixel2XL': range(0, 4),
'PixelC': range(0, 2)
}
gpu_scaling = {
"Nexus5": 450000000,
"Nexus5x": 600000000,
}
def _scale_for_dm(self):
device = self.m.vars.builder_cfg.get('model')
if (device in self.rootable_blacklist or