Index: build/android/pylib/perf/cache_control.py |
diff --git a/build/android/pylib/perf/cache_control.py b/build/android/pylib/perf/cache_control.py |
new file mode 100644 |
index 0000000000000000000000000000000000000000..1b0a4c2b95529fa549b2db7b9ac997861b4c5f05 |
--- /dev/null |
+++ b/build/android/pylib/perf/cache_control.py |
@@ -0,0 +1,16 @@ |
+# Copyright 2013 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. |
+ |
+ |
+class CacheControl(object): |
+ _DROP_CACHES = '/proc/sys/vm/drop_caches' |
+ |
+ def __init__(self, adb): |
+ self._adb = adb |
+ |
+ def DropRamCaches(self): |
+ """Drops the filesystem ram caches for performance testing.""" |
+ self._adb.RunShellCommandWithSU('sync') |
+ self._adb.SetProtectedFileContents(CacheControl._DROP_CACHES, '3') |
+ |