OLD | NEW |
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 import re | 5 import re |
6 import sys | 6 import sys |
7 | 7 |
8 import android_commands | 8 import android_commands |
9 import json | 9 import json |
10 import math | 10 import math |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 | 172 |
173 def RestoreOriginalPerfMode(self): | 173 def RestoreOriginalPerfMode(self): |
174 """Resets the original performance mode of the device.""" | 174 """Resets the original performance mode of the device.""" |
175 self._SetScalingGovernorInternal(self._original_scaling_governor) | 175 self._SetScalingGovernorInternal(self._original_scaling_governor) |
176 | 176 |
177 def _SetScalingGovernorInternal(self, value): | 177 def _SetScalingGovernorInternal(self, value): |
178 for cpu in range(self._kernel_max + 1): | 178 for cpu in range(self._kernel_max + 1): |
179 scaling_governor_file = PerfControl._SCALING_GOVERNOR_FMT % cpu | 179 scaling_governor_file = PerfControl._SCALING_GOVERNOR_FMT % cpu |
180 if self._adb.FileExistsOnDevice(scaling_governor_file): | 180 if self._adb.FileExistsOnDevice(scaling_governor_file): |
181 self._adb.SetProtectedFileContents(scaling_governor_file, value) | 181 self._adb.SetProtectedFileContents(scaling_governor_file, value) |
182 | |
183 | |
184 class PerfTestSetup(PerfControl): | |
185 """Provides methods for setting up a device for perf testing. | |
186 | |
187 TODO(aberent): remove once all tests have been moved to the new classes | |
188 """ | |
189 | |
190 def DropRamCaches(self): | |
191 CacheControl(self._adb).DropRamCaches() | |
192 | |
193 def SetUp(self): | |
194 self.SetHighPerfMode() | |
195 self.DropRamCaches() | |
196 | |
197 def TearDown(self): | |
198 self.ResetOriginalPerfMode() | |
OLD | NEW |