* commit 'b84e1f540379c6af9ccfc22e779b67f67b8c210a': Enable perfboot.py to install APKs before measurement.
This commit is contained in:
commit
a25e258d65
2 changed files with 18 additions and 2 deletions
|
|
@ -170,8 +170,12 @@ class AndroidDevice(object):
|
||||||
out, _ = p.communicate()
|
out, _ = p.communicate()
|
||||||
return self._parse_shell_output(out)
|
return self._parse_shell_output(out)
|
||||||
|
|
||||||
def install(self, filename):
|
def install(self, filename, replace=False):
|
||||||
return self._simple_call(['install', filename])
|
cmd = ['install']
|
||||||
|
if replace:
|
||||||
|
cmd.append('-r')
|
||||||
|
cmd.append(filename)
|
||||||
|
return self._simple_call(cmd)
|
||||||
|
|
||||||
def push(self, local, remote):
|
def push(self, local, remote):
|
||||||
return self._simple_call(['push', local, remote])
|
return self._simple_call(['push', local, remote])
|
||||||
|
|
|
||||||
|
|
@ -40,6 +40,7 @@ $ ./perfboot.py --iterations=30 -v --output=data.tsv --tags=eventtags.txt
|
||||||
import argparse
|
import argparse
|
||||||
import atexit
|
import atexit
|
||||||
import cStringIO
|
import cStringIO
|
||||||
|
import glob
|
||||||
import inspect
|
import inspect
|
||||||
import logging
|
import logging
|
||||||
import math
|
import math
|
||||||
|
|
@ -408,9 +409,17 @@ def parse_args():
|
||||||
'event tags are read. Every line contains one event '
|
'event tags are read. Every line contains one event '
|
||||||
'tag and the last event tag is used to detect that '
|
'tag and the last event tag is used to detect that '
|
||||||
'the device has finished booting.')
|
'the device has finished booting.')
|
||||||
|
parser.add_argument('--apk-dir', help='Specify the directory which contains '
|
||||||
|
'APK files to be installed before measuring boot time.')
|
||||||
return parser.parse_args()
|
return parser.parse_args()
|
||||||
|
|
||||||
|
|
||||||
|
def install_apks(device, apk_dir):
|
||||||
|
for apk in glob.glob(os.path.join(apk_dir, '*.apk')):
|
||||||
|
print 'Installing: ' + apk
|
||||||
|
device.install(apk, replace=True)
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
args = parse_args()
|
args = parse_args()
|
||||||
if args.verbose:
|
if args.verbose:
|
||||||
|
|
@ -425,6 +434,9 @@ def main():
|
||||||
device.get_prop('ro.build.version.incremental'))
|
device.get_prop('ro.build.version.incremental'))
|
||||||
check_dm_verity_settings(device)
|
check_dm_verity_settings(device)
|
||||||
|
|
||||||
|
if args.apk_dir:
|
||||||
|
install_apks(device, args.apk_dir)
|
||||||
|
|
||||||
record_list = []
|
record_list = []
|
||||||
event_tags = filter_event_tags(read_event_tags(args.tags), device)
|
event_tags = filter_event_tags(read_event_tags(args.tags), device)
|
||||||
init_perf(device, args.output, record_list, event_tags)
|
init_perf(device, args.output, record_list, event_tags)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue