blob: 09107dbe1ca2119bf3dcbbee7b3a110abcd25d5c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
# 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.
from pylib import android_commands
from pylib.device import device_utils
class CacheControl(object):
_DROP_CACHES = '/proc/sys/vm/drop_caches'
def __init__(self, device):
# TODO(jbudorick) Remove once telemetry gets switched over.
if isinstance(device, android_commands.AndroidCommands):
device = device_utils.DeviceUtils(device)
self._device = device
def DropRamCaches(self):
"""Drops the filesystem ram caches for performance testing."""
self._device.RunShellCommand('sync', root=True)
self._device.old_interface.SetProtectedFileContents(
CacheControl._DROP_CACHES, '3')
|