summaryrefslogtreecommitdiffstats
path: root/build/android/pylib
diff options
context:
space:
mode:
authorbulach@chromium.org <bulach@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-14 04:05:01 +0000
committerbulach@chromium.org <bulach@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-14 04:05:01 +0000
commit98aa94715a8c70c28983abec8436cfb195085814 (patch)
tree05ce541ebb22fa10a97216c100aeb9eb393c878e /build/android/pylib
parentb1f6815226fc9ef279bff85fc31b260c3d6b9d07 (diff)
downloadchromium_src-98aa94715a8c70c28983abec8436cfb195085814.zip
chromium_src-98aa94715a8c70c28983abec8436cfb195085814.tar.gz
chromium_src-98aa94715a8c70c28983abec8436cfb195085814.tar.bz2
[Telemetry] Speed up page_cycler on android.
4m7s -> 3m51s: remove expensive regexp. Short-circuits "VmHWM". Remove old stats for xoom tablets. BUG=372489 Review URL: https://codereview.chromium.org/278763005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@270329 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'build/android/pylib')
-rw-r--r--build/android/pylib/android_commands.py22
1 files changed, 6 insertions, 16 deletions
diff --git a/build/android/pylib/android_commands.py b/build/android/pylib/android_commands.py
index 04b73de..b5fab46 100644
--- a/build/android/pylib/android_commands.py
+++ b/build/android/pylib/android_commands.py
@@ -55,10 +55,6 @@ LOCAL_PROPERTIES_PATH = constants.DEVICE_LOCAL_PROPERTIES_PATH
# Property in /data/local.prop that controls Java assertions.
JAVA_ASSERT_PROPERTY = 'dalvik.vm.enableassertions'
-MEMORY_INFO_RE = re.compile('^(?P<key>\w+):\s+(?P<usage_kb>\d+) kB$')
-NVIDIA_MEMORY_INFO_RE = re.compile('^\s*(?P<user>\S+)\s*(?P<name>\S+)\s*'
- '(?P<pid>\d+)\s*(?P<usage_bytes>\d+)$')
-
# Keycode "enum" suitable for passing to AndroidCommands.SendKey().
KEYCODE_HOME = 3
KEYCODE_BACK = 4
@@ -1598,7 +1594,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), VmHWM.
+ KernelPageSize, MMUPageSize, VmHWM.
[1]: Detailed /proc/[PID]/smaps information.
"""
usage_dict = collections.defaultdict(int)
@@ -1612,10 +1608,10 @@ class AndroidCommands(object):
current_smap = ' '.join(items[5:])
elif len(items) > 3:
current_smap = ' '.join(items[3:])
- match = re.match(MEMORY_INFO_RE, line)
- if match:
- key = match.group('key')
- usage_kb = int(match.group('usage_kb'))
+ if line.endswith('kB'):
+ key, value = line.split(':')
+ key = key.strip()
+ usage_kb = int(value.strip().split()[0])
usage_dict[key] += usage_kb
if key not in smaps[current_smap]:
smaps[current_smap][key] = 0
@@ -1624,18 +1620,12 @@ class AndroidCommands(object):
# Presumably the process died between ps and calling this method.
logging.warning('Could not find memory usage for pid ' + str(pid))
- for line in self.GetProtectedFileContents('/d/nvmap/generic-0/clients'):
- match = re.match(NVIDIA_MEMORY_INFO_RE, line)
- if match and match.group('pid') == pid:
- usage_bytes = int(match.group('usage_bytes'))
- usage_dict['Nvidia'] = int(round(usage_bytes / 1000.0)) # kB
- break
-
peak_value_kb = 0
for line in self.GetProtectedFileContents('/proc/%s/status' % pid):
if not line.startswith('VmHWM:'): # Format: 'VmHWM: +[0-9]+ kB'
continue
peak_value_kb = int(line.split(':')[1].strip().split(' ')[0])
+ break
usage_dict['VmHWM'] = peak_value_kb
if not peak_value_kb:
logging.warning('Could not find memory peak value for pid ' + str(pid))