| Index: tools/telemetry/telemetry/core/chrome/android_platform_backend.py
|
| diff --git a/tools/telemetry/telemetry/core/chrome/android_platform_backend.py b/tools/telemetry/telemetry/core/chrome/android_platform_backend.py
|
| index 47b9e5bf537b060c1e95d7b2759cec77d51bb6b3..20ede1463d078ce166f8463e096beff2cfdd28fc 100644
|
| --- a/tools/telemetry/telemetry/core/chrome/android_platform_backend.py
|
| +++ b/tools/telemetry/telemetry/core/chrome/android_platform_backend.py
|
| @@ -6,6 +6,8 @@ import logging
|
| import os
|
| import sys
|
|
|
| +from telemetry.core.chrome import platform_backend
|
| +
|
| # Get build/android scripts into our path.
|
| sys.path.append(
|
| os.path.abspath(
|
| @@ -21,7 +23,7 @@ except Exception:
|
| surface_stats_collector = None
|
|
|
|
|
| -class AndroidPlatformBackend(object):
|
| +class AndroidPlatformBackend(platform_backend.PlatformBackend):
|
| def __init__(self, adb, window_package, window_activity, no_performance_mode):
|
| super(AndroidPlatformBackend, self).__init__()
|
| self._adb = adb
|
| @@ -64,3 +66,35 @@ class AndroidPlatformBackend(object):
|
|
|
| def HasBeenThermallyThrottled(self):
|
| return self._thermal_throttle.HasBeenThrottled()
|
| +
|
| + def GetSystemCommitCharge(self):
|
| + for line in self._adb.RunShellCommand('dumpsys meminfo', log_result=False):
|
| + if line.startswith('Total PSS: '):
|
| + return int(line.split()[2]) * 1024
|
| + return 0
|
| +
|
| + def GetMemoryStats(self, pid):
|
| + memory_usage = self._adb.GetMemoryUsageForPid(pid)[0]
|
| + return {'ProportionalSetSize': memory_usage['Pss'] * 1024,
|
| + 'PrivateDirty': memory_usage['Private_Dirty'] * 1024}
|
| +
|
| + def GetIOStats(self, pid):
|
| + return {}
|
| +
|
| + def GetChildPids(self, pid):
|
| + child_pids = []
|
| + ps = self._adb.RunShellCommand('ps', log_result=False)[1:]
|
| + for line in ps:
|
| + data = line.split()
|
| + curr_pid = data[1]
|
| + curr_name = data[-1]
|
| + if int(curr_pid) == pid:
|
| + name = curr_name
|
| + for line in ps:
|
| + data = line.split()
|
| + curr_pid = data[1]
|
| + curr_name = data[-1]
|
| + if curr_name.startswith(name) and curr_name != name:
|
| + child_pids.append(int(curr_pid))
|
| + break
|
| + return child_pids
|
|
|