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

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

Issue 10836323: Change Android build configurations (step 2). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed unnecessary changes Created 8 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « build/android/pylib/base_test_runner.py ('k') | build/android/pylib/fake_dns.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
11 import sys 11 import sys
12 import urllib 12 import urllib
13 13
14 import constants 14 import constants
15 import io_stats_parser 15 import io_stats_parser
16 16
17 17
18 class DeviceStatsMonitor(object): 18 class DeviceStatsMonitor(object):
19 """Class for collecting device stats such as IO/CPU usage. 19 """Class for collecting device stats such as IO/CPU usage.
20 20
21 Args: 21 Args:
22 adb: Instance of AndroidComannds. 22 adb: Instance of AndroidComannds.
23 hz: Frequency at which to sample device stats. 23 hz: Frequency at which to sample device stats.
24 """ 24 """
25 25
26 DEVICE_PATH = '/data/local/tmp/device_stats_monitor' 26 DEVICE_PATH = '/data/local/tmp/device_stats_monitor'
27 HOST_PATH = os.path.abspath(os.path.join(
28 constants.CHROME_DIR, 'out', 'Release', 'device_stats_monitor'))
29 PROFILE_PATH = '/sdcard/Download/device_stats_monitor.profile' 27 PROFILE_PATH = '/sdcard/Download/device_stats_monitor.profile'
30 RESULT_VIEWER_PATH = os.path.abspath(os.path.join( 28 RESULT_VIEWER_PATH = os.path.abspath(os.path.join(
31 os.path.dirname(os.path.realpath(__file__)), 'device_stats_monitor.html')) 29 os.path.dirname(os.path.realpath(__file__)), 'device_stats_monitor.html'))
32 30
33 def __init__(self, adb, hz): 31 def __init__(self, adb, hz, build_type):
34 self._adb = adb 32 self._adb = adb
35 self._adb.PushIfNeeded(DeviceStatsMonitor.HOST_PATH, 33 host_path = os.path.abspath(os.path.join(
36 DeviceStatsMonitor.DEVICE_PATH) 34 constants.CHROME_DIR, 'out', build_type, 'device_stats_monitor'))
35 self._adb.PushIfNeeded(host_path, DeviceStatsMonitor.DEVICE_PATH)
37 self._hz = hz 36 self._hz = hz
38 37
39 def Start(self): 38 def Start(self):
40 """Starts device stats monitor on the device.""" 39 """Starts device stats monitor on the device."""
41 self._adb.SetFileContents(DeviceStatsMonitor.PROFILE_PATH, '') 40 self._adb.SetFileContents(DeviceStatsMonitor.PROFILE_PATH, '')
42 self._process = subprocess.Popen( 41 self._process = subprocess.Popen(
43 ['adb', 'shell', '%s --hz=%d %s' % ( 42 ['adb', 'shell', '%s --hz=%d %s' % (
44 DeviceStatsMonitor.DEVICE_PATH, self._hz, 43 DeviceStatsMonitor.DEVICE_PATH, self._hz,
45 DeviceStatsMonitor.PROFILE_PATH)]) 44 DeviceStatsMonitor.PROFILE_PATH)])
46 45
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 'user', 106 'user',
108 'nice', 107 'nice',
109 'system', 108 'system',
110 'idle', 109 'idle',
111 'iowait', 110 'iowait',
112 'irq', 111 'irq',
113 'softirq', 112 'softirq',
114 ]) 113 ])
115 fields = line.split() 114 fields = line.split()
116 return cpu_stats._make([fields[0]] + [int(f) for f in fields[1:8]]) 115 return cpu_stats._make([fields[0]] + [int(f) for f in fields[1:8]])
OLDNEW
« no previous file with comments | « build/android/pylib/base_test_runner.py ('k') | build/android/pylib/fake_dns.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698