1 #!/usr/bin/env python 2 3 import logging 4 5 from conf import LisaLogging 6 LisaLogging.setup() 7 import json 8 import os 9 import devlib 10 from env import TestEnv 11 from android import Screen, Workload, System 12 from trace import Trace 13 import trappy 14 import pandas as pd 15 import sqlite3 16 import argparse 17 import shutil 18 19 parser = argparse.ArgumentParser(description='YouTube tests') 20 21 parser.add_argument('--out_prefix', dest='out_prefix', action='store', default='default', 22 help='prefix for out directory') 23 24 parser.add_argument('--collect', dest='collect', action='store', default='systrace', 25 help='what to collect (default systrace)') 26 27 parser.add_argument('--duration', dest='duration_s', action='store', 28 default=30, type=int, 29 help='Duration of test (default 30s)') 30 31 parser.add_argument('--serial', dest='serial', action='store', 32 help='Serial number of device to test') 33 34 args = parser.parse_args() 35 36 def experiment(): 37 # Get workload 38 wload = Workload.getInstance(te, 'YouTube') 39 40 outdir=te.res_dir + '_' + args.out_prefix 41 try: 42 shutil.rmtree(outdir) 43 except: 44 print "coulnd't remove " + outdir 45 pass 46 os.makedirs(outdir) 47 48 wload.run(outdir, video_url='https://www.youtube.com/watch?v=NLZRYQMLDW4', video_duration_s=args.duration_s, collect=args.collect) 49 50 # Dump platform descriptor 51 te.platform_dump(te.res_dir) 52 53 te._log.info('RESULTS are in out directory: {}'.format(outdir)) 54 55 # Setup target configuration 56 my_conf = { 57 58 # Target platform and board 59 "platform" : 'android', 60 61 # Useful for reading names of little/big cluster 62 # and energy model info, its device specific and use 63 # only if needed for analysis 64 # "board" : 'pixel', 65 66 # Device 67 # By default the device connected is detected, but if more than 1 68 # device, override the following to get a specific device. 69 # "device" : "HT6880200489", 70 71 # Folder where all the results will be collected 72 "results_dir" : "YouTube", 73 74 # Define devlib modules to load 75 "modules" : [ 76 'cpufreq', # enable CPUFreq support 77 'cpuidle', # enable cpuidle support 78 # 'cgroups' # Enable for cgroup support 79 ], 80 81 "emeter" : { 82 'instrument': 'monsoon', 83 'conf': { } 84 }, 85 86 # Tools required by the experiments 87 "tools" : [ 'taskset'], 88 } 89 90 if args.serial: 91 my_conf["device"] = args.serial 92 93 # Initialize a test environment using: 94 te = TestEnv(my_conf, wipe=False) 95 target = te.target 96 97 results = experiment() 98