diff options
author | Joel Fernandes <joelaf@google.com> | 2017-06-27 13:49:37 -0700 |
---|---|---|
committer | Joel Fernandes <joelaf@google.com> | 2017-06-27 17:11:53 -0700 |
commit | 785a5f01aa56b38c7e679c824c049d8739b5f4b4 (patch) | |
tree | dd6699ef9a5330d47f36a10cd80aaf2d6dff53e8 /experiments/run_uibench_cgroup.py | |
parent | a1833cbacbb9b72ed2fdb4144031d319d1437972 (diff) | |
download | lisa-785a5f01aa56b38c7e679c824c049d8739b5f4b4.tar.gz |
experiments: Add experiment for UiBench cgroup tracing
This adds an experiment that attempts to dump cgroup events
when running UiBench.
Its an example for the following features:
- enable external ftrace events when collecting a systrace
- run post-collect hooks when collecting a systrace
Change-Id: I524f9083c2c7713cf645aceea27c872523918eaa
Signed-off-by: Joel Fernandes <joelaf@google.com>
Diffstat (limited to 'experiments/run_uibench_cgroup.py')
-rwxr-xr-x | experiments/run_uibench_cgroup.py | 116 |
1 files changed, 116 insertions, 0 deletions
diff --git a/experiments/run_uibench_cgroup.py b/experiments/run_uibench_cgroup.py new file mode 100755 index 0000000..9f8de92 --- /dev/null +++ b/experiments/run_uibench_cgroup.py @@ -0,0 +1,116 @@ +#!/usr/bin/env python +# This experiment enables CGroup tracing for UiBench workloads +# The main difference between the run_uibench.py experiment is: +# - post_collect_start hook used to dump fake cgroup events +# - extra event: 'cgroup_attach_task' passed to systrace_start + +import logging + +from conf import LisaLogging +LisaLogging.setup() +import json +import os +import devlib +from env import TestEnv +from android import Screen, Workload, System +from trace import Trace +import trappy +import pandas as pd +import sqlite3 +import argparse +import shutil + +parser = argparse.ArgumentParser(description='UiBench tests') + +parser.add_argument('--out_prefix', dest='out_prefix', action='store', default='default', + help='prefix for out directory') + +parser.add_argument('--collect', dest='collect', action='store', default='systrace', + help='what to collect (default systrace)') + +parser.add_argument('--test', dest='test_name', action='store', + default='UiBenchJankTests#testGLTextureView', + help='which test to run') + +parser.add_argument('--duration', dest='duration_s', action='store', + default=30, type=int, + help='Duration of test (default 30s)') + +parser.add_argument('--serial', dest='serial', action='store', + help='Serial number of device to test') + +args = parser.parse_args() + +def post_collect_start(): + cgroup = te.target.cgroups.controllers['cpuset'].cgroup('/foreground') + cgroup.trace_cgroup_tasks() + +def experiment(): + # Get workload + wload = Workload.getInstance(te, 'UiBench') + + outdir=te.res_dir + '_' + args.out_prefix + try: + shutil.rmtree(outdir) + except: + print "coulnd't remove " + outdir + pass + os.makedirs(outdir) + + wload.add_hook('post_collect_start', post_collect_start) + + # Run UiBench + wload.run(outdir, test_name=args.test_name, duration_s=args.duration_s, collect=args.collect) + + # Dump platform descriptor + te.platform_dump(te.res_dir) + + te._log.info('RESULTS are in out directory: {}'.format(outdir)) + +# Setup target configuration +my_conf = { + + # Target platform and board + "platform" : 'android', + + # Useful for reading names of little/big cluster + # and energy model info, its device specific and use + # only if needed for analysis + # "board" : 'pixel', + + # Device + # By default the device connected is detected, but if more than 1 + # device, override the following to get a specific device. + # "device" : "HT6880200489", + + # Folder where all the results will be collected + "results_dir" : "UiBench", + + # Define devlib modules to load + "modules" : [ + 'cpufreq', # enable CPUFreq support + 'cpuidle', # enable cpuidle support + 'cgroups' # Enable for cgroup support + ], + + "emeter" : { + 'instrument': 'monsoon', + 'conf': { } + }, + + "systrace": { + 'extra_events': ['cgroup_attach_task'] + }, + + # Tools required by the experiments + "tools" : [ 'taskset'], +} + +if args.serial: + my_conf["device"] = args.serial + +# Initialize a test environment using: +te = TestEnv(my_conf, wipe=False) +target = te.target + +results = experiment() |