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

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

Issue 1290173003: [Android] Reland of Remove android_commands and android_testrunner. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixed: removed references from content/telemetry.isolate and TELEMETRY_DEPS 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
23 from pylib.device import device_errors 22 from pylib.device import device_errors
24 from pylib.device import device_utils 23 from pylib.device import device_utils
25 24
26 class Utils(object): 25 class Utils(object):
27 """A helper class to hold various utility methods.""" 26 """A helper class to hold various utility methods."""
28 27
29 @staticmethod 28 @staticmethod
30 def FindLines(haystack, needle): 29 def FindLines(haystack, needle):
31 """A helper method to find lines in |haystack| that contain the string 30 """A helper method to find lines in |haystack| that contain the string
32 |needle|.""" 31 |needle|."""
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 @staticmethod 98 @staticmethod
100 def GetDeviceModel(adb): 99 def GetDeviceModel(adb):
101 """Returns the model of the device with the |adb| connection.""" 100 """Returns the model of the device with the |adb| connection."""
102 return adb.GetProp('ro.product.model').strip() 101 return adb.GetProp('ro.product.model').strip()
103 102
104 @staticmethod 103 @staticmethod
105 def GetDeviceToTrack(preset=None): 104 def GetDeviceToTrack(preset=None):
106 """Returns a device serial to connect to. If |preset| is specified it will 105 """Returns a device serial to connect to. If |preset| is specified it will
107 return |preset| if it is connected and |None| otherwise. If |preset| is not 106 return |preset| if it is connected and |None| otherwise. If |preset| is not
108 specified it will return the first connected device.""" 107 specified it will return the first connected device."""
109 devices = android_commands.GetAttachedDevices() 108 devices = [d.adb.GetDeviceSerial()
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