Index: build/android/pylib/android_commands.py |
diff --git a/build/android/pylib/android_commands.py b/build/android/pylib/android_commands.py |
index 1741619276ce56042a9a3df6f3b004fed1ebe3ad..d4ff05be4ed161ee9cc5c5725693a10e56ded5ad 100644 |
--- a/build/android/pylib/android_commands.py |
+++ b/build/android/pylib/android_commands.py |
@@ -1420,7 +1420,7 @@ class AndroidCommands(object): |
[0]: Dict of {metric:usage_kb}, for the process which has specified pid. |
The metric keys which may be included are: Size, Rss, Pss, Shared_Clean, |
Shared_Dirty, Private_Clean, Private_Dirty, Referenced, Swap, |
- KernelPageSize, MMUPageSize, Nvidia (tablet only). |
+ KernelPageSize, MMUPageSize, Nvidia (tablet only), VmHWM. |
[1]: Detailed /proc/[PID]/smaps information. |
""" |
usage_dict = collections.defaultdict(int) |
@@ -1455,6 +1455,16 @@ class AndroidCommands(object): |
usage_dict['Nvidia'] = int(round(usage_bytes / 1000.0)) # kB |
break |
+ peak_value_kb = 0 |
+ for line in self.GetProtectedFileContents('/proc/%s/status' % pid, |
+ log_result=False): |
+ if not line.startswith('VmHWM:'): # Format: 'VmHWM: +[0-9]+ kB' |
+ continue |
+ peak_value_kb = int(line.split(':')[1].strip().split(' ')[0]) |
+ usage_dict['VmHWM'] = peak_value_kb |
+ if not peak_value_kb: |
+ logging.warning('Could not find memory peak value for pid ' + str(pid)) |
+ |
return (usage_dict, smaps) |
def GetMemoryUsageForPackage(self, package): |