1 #!/usr/bin/env python 2 # SPDX-License-Identifier: Apache-2.0 3 # 4 # Copyright (C) 2017, ARM Limited, Google, and contributors. 5 # 6 # Licensed under the Apache License, Version 2.0 (the "License"); you may 7 # not use this file except in compliance with the License. 8 # You may obtain a copy of the License at 9 # 10 # http://www.apache.org/licenses/LICENSE-2.0 11 # 12 # Unless required by applicable law or agreed to in writing, software 13 # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 14 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 # See the License for the specific language governing permissions and 16 # limitations under the License. 17 # 18 19 import logging 20 21 from conf import LisaLogging 22 LisaLogging.setup() 23 import json 24 import os 25 import devlib 26 from env import TestEnv 27 from android import Screen, Workload, System 28 from trace import Trace 29 import trappy 30 import pandas as pd 31 import sqlite3 32 import argparse 33 import shutil 34 35 parser = argparse.ArgumentParser(description='YouTube tests') 36 37 parser.add_argument('--out_prefix', dest='out_prefix', action='store', default='default', 38 help='prefix for out directory') 39 40 parser.add_argument('--collect', dest='collect', action='store', default='systrace', 41 help='what to collect (default systrace)') 42 43 parser.add_argument('--duration', dest='duration_s', action='store', 44 default=30, type=int, 45 help='Duration of test (default 30s)') 46 47 parser.add_argument('--serial', dest='serial', action='store', 48 help='Serial number of device to test') 49 50 args = parser.parse_args() 51 52 def experiment(): 53 # Get workload 54 wload = Workload.getInstance(te, 'YouTube') 55 56 outdir=te.res_dir + '_' + args.out_prefix 57 try: 58 shutil.rmtree(outdir) 59 except: 60 print "coulnd't remove " + outdir 61 pass 62 os.makedirs(outdir) 63 64 wload.run(outdir, video_url='https://www.youtube.com/watch?v=NLZRYQMLDW4', video_duration_s=args.duration_s, collect=args.collect) 65 66 # Dump platform descriptor 67 te.platform_dump(te.res_dir) 68 69 te._log.info('RESULTS are in out directory: {}'.format(outdir)) 70 71 # Setup target configuration 72 my_conf = { 73 74 # Target platform and board 75 "platform" : 'android', 76 77 # Useful for reading names of little/big cluster 78 # and energy model info, its device specific and use 79 # only if needed for analysis 80 # "board" : 'pixel', 81 82 # Device 83 # By default the device connected is detected, but if more than 1 84 # device, override the following to get a specific device. 85 # "device" : "HT6880200489", 86 87 # Folder where all the results will be collected 88 "results_dir" : "YouTube", 89 90 # Define devlib modules to load 91 "modules" : [ 92 'cpufreq', # enable CPUFreq support 93 'cpuidle', # enable cpuidle support 94 'cgroups' # Enable for cgroup support 95 ], 96 97 "emeter" : { 98 'instrument': 'monsoon', 99 'conf': { } 100 }, 101 102 # Tools required by the experiments 103 "tools" : [ 'taskset'], 104 105 "skip_nrg_model" : True, 106 } 107 108 if args.serial: 109 my_conf["device"] = args.serial 110 111 # Initialize a test environment using: 112 te = TestEnv(my_conf, wipe=False) 113 target = te.target 114 115 results = experiment() 116