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