Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(52)

Side by Side Diff: trunk/src/build/android/pylib/android_commands.py

Issue 111773002: Revert 239784 "Make page_cycler.py fully measure memory for each..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | trunk/src/tools/perf/measurements/media.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 """Provides an interface to communicate with the device via the adb command. 5 """Provides an interface to communicate with the device via the adb command.
6 6
7 Assumes adb binary is currently on system path. 7 Assumes adb binary is currently on system path.
8 """ 8 """
9 9
10 import collections 10 import collections
11 import datetime 11 import datetime
12 import inspect 12 import inspect
13 import logging 13 import logging
14 import os 14 import os
15 import re 15 import re
16 import shlex 16 import shlex
17 import signal 17 import signal
18 import subprocess 18 import subprocess
19 import sys 19 import sys
20 import tempfile 20 import tempfile
21 import time 21 import time
22 22
23 import cmd_helper 23 import cmd_helper
24 import constants 24 import constants
25 import screenshot 25 import screenshot
26 import system_properties 26 import system_properties
27 27
28 from utils import host_path_finder
29
28 try: 30 try:
29 from pylib import pexpect 31 from pylib import pexpect
30 except: 32 except:
31 pexpect = None 33 pexpect = None
32 34
33 sys.path.append(os.path.join( 35 sys.path.append(os.path.join(
34 constants.DIR_SOURCE_ROOT, 'third_party', 'android_testrunner')) 36 constants.DIR_SOURCE_ROOT, 'third_party', 'android_testrunner'))
35 import adb_interface 37 import adb_interface
36 import am_instrument_parser 38 import am_instrument_parser
37 import errors 39 import errors
(...skipping 1454 matching lines...) Expand 10 before | Expand all | Expand 10 after
1492 if stats.device == 'mmcblk0': 1494 if stats.device == 'mmcblk0':
1493 return { 1495 return {
1494 'num_reads': stats.num_reads_issued, 1496 'num_reads': stats.num_reads_issued,
1495 'num_writes': stats.num_writes_completed, 1497 'num_writes': stats.num_writes_completed,
1496 'read_ms': stats.ms_spent_reading, 1498 'read_ms': stats.ms_spent_reading,
1497 'write_ms': stats.ms_spent_writing, 1499 'write_ms': stats.ms_spent_writing,
1498 } 1500 }
1499 logging.warning('Could not find disk IO stats.') 1501 logging.warning('Could not find disk IO stats.')
1500 return None 1502 return None
1501 1503
1504 def PurgeUnpinnedAshmem(self):
1505 """Purges the unpinned ashmem memory for the whole system.
1506
1507 This can be used to make memory measurements more stable in particular.
1508 """
1509 host_path = host_path_finder.GetMostRecentHostPath('purge_ashmem')
1510 if not host_path:
1511 raise Exception('Could not find the purge_ashmem binary.')
1512 device_path = os.path.join(constants.TEST_EXECUTABLE_DIR, 'purge_ashmem')
1513 self.PushIfNeeded(host_path, device_path)
1514 if self.RunShellCommand(device_path, log_result=True):
1515 return
1516 raise Exception('Error while purging ashmem.')
1517
1502 def GetMemoryUsageForPid(self, pid): 1518 def GetMemoryUsageForPid(self, pid):
1503 """Returns the memory usage for given pid. 1519 """Returns the memory usage for given pid.
1504 1520
1505 Args: 1521 Args:
1506 pid: The pid number of the specific process running on device. 1522 pid: The pid number of the specific process running on device.
1507 1523
1508 Returns: 1524 Returns:
1509 A tuple containg: 1525 A tuple containg:
1510 [0]: Dict of {metric:usage_kb}, for the process which has specified pid. 1526 [0]: Dict of {metric:usage_kb}, for the process which has specified pid.
1511 The metric keys which may be included are: Size, Rss, Pss, Shared_Clean, 1527 The metric keys which may be included are: Size, Rss, Pss, Shared_Clean,
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
1753 """ 1769 """
1754 def __init__(self, output): 1770 def __init__(self, output):
1755 self._output = output 1771 self._output = output
1756 1772
1757 def write(self, data): 1773 def write(self, data):
1758 data = data.replace('\r\r\n', '\n') 1774 data = data.replace('\r\r\n', '\n')
1759 self._output.write(data) 1775 self._output.write(data)
1760 1776
1761 def flush(self): 1777 def flush(self):
1762 self._output.flush() 1778 self._output.flush()
OLDNEW
« no previous file with comments | « no previous file | trunk/src/tools/perf/measurements/media.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698