From 3966ebb74d7aec08169b99d3cecf23ea3815435f Mon Sep 17 00:00:00 2001 From: Yusuke Sato Date: Mon, 17 Aug 2015 17:26:10 -0700 Subject: [PATCH] perfboot.py: Add --end-tag option The current behavior, which is to use tags[-1] for end_tag, is good enough in most cases, but sometime it makes more sense to use a different one as end_tag. For example, when optimizing APK scanning code in package manager, using 'boot_progress_pms_scan_end' as end_tag would give us quicker benchmark iterations as well as more relevant numbers possibly with a smaller standard deviation. Change-Id: Ic6371c936b36d1d87e9742502fd8958682a3b7d5 --- init/perfboot.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/init/perfboot.py b/init/perfboot.py index b0efb1183..2a17ab6f2 100755 --- a/init/perfboot.py +++ b/init/perfboot.py @@ -408,7 +408,10 @@ def parse_args(): parser.add_argument('-t', '--tags', help='Specify the filename from which ' 'event tags are read. Every line contains one event ' 'tag and the last event tag is used to detect that ' - 'the device has finished booting.') + 'the device has finished booting unless --end-tag is ' + 'specified.') + parser.add_argument('--end-tag', help='An event tag on which the script ' + 'stops measuring the boot time.') parser.add_argument('--apk-dir', help='Specify the directory which contains ' 'APK files to be installed before measuring boot time.') return parser.parse_args() @@ -439,10 +442,14 @@ def main(): record_list = [] event_tags = filter_event_tags(read_event_tags(args.tags), device) + end_tag = args.end_tag or event_tags[-1] + if end_tag not in event_tags: + sys.exit('%s is not a valid tag.' % end_tag) + event_tags = event_tags[0 : event_tags.index(end_tag) + 1] init_perf(device, args.output, record_list, event_tags) interval_adjuster = IntervalAdjuster(args.interval, device) event_tags_re = make_event_tags_re(event_tags) - end_tag = event_tags[-1] + for i in range(args.iterations): print 'Run #%d ' % i record = do_iteration(