Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(21)

Side by Side Diff: build/android/pylib/device_stats_monitor.py

Issue 11876021: Support startup performance tests on Galaxy S3 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Support startup performance tests on Galaxy S3 - code review fixes Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 """Utilities for iotop/top style profiling for android.""" 5 """Utilities for iotop/top style profiling for android."""
6 6
7 import collections 7 import collections
8 import json 8 import json
9 import os 9 import os
10 import subprocess 10 import subprocess
(...skipping 20 matching lines...) Expand all
31 31
32 def __init__(self, adb, hz, build_type): 32 def __init__(self, adb, hz, build_type):
33 self._adb = adb 33 self._adb = adb
34 host_path = os.path.abspath(os.path.join( 34 host_path = os.path.abspath(os.path.join(
35 constants.CHROME_DIR, 'out', build_type, 'device_stats_monitor')) 35 constants.CHROME_DIR, 'out', build_type, 'device_stats_monitor'))
36 self._adb.PushIfNeeded(host_path, DeviceStatsMonitor.DEVICE_PATH) 36 self._adb.PushIfNeeded(host_path, DeviceStatsMonitor.DEVICE_PATH)
37 self._hz = hz 37 self._hz = hz
38 38
39 def Start(self): 39 def Start(self):
40 """Starts device stats monitor on the device.""" 40 """Starts device stats monitor on the device."""
41 self._adb.SetFileContents(DeviceStatsMonitor.PROFILE_PATH, '') 41 self._adb.SetProtectedFileContents(DeviceStatsMonitor.PROFILE_PATH, '')
42 self._process = subprocess.Popen( 42 self._process = subprocess.Popen(
43 ['adb', 'shell', '%s --hz=%d %s' % ( 43 ['adb', 'shell', '%s --hz=%d %s' % (
44 DeviceStatsMonitor.DEVICE_PATH, self._hz, 44 DeviceStatsMonitor.DEVICE_PATH, self._hz,
45 DeviceStatsMonitor.PROFILE_PATH)]) 45 DeviceStatsMonitor.PROFILE_PATH)])
46 46
47 def StopAndCollect(self, output_path): 47 def StopAndCollect(self, output_path):
48 """Stops monitoring and saves results. 48 """Stops monitoring and saves results.
49 49
50 Args: 50 Args:
51 output_path: Path to save results. 51 output_path: Path to save results.
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 'user', 107 'user',
108 'nice', 108 'nice',
109 'system', 109 'system',
110 'idle', 110 'idle',
111 'iowait', 111 'iowait',
112 'irq', 112 'irq',
113 'softirq', 113 'softirq',
114 ]) 114 ])
115 fields = line.split() 115 fields = line.split()
116 return cpu_stats._make([fields[0]] + [int(f) for f in fields[1:8]]) 116 return cpu_stats._make([fields[0]] + [int(f) for f in fields[1:8]])
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698