OLD | NEW |
1 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2013 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 logging | 5 import logging |
6 import subprocess | 6 import subprocess |
7 import tempfile | 7 import tempfile |
8 | 8 |
9 from telemetry import decorators | 9 from telemetry import decorators |
10 from telemetry.core import bitmap | 10 from telemetry.core import bitmap |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 return super(AndroidPlatformBackend, self).GetCpuTimestamp() | 120 return super(AndroidPlatformBackend, self).GetCpuTimestamp() |
121 | 121 |
122 def PurgeUnpinnedMemory(self): | 122 def PurgeUnpinnedMemory(self): |
123 """Purges the unpinned ashmem memory for the whole system. | 123 """Purges the unpinned ashmem memory for the whole system. |
124 | 124 |
125 This can be used to make memory measurements more stable in particular. | 125 This can be used to make memory measurements more stable in particular. |
126 """ | 126 """ |
127 if not android_prebuilt_profiler_helper.InstallOnDevice( | 127 if not android_prebuilt_profiler_helper.InstallOnDevice( |
128 self._device, 'purge_ashmem'): | 128 self._device, 'purge_ashmem'): |
129 raise Exception('Error installing purge_ashmem.') | 129 raise Exception('Error installing purge_ashmem.') |
130 if self._device.old_interface.RunShellCommand( | 130 (status, output) = self._device.old_interface.GetAndroidToolStatusAndOutput( |
131 android_prebuilt_profiler_helper.GetDevicePath('purge_ashmem'), | 131 android_prebuilt_profiler_helper.GetDevicePath('purge_ashmem'), |
132 log_result=True): | 132 log_result=True) |
133 return | 133 if status != 0: |
134 raise Exception('Error while purging ashmem.') | 134 raise Exception('Error while purging ashmem: ' + '\n'.join(output)) |
135 | 135 |
136 def GetMemoryStats(self, pid): | 136 def GetMemoryStats(self, pid): |
137 memory_usage = self._device.old_interface.GetMemoryUsageForPid(pid) | 137 memory_usage = self._device.old_interface.GetMemoryUsageForPid(pid) |
138 return {'ProportionalSetSize': memory_usage['Pss'] * 1024, | 138 return {'ProportionalSetSize': memory_usage['Pss'] * 1024, |
139 'SharedDirty': memory_usage['Shared_Dirty'] * 1024, | 139 'SharedDirty': memory_usage['Shared_Dirty'] * 1024, |
140 'PrivateDirty': memory_usage['Private_Dirty'] * 1024, | 140 'PrivateDirty': memory_usage['Private_Dirty'] * 1024, |
141 'VMPeak': memory_usage['VmHWM'] * 1024} | 141 'VMPeak': memory_usage['VmHWM'] * 1024} |
142 | 142 |
143 def GetIOStats(self, pid): | 143 def GetIOStats(self, pid): |
144 return {} | 144 return {} |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
323 output = [] | 323 output = [] |
324 for line in ps: | 324 for line in ps: |
325 data = line.split() | 325 data = line.split() |
326 curr_pid = data[1] | 326 curr_pid = data[1] |
327 curr_name = data[-1] | 327 curr_name = data[-1] |
328 if columns == ['pid', 'name']: | 328 if columns == ['pid', 'name']: |
329 output.append([curr_pid, curr_name]) | 329 output.append([curr_pid, curr_name]) |
330 else: | 330 else: |
331 output.append([curr_pid]) | 331 output.append([curr_pid]) |
332 return output | 332 return output |
OLD | NEW |