Commit 9343757f authored by tonyg@chromium.org's avatar tonyg@chromium.org

[Telemetry] Allow memory info to go missing on non-rooted devices.

BUG=400734

Review URL: https://codereview.chromium.org/440783003

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@287593 0039d316-1c4b-4281-b951-d872f2087c98
parent 10b69072
......@@ -177,10 +177,12 @@ class Browser(object):
"""
self._platform_backend.PurgeUnpinnedMemory()
result = self._GetStatsCommon(self._platform_backend.GetMemoryStats)
result['SystemCommitCharge'] = \
self._platform_backend.GetSystemCommitCharge()
result['SystemTotalPhysicalMemory'] = \
self._platform_backend.GetSystemTotalPhysicalMemory()
commit_charge = self._platform_backend.GetSystemCommitCharge()
if commit_charge:
result['SystemCommitCharge'] = commit_charge
total = self._platform_backend.GetSystemTotalPhysicalMemory()
if total:
result['SystemTotalPhysicalMemory'] = total
return result
@property
......
......@@ -21,6 +21,8 @@ class ProcSupportingPlatformBackend(platform_backend.PlatformBackend):
def GetSystemCommitCharge(self):
meminfo_contents = self._GetFileContents('/proc/meminfo')
meminfo = self._GetProcFileDict(meminfo_contents)
if not meminfo:
return None
return (self._ConvertKbToByte(meminfo['MemTotal'])
- self._ConvertKbToByte(meminfo['MemFree'])
- self._ConvertKbToByte(meminfo['Buffers'])
......@@ -30,6 +32,8 @@ class ProcSupportingPlatformBackend(platform_backend.PlatformBackend):
def GetSystemTotalPhysicalMemory(self):
meminfo_contents = self._GetFileContents('/proc/meminfo')
meminfo = self._GetProcFileDict(meminfo_contents)
if not meminfo:
return None
return self._ConvertKbToByte(meminfo['MemTotal'])
def GetCpuStats(self, pid):
......
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