Skip to content

Instantly share code, notes, and snippets.

@derkling
Created June 19, 2019 10:44
Show Gist options
  • Select an option

  • Save derkling/abe62b34de0e2231ca7a71919444e7c6 to your computer and use it in GitHub Desktop.

Select an option

Save derkling/abe62b34de0e2231ca7a71919444e7c6 to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "markdown",
"metadata": {
"toc-hr-collapsed": true
},
"source": [
"# PowerHAL Parameters Exploration<br>\n",
"Find out the optimal PowerHAL parameters"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"2019-05-08 17:41:59,041 INFO : root : Using LISA logging configuration:\n",
"2019-05-08 17:41:59,064 INFO : root : /data/Code/lisa/logging.conf\n"
]
}
],
"source": [
"import logging\n",
"from lisa.utils import setup_logging\n",
"setup_logging(level=logging.DEBUG)"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"import pandas as pd\n",
"#%config IPCompleter.use_jedi = False"
]
},
{
"cell_type": "markdown",
"metadata": {
"toc-hr-collapsed": true
},
"source": [
"# Target Connection"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"2019-05-08 17:42:01,627 INFO : root : Generating grammar tables from /usr/lib/python3.5/lib2to3/Grammar.txt\n",
"2019-05-08 17:42:01,667 INFO : root : Generating grammar tables from /usr/lib/python3.5/lib2to3/PatternGrammar.txt\n",
"2019-05-08 17:42:02,849 INFO : lisa.target.Target : Creating result directory: /data/Code/lisa/results/Target-hikey960-20190508_174202.848897\n",
"2019-05-08 17:42:02,873 INFO : lisa.target.Target : android hikey960 target connection settings:\n",
"2019-05-08 17:42:02,874 INFO : lisa.target.Target : device : DERKLING001\n",
"2019-05-08 17:42:02,917 INFO : lisa.target.Target : Devlib modules to load: bl, cgroups, cpufreq, cpuidle, devfreq, fastboot, gem5stats, gpufreq, hotplug, hwmon, mbed-fan, odroidxu3-fan, sched, thermal\n",
"2019-05-08 17:42:07,228 WARNING : AndroidTarget : Module gem5stats is not supported by the target\n",
"2019-05-08 17:42:07,266 WARNING : AndroidTarget : Module gpufreq is not supported by the target\n",
"2019-05-08 17:42:07,471 WARNING : AndroidTarget : Module odroidxu3-fan is not supported by the target\n",
"2019-05-08 17:42:08,007 INFO : CGroups : Available controllers:\n",
"2019-05-08 17:42:08,119 INFO : CGroups : cpuset : /storage/emulated/0/devlib-target/cgroups/devlib_cgh3\n",
"2019-05-08 17:42:08,237 INFO : CGroups : cpu : /storage/emulated/0/devlib-target/cgroups/devlib_cgh1\n",
"2019-05-08 17:42:08,355 INFO : CGroups : cpuacct : /storage/emulated/0/devlib-target/cgroups/devlib_cgh2\n",
"2019-05-08 17:42:08,464 INFO : CGroups : blkio : /storage/emulated/0/devlib-target/cgroups/devlib_cgh5\n",
"2019-05-08 17:42:08,579 INFO : CGroups : memory : /storage/emulated/0/devlib-target/cgroups/devlib_cgh4\n",
"2019-05-08 17:42:08,689 INFO : CGroups : devices : /storage/emulated/0/devlib-target/cgroups/devlib_cgh5\n",
"2019-05-08 17:42:08,804 INFO : CGroups : freezer : /storage/emulated/0/devlib-target/cgroups/devlib_cgh5\n",
"2019-05-08 17:42:08,911 INFO : CGroups : hugetlb : /storage/emulated/0/devlib-target/cgroups/devlib_cgh5\n",
"2019-05-08 17:42:09,025 INFO : CGroups : debug : /storage/emulated/0/devlib-target/cgroups/devlib_cgh5\n",
"2019-05-08 17:42:09,077 WARNING : lisa.target.Target : Failed to initialized \"fastboot\" devlib Module\n",
"2019-05-08 17:42:09,079 WARNING : lisa.target.Target : Failed to initialized \"gem5stats\" devlib Module\n",
"2019-05-08 17:42:09,080 WARNING : lisa.target.Target : Failed to initialized \"gpufreq\" devlib Module\n",
"2019-05-08 17:42:09,081 WARNING : lisa.target.Target : Failed to initialized \"mbed-fan\" devlib Module\n",
"2019-05-08 17:42:09,082 WARNING : lisa.target.Target : Failed to initialized \"odroidxu3-fan\" devlib Module\n",
"2019-05-08 17:42:09,083 INFO : lisa.platforms.platinfo.PlatformInfo : Attempting to read energy model from target\n",
"2019-05-08 17:42:09,219 INFO : lisa.energy_model.EnergyModel.EMReader : Attempting to load EM using from_debugfsEM_target\n",
"2019-05-08 17:42:10,590 INFO : lisa.target.Target : Effective platform information:\n",
"|- abi from target (str): arm64\n",
"|- cpu-capacities from target (dict): {0: 462, 1: 462, 2: 462, 3: 462, 4: 1024, 5: 1024, 6: 1024, 7: 1024}\n",
"|- cpus-count from target (int): 8\n",
"|- freq-domains from target (list): [[0, 1, 2, 3], [4, 5, 6, 7]]\n",
"|- freqs from target (dict): {0: [533000, 999000, 1402000, 1709000, 1844000], 1: [533000, 999000, 1402000, 1709000, 1844000], 2: [533000, 999000, 1402000, 1709000, 1844000], 3: [533000, 999000, 1402000, 1709000, 1844000], 4: [903000, 1421000, 1805000, 2112000, 2362000], 5: [903000, 1421000, 1805000, 2112000, 2362000], 6: [903000, 1421000, 1805000, 2112000, 2362000], 7: [903000, 1421000, 1805000, 2112000, 2362000]}\n",
"+- kernel:\n",
" |- config from target (TypedKernelConfig): <kernel config>\n",
" |- version from target (KernelVersion): 4.19.23-00594-g417577330161 93 SMP PREEMPT Thu Apr 18 17:27:38 BST 2019\n",
"|- name from target-conf (str): hikey960\n",
"|- nrg-model from target (EnergyModel): <lisa.energy_model.EnergyModel object at 0x7fccf0805358>\n",
"|- os from target (str): android\n",
"+- rtapp:\n",
" |- calib from target (DeferredValue): <lazy value of RTA.get_cpu_calibrations>\n",
"|- capacity-classes from target(platform-info/cpu-capacities) (list): [[0, 1, 2, 3], [4, 5, 6, 7]]\n"
]
}
],
"source": [
"from lisa.target import Target, TargetConf\n",
"\n",
"target = Target(\n",
" name='hikey960',\n",
" kind='android',\n",
" device='DERKLING001'\n",
")"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"{'ATTACH_AGE_LOAD': True,\n",
" 'CACHE_HOT_BUDDY': True,\n",
" 'DOUBLE_TICK': False,\n",
" 'EAS_PREFER_IDLE': True,\n",
" 'FIND_BEST_TARGET': True,\n",
" 'GENTLE_FAIR_SLEEPERS': True,\n",
" 'HRTICK': False,\n",
" 'LAST_BUDDY': True,\n",
" 'LB_BIAS': True,\n",
" 'LB_MIN': False,\n",
" 'NEXT_BUDDY': False,\n",
" 'NONTASK_CAPACITY': False,\n",
" 'RT_PUSH_IPI': True,\n",
" 'RT_RUNTIME_SHARE': True,\n",
" 'SCHEDTUNE_BOOST_HOLD_ALL': False,\n",
" 'SIS_AVG_CPU': False,\n",
" 'SIS_PROP': True,\n",
" 'START_DEBIT': True,\n",
" 'SUGOV_RT_MAX_FREQ': False,\n",
" 'TTWU_QUEUE': True,\n",
" 'UTIL_EST': True,\n",
" 'WAKEUP_PREEMPTION': True,\n",
" 'WARN_DOUBLE_CLOCK': False,\n",
" 'WA_BIAS': True,\n",
" 'WA_IDLE': True,\n",
" 'WA_WEIGHT': True}"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"target.sched.get_features()"
]
},
{
"cell_type": "markdown",
"metadata": {
"toc-hr-collapsed": true
},
"source": [
"# PowerHints Exploration"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
"import os\n",
"import json\n",
"import tempfile\n",
"import pandas as pd\n",
"from collections import namedtuple"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [],
"source": [
"HintAction = namedtuple('HintAction', ['hint', 'node', 'value', 'duration'])\n",
"\n",
"class PowerHints:\n",
" \n",
" def __init__(self, target, hints_json='/vendor/etc/powerhint.json'):\n",
" self._target = target\n",
" self.hints_json = hints_json\n",
" _, self.local_json = new_file, filename = tempfile.mkstemp()\n",
" self.mpoint = os.path.join(os.path.sep,\n",
" self.hints_json.split(os.path.sep)[1])\n",
" # Pull hints file from target\n",
" self._target.pull(hints_json, self.local_json)\n",
" with open(self.local_json ) as fh:\n",
" self.phints = json.load(fh)\n",
" # Create indexes to speed up actions changes and reporting\n",
" self._nodes = {n['Name']: n for n in self.phints['Nodes']}\n",
" self._node_actions = {\"{hint}_{node}\".format(\n",
" hint=a['PowerHint'], node=a['Node']): a for a in self.phints['Actions']}\n",
" \n",
" def __del__(self):\n",
" os.remove(self.local_json)\n",
"\n",
" def _remount_rw(self, mpoint='/vendor'):\n",
" for fs in self._target.list_file_systems():\n",
" if fs.mount_point != mpoint:\n",
" continue\n",
" break\n",
" if 'rw,' in fs.options:\n",
" return\n",
" self._target.execute('mount {mpoint} -o remount,rw'.format(mpoint=mpoint))\n",
" \n",
" @property\n",
" def power_hal_service(self, name='android.hardware.power'):\n",
" for task in self._target.ps():\n",
" if name in task.name:\n",
" return task\n",
" return None\n",
" \n",
" def restart_powerhal(self, name='android.hardware.power'):\n",
" task = self.power_hal_service\n",
" if task:\n",
" logging.info('Killing: {task}'.format(task=task))\n",
" self._target.kill(task.pid)\n",
" \n",
" def backup_powerhal(self, dstdir):\n",
" logging.info(\"Pulling [%s] => [%s]\", self.hints_json, dstdir)\n",
" self._target.pull(self.hints_json, dstdir)\n",
" \n",
" def update_json(self, deploy=False, restart=False):\n",
" with open(self.local_json, 'w') as fh:\n",
" json.dump(self.phints, fh, indent=4)\n",
" logging.info(\"Local JSON [{fn}] updated\".format(fn=self.local_json))\n",
" if not deploy:\n",
" return\n",
" self._remount_rw(mpoint=self.mpoint)\n",
" logging.info(\"Pushing [%s] => [%s]\", self.local_json, self.hints_json)\n",
" self._target.push(self.local_json, self.hints_json)\n",
" if not restart:\n",
" return\n",
" self.restart_powerhal()\n",
" \n",
" @property\n",
" def hints(self):\n",
" return list(set([a['PowerHint'] for a in self.phints['Actions']]))\n",
" \n",
" @property\n",
" def nodes(self):\n",
" return [n['Name'] for n in self.phints['Nodes']]\n",
" \n",
" def node_values(self, node):\n",
" return self._nodes[node]['Values']\n",
" \n",
" def actions(self, hint):\n",
" data = [\n",
" (self._node_actions[na]['Node'],\n",
" self._node_actions[na]['Value'],\n",
" self._node_actions[na]['Duration'])\n",
" for na in self._node_actions if hint in na\n",
" ]\n",
" return pd.DataFrame(data, columns=['Node', 'Value', 'Duration']).set_index('Node')\n",
" \n",
" \n",
" def get_hints_df(self):\n",
" c = {}\n",
" for k in self.nodes:\n",
" for a in self.phints['Actions']:\n",
" node = a['Node']\n",
" if k != node:\n",
" continue\n",
" if k not in c:\n",
" c[k] = {}\n",
" hint = a['PowerHint']\n",
" value = a['Value']\n",
" duration = a['Duration']\n",
" c[k][hint] = {'value': value, 'duration': duration}\n",
" return pd.DataFrame.from_dict(c).T\n",
" \n",
" def set_action(self, action):\n",
" if action.hint not in self.hints:\n",
" raise ValueError('hint [{hint}] not supported'.format(hint=action.hint))\n",
" if action.node not in self.nodes:\n",
" raise ValueError('node [{node}] not supported'.format(node=action.node))\n",
" \n",
" # Search for a pre-existing action and update it if present\n",
" for a in self.phints['Actions']:\n",
" if a['Node'] != action.node or a['PowerHint'] != action.hint:\n",
" continue\n",
" a['Value'] = action.value\n",
" a['Duration'] = action.duration\n",
" break\n",
" # Add the new required action\n",
" else:\n",
" self.phints['Actions'].append({\n",
" 'PowerHint': action.hint, 'Node': action.node,\n",
" 'Duration': action.duration, 'Value': action.value})"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Test PowerHints API"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"ph = PowerHints(target)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"ph.power_hal_service"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"ph.restart_powerhal()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"ph.power_hal_service"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"ph.node_values('CPUBigClusterMaxFreq')"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"for hint in ph.hints:\n",
" logging.info(\"Actions for {hint}:\".format(hint=hint))\n",
" display(ph.actions(hint))"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"ph.get_hints_df()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"ph.set_action(HintAction('INTERACTION', 'UCLamp_TA_Boost', ph.node_values('UCLamp_TA_Boost')[2], 5000))\n",
"ph.set_action(HintAction('INTERACTION', 'DDRMinFreq', ph.node_values('DDRMinFreq')[3], 5000))"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"ph.update_json(deploy=True, restart=True)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"b_freq = 903000 #1805000\n",
"l_freq = 533000 #1709000\n",
"g_freq = 1037000000\n",
"d_freq = 1866000000\n",
"t_umin = 0\n",
"b_time = 1\n",
"\n",
"tc = TestConf(1, b_freq, l_freq, g_freq, d_freq, t_umin)\n",
"print(tc)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"powerhal_setup(tc)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"ph = PowerHints(target)\n",
"ph.backup_powerhal('/tmp/')"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"with open('/tmp/powerhint.json', 'r') as fh:\n",
" phints = json.load(fh)\n",
"for a in phints['Actions']:\n",
" if not a['PowerHint'].startswith('INTERACTION'):\n",
" continue\n",
" if not a['Node'].startswith('CPULittleClusterMinFreq'):\n",
" continue\n",
" if int(a['Value']) != l_freq:\n",
" print(\"Requested[%d] != Configured[%d]\", l_freq, int(a['Value']))\n",
" break\n",
"else:\n",
" print(\"OK\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"!cat /tmp/powerhint.json"
]
},
{
"cell_type": "markdown",
"metadata": {
"toc-hr-collapsed": true
},
"source": [
"# WLTest API"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [],
"source": [
"from subprocess import run, PIPE, STDOUT\n",
"import shutil\n",
"import yaml\n",
"import os\n",
"import re\n",
"\n",
"def classify_agenda(tags, agenda='sched-evaluation-interactive.yaml'):\n",
" base = os.path.join(os.environ[\"LISA_HOME\"], 'tools/wltests/agendas')\n",
" path = \"{}/{}\".format(base, agenda)\n",
" with open(path, 'r') as fh:\n",
" try:\n",
" conf = yaml.safe_load(fh)\n",
" except yaml.YAMLError as exc:\n",
" print(exc)\n",
" for wl in conf['workloads']:\n",
" wl['classifiers'] = {**wl.get('classifiers', {}), **tags}\n",
" logging.info(\"Classifiers : %s\", wl['classifiers'])\n",
" path = os.path.join('/tmp', agenda)\n",
" with open(path, 'w') as fh:\n",
" yaml.safe_dump(conf, fh)\n",
" return path\n",
"\n",
"RESDIR_RE = re.compile(r\".*Results can be found in (?P<resdir>.*)$\")\n",
"\n",
"def wltest(agenda, resdir, kernel_dir='/data/Android/AOSP/kernel/hikey-linaro', git_remote='behemoth'):\n",
" os.environ['WLTEST_HOME'] = os.path.join(os.environ['LISA_HOME'], 'tools', 'wltests')\n",
" os.environ['WA_USER_DIRECTORY'] = os.path.join(os.environ['LISA_HOME'], 'tools', 'wa_user_directory')\n",
" os.environ['ANDROID_HOME'] = os.path.join(os.environ['LISA_HOME'], 'tools', 'android-sdk-linux')\n",
" os.environ['AOSP_HOME'] = '/mnt/aosp_behemouth'\n",
" os.environ.unsetenv('TERM')\n",
" \n",
" # Pull latest behemoth changes\n",
"# logging.info(\"Updating kernel from Behemoth...\")\n",
"# command = run(['git', 'fetch', git_remote],\n",
"# cwd=kernel_dir,\n",
"# stdout=PIPE, stderr=STDOUT)\n",
"# command.stdout.decode('utf-8').splitlines()\n",
"\n",
" # Run wltests\n",
" logging.info(\"WLTest : %s\", {'agenda' : agenda})\n",
" lisa_wltest_series = os.path.join(os.environ['WLTEST_HOME'], 'test_series')\n",
" try:\n",
" command = run([\n",
" lisa_wltest_series,\n",
" '--series', 'tools/wltests/platforms/hikey960_android-4.4/series_test.sha1',\n",
" '--platform', 'hikey960_android-4.4',\n",
" '--kernel_src', kernel_dir,\n",
" '--device', 'DERKLING001',\n",
" '--acme_channels', '0',\n",
" '--emeter', 'ACME',\n",
" '--wa_agenda', agenda,\n",
" '--results', resdir,\n",
" '--force',\n",
" ],\n",
" cwd=os.environ['LISA_HOME'],\n",
" stdout=PIPE, stderr=STDOUT,\n",
" universal_newlines=True, check=True,\n",
" )\n",
" except:\n",
" for line in command.stdout.splitlines():\n",
" print(line)\n",
" return\n",
" \n",
" for line in command.stdout.splitlines():\n",
" line = line.strip()\n",
" #print('[{}]'.format(line))\n",
" match = RESDIR_RE.match(line)\n",
" if not match:\n",
" continue\n",
" # Strip colors at the end\n",
" resdir = match.group('resdir')[:-9]\n",
" logging.info(\"Results generated in: %s\", resdir)\n",
"\n",
" logging.info(line.split(':')[-1])\n",
"\n",
" return resdir\n",
"\n",
"def test_config(tag, resdir, agenda='sched-evaluation-interactive-tiny.yaml'):\n",
" agenda = classify_agenda({'tag': tag}, agenda)\n",
" resdir = wltest(agenda, resdir)\n",
" \n",
" # Move resultas into final folder\n",
" srcdir = os.path.join(os.environ['LISA_HOME'], resdir)\n",
" dstdir = \"{}_{}\".format(srcdir, tag)\n",
" logging.info(\"Moving results into: \")\n",
" logging.info(\" %s\", dstdir)\n",
" if os.path.exists(dstdir):\n",
" shutil.rmtree(dstdir)\n",
" os.rename(srcdir, dstdir)\n",
" \n",
" return dstdir"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Test WLTest API"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"test_config('testrun')"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"!ls -la $LISA_HOME/results/wltests_hikey960_uclamp_v8/"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"!rm -rf $LISA_HOME/results/wltests_hikey960_uclamp_v8/*testrun"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# PowerHAL Settings Exploration"
]
},
{
"cell_type": "code",
"execution_count": 17,
"metadata": {},
"outputs": [],
"source": [
"from collections import namedtuple\n",
"\n",
"# Test parameters\n",
"TestConf = namedtuple('TestConf', ['b_time', 'b_freq', 'l_freq', 'g_freq', 'd_freq', 't_umin'])\n",
"def test_conf_tag(self):\n",
" experiment = self\n",
" tag = \"b{}_l{}_g{}_d{}_u{:03d}_t{:02d}\".format(\n",
" int(experiment.b_freq)//1000, int(experiment.l_freq)//1000,\n",
" int(experiment.g_freq)//1000000, int(experiment.d_freq)//1000000,\n",
" int(experiment.t_umin), int(experiment.b_time))\n",
" return tag\n",
"TestConf.tag = test_conf_tag\n",
"\n",
"# Experiments generator\n",
"class Experiments:\n",
" def __init__(self):\n",
" ph = PowerHints(target)\n",
" # Generate all the expected values:\n",
" self._confs = []\n",
" for b_time in [0]:#range(1,11,3):\n",
" for b_freq in ph.node_values('CPUBigClusterMinFreq')[0]: #[-3:]:\n",
" for l_freq in ph.node_values('CPULittleClusterMinFreq')[0]: #[-2:]:\n",
" for g_freq in ph.node_values('GPUMinFreq'): #[-1:]:\n",
" for d_freq in ph.node_values('DDRMinFreq')[0]: #[-1:]:\n",
" for t_umin in ph.node_values('UCLamp_TA_Boost')[0]: #[0:-1:3]:\n",
" self._confs.append(TestConf(b_time, b_freq, l_freq, g_freq, d_freq, t_umin))\n",
" self._pos = 0\n",
" def __len__(self):\n",
" return len(self._confs)\n",
" def __iter__(self):\n",
" return self\n",
" def __next__(self):\n",
" if (self._pos >= len(self)):\n",
" raise StopIteration()\n",
" exp = self._confs[self._pos]\n",
" self._pos += 1\n",
" return exp"
]
},
{
"cell_type": "code",
"execution_count": 18,
"metadata": {},
"outputs": [],
"source": [
"def powerhal_setup(exp): \n",
" # Configure PowerHAL\n",
" ph = PowerHints(target)\n",
" ph.set_action(HintAction('INTERACTION', 'CPUBigClusterMinFreq', exp.b_freq, exp.b_time))\n",
" ph.set_action(HintAction('INTERACTION', 'CPULittleClusterMinFreq', exp.l_freq, exp.b_time))\n",
" ph.set_action(HintAction('INTERACTION', 'GPUMinFreq', exp.g_freq, exp.b_time))\n",
" ph.set_action(HintAction('INTERACTION', 'GPUMaxFreq', exp.g_freq, exp.b_time))\n",
" ph.set_action(HintAction('INTERACTION', 'DDRMinFreq', exp.d_freq, exp.b_time))\n",
" ph.set_action(HintAction('INTERACTION', 'DDRMaxFreq', exp.d_freq, exp.b_time))\n",
" ph.set_action(HintAction('INTERACTION', 'UCLamp_TA_Boost', exp.t_umin, exp.b_time))\n",
" ph.update_json(deploy=True, restart=True)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"2019-04-30 17:11:20,460 INFO : root : ********************************************************************************\n",
"2019-04-30 17:11:20,462 INFO : root : Test 001/1944 [b0_l0_g178_d0_u000_t00]\n",
"2019-04-30 17:11:20,548 INFO : root : Local JSON [/tmp/tmp2_tv_e_y] updated\n",
"2019-04-30 17:11:20,586 INFO : root : Pushing [/tmp/tmp2_tv_e_y] => [/vendor/etc/powerhint.json]\n",
"2019-04-30 17:11:20,711 INFO : root : Killing: PsEntry(user='root', pid=10061, ppid=1, vsize=25524, rss=5384, wchan='binder_ioctl', pc='0', state='S', name='android.hardware.power@1.3-service')\n",
"2019-04-30 17:11:20,751 INFO : root : Classifiers : {'tag': 'b0_l0_g178_d0_u000_t00'}\n",
"2019-04-30 17:11:20,757 INFO : root : WLTest : {'agenda': '/tmp/sched-evaluation-interactive-small.yaml'}\n",
"2019-04-30 17:20:56,088 INFO : root : Results generated in: results/wltests_hikey960_uclamp_v8_exploration_ExporeGPU/wa.4175773_test_uclamp_v8\n",
"2019-04-30 17:20:56,090 INFO : root : No Errors reported in WA logfiles\n",
"2019-04-30 17:20:56,091 INFO : root : Moving results into: \n",
"2019-04-30 17:20:56,092 INFO : root : /data/Code/lisa/results/wltests_hikey960_uclamp_v8_exploration_ExporeGPU/wa.4175773_test_uclamp_v8_b0_l0_g178_d0_u000_t00\n",
"2019-04-30 17:20:56,093 INFO : root : ********************************************************************************\n",
"2019-04-30 17:20:56,095 INFO : root : Test 002/1944 [b0_l0_g178_d0_u000_t00]\n",
"2019-04-30 17:20:56,193 INFO : root : Local JSON [/tmp/tmpt9q0fifo] updated\n",
"2019-04-30 17:20:56,232 INFO : root : Pushing [/tmp/tmpt9q0fifo] => [/vendor/etc/powerhint.json]\n",
"2019-04-30 17:20:56,352 INFO : root : Killing: PsEntry(user='root', pid=17000, ppid=1, vsize=25524, rss=5312, wchan='binder_ioctl', pc='0', state='S', name='android.hardware.power@1.3-service')\n",
"2019-04-30 17:20:56,388 INFO : root : Classifiers : {'tag': 'b0_l0_g178_d0_u000_t00'}\n",
"2019-04-30 17:20:56,393 INFO : root : WLTest : {'agenda': '/tmp/sched-evaluation-interactive-small.yaml'}\n",
"2019-04-30 17:30:28,830 INFO : root : Results generated in: results/wltests_hikey960_uclamp_v8_exploration_ExporeGPU/wa.4175773_test_uclamp_v8\n",
"2019-04-30 17:30:28,832 INFO : root : No Errors reported in WA logfiles\n",
"2019-04-30 17:30:28,833 INFO : root : Moving results into: \n",
"2019-04-30 17:30:28,834 INFO : root : /data/Code/lisa/results/wltests_hikey960_uclamp_v8_exploration_ExporeGPU/wa.4175773_test_uclamp_v8_b0_l0_g178_d0_u000_t00\n",
"2019-04-30 17:30:28,862 INFO : root : ********************************************************************************\n",
"2019-04-30 17:30:28,863 INFO : root : Test 003/1944 [b0_l0_g178_d0_u000_t00]\n",
"2019-04-30 17:30:28,965 INFO : root : Local JSON [/tmp/tmp1byivydk] updated\n",
"2019-04-30 17:30:29,005 INFO : root : Pushing [/tmp/tmp1byivydk] => [/vendor/etc/powerhint.json]\n",
"2019-04-30 17:30:29,136 INFO : root : Killing: PsEntry(user='root', pid=23994, ppid=1, vsize=25524, rss=5164, wchan='binder_ioctl', pc='0', state='S', name='android.hardware.power@1.3-service')\n",
"2019-04-30 17:30:29,176 INFO : root : Classifiers : {'tag': 'b0_l0_g178_d0_u000_t00'}\n",
"2019-04-30 17:30:29,183 INFO : root : WLTest : {'agenda': '/tmp/sched-evaluation-interactive-small.yaml'}\n",
"2019-04-30 17:40:05,510 INFO : root : Results generated in: results/wltests_hikey960_uclamp_v8_exploration_ExporeGPU/wa.4175773_test_uclamp_v8\n",
"2019-04-30 17:40:05,511 INFO : root : No Errors reported in WA logfiles\n",
"2019-04-30 17:40:05,513 INFO : root : Moving results into: \n",
"2019-04-30 17:40:05,514 INFO : root : /data/Code/lisa/results/wltests_hikey960_uclamp_v8_exploration_ExporeGPU/wa.4175773_test_uclamp_v8_b0_l0_g178_d0_u000_t00\n",
"2019-04-30 17:40:05,540 INFO : root : ********************************************************************************\n",
"2019-04-30 17:40:05,541 INFO : root : Test 004/1944 [b0_l0_g178_d0_u000_t00]\n",
"2019-04-30 17:40:05,594 INFO : root : Local JSON [/tmp/tmpdhekg0fe] updated\n",
"2019-04-30 17:40:05,631 INFO : root : Pushing [/tmp/tmpdhekg0fe] => [/vendor/etc/powerhint.json]\n",
"2019-04-30 17:40:05,757 INFO : root : Killing: PsEntry(user='root', pid=31013, ppid=1, vsize=25524, rss=5368, wchan='binder_ioctl', pc='0', state='S', name='android.hardware.power@1.3-service')\n",
"2019-04-30 17:40:05,798 INFO : root : Classifiers : {'tag': 'b0_l0_g178_d0_u000_t00'}\n",
"2019-04-30 17:40:05,802 INFO : root : WLTest : {'agenda': '/tmp/sched-evaluation-interactive-small.yaml'}\n",
"2019-04-30 17:49:36,926 INFO : root : Results generated in: results/wltests_hikey960_uclamp_v8_exploration_ExporeGPU/wa.4175773_test_uclamp_v8\n",
"2019-04-30 17:49:36,928 INFO : root : No Errors reported in WA logfiles\n",
"2019-04-30 17:49:36,929 INFO : root : Moving results into: \n",
"2019-04-30 17:49:36,930 INFO : root : /data/Code/lisa/results/wltests_hikey960_uclamp_v8_exploration_ExporeGPU/wa.4175773_test_uclamp_v8_b0_l0_g178_d0_u000_t00\n",
"2019-04-30 17:49:36,955 INFO : root : ********************************************************************************\n",
"2019-04-30 17:49:36,956 INFO : root : Test 005/1944 [b0_l0_g178_d0_u000_t00]\n",
"2019-04-30 17:49:37,070 INFO : root : Local JSON [/tmp/tmppp8fg9qp] updated\n",
"2019-04-30 17:49:37,109 INFO : root : Pushing [/tmp/tmppp8fg9qp] => [/vendor/etc/powerhint.json]\n",
"2019-04-30 17:49:37,255 INFO : root : Killing: PsEntry(user='root', pid=5984, ppid=1, vsize=25524, rss=5320, wchan='binder_ioctl', pc='0', state='S', name='android.hardware.power@1.3-service')\n",
"2019-04-30 17:49:37,310 INFO : root : Classifiers : {'tag': 'b0_l0_g178_d0_u000_t00'}\n",
"2019-04-30 17:49:37,315 INFO : root : WLTest : {'agenda': '/tmp/sched-evaluation-interactive-small.yaml'}\n",
"2019-04-30 17:59:14,408 INFO : root : Results generated in: results/wltests_hikey960_uclamp_v8_exploration_ExporeGPU/wa.4175773_test_uclamp_v8\n",
"2019-04-30 17:59:14,410 INFO : root : No Errors reported in WA logfiles\n",
"2019-04-30 17:59:14,412 INFO : root : Moving results into: \n",
"2019-04-30 17:59:14,413 INFO : root : /data/Code/lisa/results/wltests_hikey960_uclamp_v8_exploration_ExporeGPU/wa.4175773_test_uclamp_v8_b0_l0_g178_d0_u000_t00\n",
"2019-04-30 17:59:14,440 INFO : root : ********************************************************************************\n",
"2019-04-30 17:59:14,441 INFO : root : Test 006/1944 [b0_l0_g178_d0_u000_t00]\n",
"2019-04-30 17:59:14,545 INFO : root : Local JSON [/tmp/tmpy8dpgtyy] updated\n",
"2019-04-30 17:59:14,589 INFO : root : Pushing [/tmp/tmpy8dpgtyy] => [/vendor/etc/powerhint.json]\n",
"2019-04-30 17:59:14,748 INFO : root : Killing: PsEntry(user='root', pid=12991, ppid=1, vsize=25524, rss=5184, wchan='binder_ioctl', pc='0', state='S', name='android.hardware.power@1.3-service')\n",
"2019-04-30 17:59:14,788 INFO : root : Classifiers : {'tag': 'b0_l0_g178_d0_u000_t00'}\n",
"2019-04-30 17:59:14,795 INFO : root : WLTest : {'agenda': '/tmp/sched-evaluation-interactive-small.yaml'}\n",
"2019-04-30 18:08:51,324 INFO : root : Results generated in: results/wltests_hikey960_uclamp_v8_exploration_ExporeGPU/wa.4175773_test_uclamp_v8\n",
"2019-04-30 18:08:51,326 INFO : root : No Errors reported in WA logfiles\n",
"2019-04-30 18:08:51,327 INFO : root : Moving results into: \n",
"2019-04-30 18:08:51,328 INFO : root : /data/Code/lisa/results/wltests_hikey960_uclamp_v8_exploration_ExporeGPU/wa.4175773_test_uclamp_v8_b0_l0_g178_d0_u000_t00\n",
"2019-04-30 18:08:51,354 INFO : root : ********************************************************************************\n",
"2019-04-30 18:08:51,355 INFO : root : Test 007/1944 [b0_l0_g178_d0_u000_t00]\n",
"2019-04-30 18:08:51,458 INFO : root : Local JSON [/tmp/tmpdgf6odgx] updated\n",
"2019-04-30 18:08:51,500 INFO : root : Pushing [/tmp/tmpdgf6odgx] => [/vendor/etc/powerhint.json]\n",
"2019-04-30 18:08:51,621 INFO : root : Killing: PsEntry(user='root', pid=20004, ppid=1, vsize=25524, rss=5144, wchan='binder_ioctl', pc='0', state='S', name='android.hardware.power@1.3-service')\n",
"2019-04-30 18:08:51,663 INFO : root : Classifiers : {'tag': 'b0_l0_g178_d0_u000_t00'}\n",
"2019-04-30 18:08:51,668 INFO : root : WLTest : {'agenda': '/tmp/sched-evaluation-interactive-small.yaml'}\n",
"2019-04-30 18:18:27,653 INFO : root : Results generated in: results/wltests_hikey960_uclamp_v8_exploration_ExporeGPU/wa.4175773_test_uclamp_v8\n",
"2019-04-30 18:18:27,655 INFO : root : No Errors reported in WA logfiles\n",
"2019-04-30 18:18:27,656 INFO : root : Moving results into: \n",
"2019-04-30 18:18:27,657 INFO : root : /data/Code/lisa/results/wltests_hikey960_uclamp_v8_exploration_ExporeGPU/wa.4175773_test_uclamp_v8_b0_l0_g178_d0_u000_t00\n",
"2019-04-30 18:18:27,682 INFO : root : ********************************************************************************\n",
"2019-04-30 18:18:27,682 INFO : root : Test 008/1944 [b0_l0_g178_d0_u000_t00]\n",
"2019-04-30 18:18:27,774 INFO : root : Local JSON [/tmp/tmpszarm6ua] updated\n",
"2019-04-30 18:18:27,817 INFO : root : Pushing [/tmp/tmpszarm6ua] => [/vendor/etc/powerhint.json]\n",
"2019-04-30 18:18:27,928 INFO : root : Killing: PsEntry(user='root', pid=26998, ppid=1, vsize=25524, rss=5244, wchan='binder_ioctl', pc='0', state='S', name='android.hardware.power@1.3-service')\n",
"2019-04-30 18:18:27,965 INFO : root : Classifiers : {'tag': 'b0_l0_g178_d0_u000_t00'}\n",
"2019-04-30 18:18:27,971 INFO : root : WLTest : {'agenda': '/tmp/sched-evaluation-interactive-small.yaml'}\n",
"2019-04-30 18:28:05,446 INFO : root : Results generated in: results/wltests_hikey960_uclamp_v8_exploration_ExporeGPU/wa.4175773_test_uclamp_v8\n",
"2019-04-30 18:28:05,448 INFO : root : No Errors reported in WA logfiles\n",
"2019-04-30 18:28:05,449 INFO : root : Moving results into: \n",
"2019-04-30 18:28:05,451 INFO : root : /data/Code/lisa/results/wltests_hikey960_uclamp_v8_exploration_ExporeGPU/wa.4175773_test_uclamp_v8_b0_l0_g178_d0_u000_t00\n",
"2019-04-30 18:28:05,480 INFO : root : ********************************************************************************\n",
"2019-04-30 18:28:05,481 INFO : root : Test 009/1944 [b0_l0_g178_d0_u000_t00]\n",
"2019-04-30 18:28:05,543 INFO : root : Local JSON [/tmp/tmpxctsu01n] updated\n",
"2019-04-30 18:28:05,586 INFO : root : Pushing [/tmp/tmpxctsu01n] => [/vendor/etc/powerhint.json]\n",
"2019-04-30 18:28:05,729 INFO : root : Killing: PsEntry(user='root', pid=1550, ppid=1, vsize=25524, rss=5248, wchan='binder_ioctl', pc='0', state='S', name='android.hardware.power@1.3-service')\n",
"2019-04-30 18:28:05,770 INFO : root : Classifiers : {'tag': 'b0_l0_g178_d0_u000_t00'}\n",
"2019-04-30 18:28:05,776 INFO : root : WLTest : {'agenda': '/tmp/sched-evaluation-interactive-small.yaml'}\n",
"2019-04-30 18:37:41,185 INFO : root : Results generated in: results/wltests_hikey960_uclamp_v8_exploration_ExporeGPU/wa.4175773_test_uclamp_v8\n",
"2019-04-30 18:37:41,186 INFO : root : No Errors reported in WA logfiles\n",
"2019-04-30 18:37:41,187 INFO : root : Moving results into: \n",
"2019-04-30 18:37:41,188 INFO : root : /data/Code/lisa/results/wltests_hikey960_uclamp_v8_exploration_ExporeGPU/wa.4175773_test_uclamp_v8_b0_l0_g178_d0_u000_t00\n",
"2019-04-30 18:37:41,209 INFO : root : ********************************************************************************\n",
"2019-04-30 18:37:41,210 INFO : root : Test 010/1944 [b0_l0_g400_d0_u000_t00]\n",
"2019-04-30 18:37:41,270 INFO : root : Local JSON [/tmp/tmpcwdryviy] updated\n",
"2019-04-30 18:37:41,307 INFO : root : Pushing [/tmp/tmpcwdryviy] => [/vendor/etc/powerhint.json]\n",
"2019-04-30 18:37:41,417 INFO : root : Killing: PsEntry(user='root', pid=8973, ppid=1, vsize=25524, rss=5296, wchan='binder_ioctl', pc='0', state='S', name='android.hardware.power@1.3-service')\n",
"2019-04-30 18:37:41,456 INFO : root : Classifiers : {'tag': 'b0_l0_g400_d0_u000_t00'}\n",
"2019-04-30 18:37:41,462 INFO : root : WLTest : {'agenda': '/tmp/sched-evaluation-interactive-small.yaml'}\n"
]
}
],
"source": [
"experiments = Experiments()\n",
"count = 0\n",
"for experiment in experiments:\n",
" tag = experiment.tag()\n",
" \n",
" count += 1\n",
" logging.info(\"*\"*80)\n",
" logging.info(\"Test %03d/%03d [%s]\", count, len(experiments), tag)\n",
" \n",
" # Configure PowerHAL\n",
" powerhal_setup(experiment)\n",
"\n",
" # Test configuration\n",
" test_config(tag, resdir='results/wltests_hikey960_uclamp_v8_exploration_ExporeGPU',\n",
" agenda='sched-evaluation-interactive-small.yaml')"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"!ls -la $LISA_HOME/results/wltests_hikey960_uclamp_v8_exploration/"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## "
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# EndOfDocument"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"app = \"com.android.benchmark/.app.RunLocalBenchmarksActivity --eia com.android.benchmark.EXTRA_ENABLED_BENCHMARK_IDS 0 --ei com.android.benchmark.EXTRA_RUN_COUNT 1\"\n",
"target.execute(\"am start -W -S -n {app}\".format(app=app))"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.5.2"
},
"toc": {
"colors": {
"hover_highlight": "#DAA520",
"running_highlight": "#FF0000",
"selected_highlight": "#FFD700"
},
"moveMenuLeft": true,
"nav_menu": {
"height": "100px",
"width": "252px"
},
"navigate_menu": true,
"number_sections": true,
"sideBar": true,
"threshold": 4,
"toc_cell": false,
"toc_section_display": "block",
"toc_window_display": false
},
"toc-autonumbering": true,
"toc-showcode": false,
"toc-showmarkdowntxt": false,
"toc-showtags": false
},
"nbformat": 4,
"nbformat_minor": 4
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment