Home | History | Annotate | Download | only in experiments
      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='UiBench 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('--test', dest='test_name', action='store',
     28                     default='UiBenchJankTests#testGLTextureView',
     29                     help='which test to run')
     30 
     31 parser.add_argument('--duration', dest='duration_s', action='store',
     32                     default=30, type=int,
     33                     help='Duration of test (default 30s)')
     34 
     35 parser.add_argument('--serial', dest='serial', action='store',
     36                     help='Serial number of device to test')
     37 
     38 args = parser.parse_args()
     39 
     40 def experiment():
     41     # Get workload
     42     wload = Workload.getInstance(te, 'UiBench')
     43 
     44     outdir=te.res_dir + '_' + args.out_prefix
     45     try:
     46         shutil.rmtree(outdir)
     47     except:
     48         print "coulnd't remove " + outdir
     49         pass
     50     os.makedirs(outdir)
     51 
     52     # Run UiBench
     53     wload.run(outdir, test_name=args.test_name, duration_s=args.duration_s, collect=args.collect)
     54 
     55     # Dump platform descriptor
     56     te.platform_dump(te.res_dir)
     57 
     58     te._log.info('RESULTS are in out directory: {}'.format(outdir))
     59 
     60 # Setup target configuration
     61 my_conf = {
     62 
     63     # Target platform and board
     64     "platform"     : 'android',
     65 
     66     # Useful for reading names of little/big cluster
     67     # and energy model info, its device specific and use
     68     # only if needed for analysis
     69     # "board"        : 'pixel',
     70 
     71     # Device
     72     # By default the device connected is detected, but if more than 1
     73     # device, override the following to get a specific device.
     74     # "device"       : "HT6880200489",
     75 
     76     # Folder where all the results will be collected
     77     "results_dir" : "UiBench",
     78 
     79     # Define devlib modules to load
     80     "modules"     : [
     81         'cpufreq',      # enable CPUFreq support
     82         'cpuidle',      # enable cpuidle support
     83         # 'cgroups'     # Enable for cgroup support
     84     ],
     85 
     86     "emeter" : {
     87         'instrument': 'monsoon',
     88         'conf': { }
     89     },
     90 
     91     # Tools required by the experiments
     92     "tools"   : [ 'taskset'],
     93 }
     94 
     95 if args.serial:
     96     my_conf["device"] = args.serial
     97 
     98 # Initialize a test environment using:
     99 te = TestEnv(my_conf, wipe=False)
    100 target = te.target
    101 
    102 results = experiment()
    103