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

Side by Side Diff: tools/android/appstats.py

Issue 1288993002: Revert of [Android] Remove android_commands and android_testrunner. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
« no previous file with comments | « third_party/android_testrunner/run_command.py ('k') | tools/checkperms/checkperms.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 #!/usr/bin/python 1 #!/usr/bin/python
2 # Copyright 2015 The Chromium Authors. All rights reserved. 2 # Copyright 2015 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 # 'top'-like memory/network polling for Android apps. 6 # 'top'-like memory/network polling for Android apps.
7 7
8 import argparse 8 import argparse
9 import curses 9 import curses
10 import os 10 import os
11 import re 11 import re
12 import sys 12 import sys
13 import time 13 import time
14 14
15 from operator import sub 15 from operator import sub
16 16
17 sys.path.append(os.path.join(os.path.dirname(__file__), 17 sys.path.append(os.path.join(os.path.dirname(__file__),
18 os.pardir, 18 os.pardir,
19 os.pardir, 19 os.pardir,
20 'build', 20 'build',
21 'android')) 21 'android'))
22 from pylib import android_commands
22 from pylib.device import device_errors 23 from pylib.device import device_errors
23 from pylib.device import device_utils 24 from pylib.device import device_utils
24 25
25 class Utils(object): 26 class Utils(object):
26 """A helper class to hold various utility methods.""" 27 """A helper class to hold various utility methods."""
27 28
28 @staticmethod 29 @staticmethod
29 def FindLines(haystack, needle): 30 def FindLines(haystack, needle):
30 """A helper method to find lines in |haystack| that contain the string 31 """A helper method to find lines in |haystack| that contain the string
31 |needle|.""" 32 |needle|."""
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 @staticmethod 99 @staticmethod
99 def GetDeviceModel(adb): 100 def GetDeviceModel(adb):
100 """Returns the model of the device with the |adb| connection.""" 101 """Returns the model of the device with the |adb| connection."""
101 return adb.GetProp('ro.product.model').strip() 102 return adb.GetProp('ro.product.model').strip()
102 103
103 @staticmethod 104 @staticmethod
104 def GetDeviceToTrack(preset=None): 105 def GetDeviceToTrack(preset=None):
105 """Returns a device serial to connect to. If |preset| is specified it will 106 """Returns a device serial to connect to. If |preset| is specified it will
106 return |preset| if it is connected and |None| otherwise. If |preset| is not 107 return |preset| if it is connected and |None| otherwise. If |preset| is not
107 specified it will return the first connected device.""" 108 specified it will return the first connected device."""
108 devices = [d.adb.GetDeviceSerial() 109 devices = android_commands.GetAttachedDevices()
109 for d in device_utils.DeviceUtils.HealthyDevices()]
110 if not devices: 110 if not devices:
111 return None 111 return None
112 112
113 if preset: 113 if preset:
114 return preset if preset in devices else None 114 return preset if preset in devices else None
115 115
116 return devices[0] 116 return devices[0]
117 117
118 @staticmethod 118 @staticmethod
119 def GetPidsToTrack(adb, default_pid=None, process_filter=None): 119 def GetPidsToTrack(adb, default_pid=None, process_filter=None):
(...skipping 882 matching lines...) Expand 10 before | Expand all | Expand 10 after
1002 if args.text_file: 1002 if args.text_file:
1003 printer.PrettyFile(args.text_file, 1003 printer.PrettyFile(args.text_file,
1004 snapshots, 1004 snapshots,
1005 args.diff_against_start, 1005 args.diff_against_start,
1006 args.show_mem, 1006 args.show_mem,
1007 args.show_net) 1007 args.show_net)
1008 1008
1009 if __name__ == '__main__': 1009 if __name__ == '__main__':
1010 sys.exit(main(sys.argv)) 1010 sys.exit(main(sys.argv))
1011 1011
OLDNEW
« no previous file with comments | « third_party/android_testrunner/run_command.py ('k') | tools/checkperms/checkperms.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698