Commit 24bb45f4 authored by Andrew Grieve's avatar Andrew Grieve Committed by Commit Bot

apk_operations.py: Add --local to dumpsys meminfo by default

Without --local, the dumpsys command changes the memory usage of the
app! With --local, we lose:

Objects
               Views:        0         ViewRootImpl:        0
         AppContexts:        4           Activities:        0
              Assets:        2        AssetManagers:        2
       Local Binders:        3        Proxy Binders:        7
    Death Recipients:        0
     OpenSSL Sockets:        0

Added --query-app flag to get these back.

Change-Id: If47994b64620ae266c6109d9747a81aa805b293c
Reviewed-on: https://chromium-review.googlesource.com/1062329Reviewed-by: default avatarPeter Wen <wnwen@chromium.org>
Commit-Queue: agrieve <agrieve@chromium.org>
Cr-Commit-Position: refs/heads/master@{#559269}
parent 6680bbcc
......@@ -210,11 +210,15 @@ def _PrintPerDeviceOutput(devices, results, single_line=False):
yield result
def _RunMemUsage(devices, package_name):
def _RunMemUsage(devices, package_name, query_app=False):
cmd_args = ['dumpsys', 'meminfo']
if not query_app:
cmd_args.append('--local')
def mem_usage_helper(d):
ret = []
for process in sorted(_GetPackageProcesses(d, package_name)):
meminfo = d.RunShellCommand(['dumpsys', 'meminfo', str(process.pid)])
meminfo = d.RunShellCommand(cmd_args + [str(process.pid)])
ret.append((process.name, '\n'.join(meminfo)))
return ret
......@@ -1052,8 +1056,15 @@ class _MemUsageCommand(_Command):
needs_package_name = True
all_devices_by_default = True
def _RegisterExtraArgs(self, group):
group.add_argument('--query-app', action='store_true',
help='Do not add --local to "dumpsys meminfo". This will output '
'additional metrics (e.g. Context count), but also cause memory '
'to be used in order to gather the metrics.')
def Run(self):
_RunMemUsage(self.devices, self.args.package_name)
_RunMemUsage(self.devices, self.args.package_name,
query_app=self.args.query_app)
class _ShellCommand(_Command):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment