blob: cdb852d35554d416ba8ad7b3b4248482e6fccac7 [file] [log] [blame]
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"import logging\n",
"reload(logging)\n",
"logging.basicConfig(\n",
" format='%(asctime)-9s %(levelname)-8s: %(message)s',\n",
" datefmt='%I:%M:%S')\n",
"\n",
"# Enable logging at INFO level\n",
"logging.getLogger().setLevel(logging.INFO)\n",
"# Uncomment the follwing line to enabled devlib debugging statements\n",
"logging.getLogger('ssh').setLevel(logging.DEBUG)"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"import json\n",
"import time\n",
"import os"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Test environment setup"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"# Setup a target configuration\n",
"my_target_conf = {\n",
" \"platform\" : \"linux\",\n",
" \"board\" : \"juno\",\n",
" \"modules\" : ['bl',\"cpufreq\"],\n",
" \"host\" : \"192.168.0.10\",\n",
" \"username\" : \"root\",\n",
" \"password\" : \"\",\n",
" \"tftp\" : {\n",
" \"folder\" : \"/var/lib/tftpboot\",\n",
" \"kernel\" : \"kern.bin\",\n",
" \"dtb\" : \"dtb.bin\"\n",
" },\n",
"}\n",
"\n",
"# Setup the required Test Environment supports\n",
"my_tests_conf = {\n",
" # list of additional devlib modules to install \n",
" \"modules\" : ['hwmon'],\n",
" # list of additional binary tools to install\n",
" \"tools\" : ['rt-app', 'taskset'],\n",
" \"ftrace\" : {\n",
" \"events\" : [\n",
" \"cpu_idle\",\n",
" \"sched_switch\",\n",
" ],\n",
" \"buffsize\" : 10240\n",
" }\n",
"}"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {
"collapsed": false,
"scrolled": true
},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"07:16:29 INFO : Target - Using base path: /home/derkling/Code/schedtest\n",
"07:16:29 INFO : Target - Connecting linux target with: {'username': 'root', 'host': '192.168.0.10', 'password': ''}\n",
"07:16:29 DEBUG : Logging in root@192.168.0.10\n",
"07:16:31 DEBUG : echo $PATH\n",
"07:16:31 DEBUG : ls -1 /usr/local/bin\n",
"07:16:31 DEBUG : cat /proc/cpuinfo\n",
"07:16:32 DEBUG : id\n",
"07:16:32 DEBUG : sudo -- sh -c 'dmidecode -s system-version'\n",
"07:16:33 DEBUG : uname -m\n",
"07:16:33 DEBUG : if [ -e '/sys/devices/system/cpu/cpufreq' ]; then echo 1; else echo 0; fi\n",
"07:16:34 DEBUG : if [ -e '/sys/devices/system/cpu/cpu0/cpufreq' ]; then echo 1; else echo 0; fi\n",
"07:16:34 DEBUG : if [ -e '/sys/class/hwmon' ]; then echo 1; else echo 0; fi\n",
"07:16:34 DEBUG : ls -1 /sys/class/hwmon\n",
"07:16:35 DEBUG : if [ -e '/sys/class/hwmon/hwmon0/name' ]; then echo 1; else echo 0; fi\n",
"07:16:35 DEBUG : sudo -- sh -c 'cat '\\''/sys/class/hwmon/hwmon0/name'\\'''\n",
"07:16:36 DEBUG : ls -1 /sys/class/hwmon/hwmon0/\n",
"07:16:36 DEBUG : sudo -- sh -c 'cat '\\''/sys/class/hwmon/hwmon0/curr1_label'\\'''\n",
"07:16:36 DEBUG : if [ -e '/sys/class/hwmon/hwmon1/name' ]; then echo 1; else echo 0; fi\n",
"07:16:37 DEBUG : sudo -- sh -c 'cat '\\''/sys/class/hwmon/hwmon1/name'\\'''\n",
"07:16:37 DEBUG : ls -1 /sys/class/hwmon/hwmon1/\n",
"07:16:38 DEBUG : sudo -- sh -c 'cat '\\''/sys/class/hwmon/hwmon1/curr1_label'\\'''\n",
"07:16:38 DEBUG : if [ -e '/sys/class/hwmon/hwmon10/name' ]; then echo 1; else echo 0; fi\n",
"07:16:39 DEBUG : sudo -- sh -c 'cat '\\''/sys/class/hwmon/hwmon10/name'\\'''\n",
"07:16:39 DEBUG : ls -1 /sys/class/hwmon/hwmon10/\n",
"07:16:39 DEBUG : sudo -- sh -c 'cat '\\''/sys/class/hwmon/hwmon10/power1_label'\\'''\n",
"07:16:40 DEBUG : if [ -e '/sys/class/hwmon/hwmon11/name' ]; then echo 1; else echo 0; fi\n",
"07:16:40 DEBUG : sudo -- sh -c 'cat '\\''/sys/class/hwmon/hwmon11/name'\\'''\n",
"07:16:41 DEBUG : ls -1 /sys/class/hwmon/hwmon11/\n",
"07:16:41 DEBUG : sudo -- sh -c 'cat '\\''/sys/class/hwmon/hwmon11/power1_label'\\'''\n",
"07:16:42 DEBUG : if [ -e '/sys/class/hwmon/hwmon12/name' ]; then echo 1; else echo 0; fi\n",
"07:16:42 DEBUG : sudo -- sh -c 'cat '\\''/sys/class/hwmon/hwmon12/name'\\'''\n",
"07:16:42 DEBUG : ls -1 /sys/class/hwmon/hwmon12/\n",
"07:16:43 DEBUG : sudo -- sh -c 'cat '\\''/sys/class/hwmon/hwmon12/energy1_label'\\'''\n",
"07:16:43 DEBUG : if [ -e '/sys/class/hwmon/hwmon13/name' ]; then echo 1; else echo 0; fi\n",
"07:16:44 DEBUG : sudo -- sh -c 'cat '\\''/sys/class/hwmon/hwmon13/name'\\'''\n",
"07:16:44 DEBUG : ls -1 /sys/class/hwmon/hwmon13/\n",
"07:16:44 DEBUG : sudo -- sh -c 'cat '\\''/sys/class/hwmon/hwmon13/energy1_label'\\'''\n",
"07:16:45 DEBUG : if [ -e '/sys/class/hwmon/hwmon14/name' ]; then echo 1; else echo 0; fi\n",
"07:16:45 DEBUG : sudo -- sh -c 'cat '\\''/sys/class/hwmon/hwmon14/name'\\'''\n",
"07:16:46 DEBUG : ls -1 /sys/class/hwmon/hwmon14/\n",
"07:16:46 DEBUG : sudo -- sh -c 'cat '\\''/sys/class/hwmon/hwmon14/energy1_label'\\'''\n",
"07:16:47 DEBUG : if [ -e '/sys/class/hwmon/hwmon15/name' ]; then echo 1; else echo 0; fi\n",
"07:16:47 DEBUG : sudo -- sh -c 'cat '\\''/sys/class/hwmon/hwmon15/name'\\'''\n",
"07:16:47 DEBUG : ls -1 /sys/class/hwmon/hwmon15/\n",
"07:16:48 DEBUG : sudo -- sh -c 'cat '\\''/sys/class/hwmon/hwmon15/energy1_label'\\'''\n",
"07:16:48 DEBUG : if [ -e '/sys/class/hwmon/hwmon2/name' ]; then echo 1; else echo 0; fi\n",
"07:16:49 DEBUG : sudo -- sh -c 'cat '\\''/sys/class/hwmon/hwmon2/name'\\'''\n",
"07:16:49 DEBUG : ls -1 /sys/class/hwmon/hwmon2/\n",
"07:16:49 DEBUG : sudo -- sh -c 'cat '\\''/sys/class/hwmon/hwmon2/curr1_label'\\'''\n",
"07:16:50 DEBUG : if [ -e '/sys/class/hwmon/hwmon3/name' ]; then echo 1; else echo 0; fi\n",
"07:16:50 DEBUG : sudo -- sh -c 'cat '\\''/sys/class/hwmon/hwmon3/name'\\'''\n",
"07:16:51 DEBUG : ls -1 /sys/class/hwmon/hwmon3/\n",
"07:16:51 DEBUG : sudo -- sh -c 'cat '\\''/sys/class/hwmon/hwmon3/curr1_label'\\'''\n",
"07:16:52 DEBUG : if [ -e '/sys/class/hwmon/hwmon4/name' ]; then echo 1; else echo 0; fi\n",
"07:16:52 DEBUG : sudo -- sh -c 'cat '\\''/sys/class/hwmon/hwmon4/name'\\'''\n",
"07:16:52 DEBUG : ls -1 /sys/class/hwmon/hwmon4/\n",
"07:16:53 DEBUG : sudo -- sh -c 'cat '\\''/sys/class/hwmon/hwmon4/in1_label'\\'''\n",
"07:16:53 DEBUG : if [ -e '/sys/class/hwmon/hwmon5/name' ]; then echo 1; else echo 0; fi\n",
"07:16:54 DEBUG : sudo -- sh -c 'cat '\\''/sys/class/hwmon/hwmon5/name'\\'''\n",
"07:16:54 DEBUG : ls -1 /sys/class/hwmon/hwmon5/\n",
"07:16:55 DEBUG : sudo -- sh -c 'cat '\\''/sys/class/hwmon/hwmon5/in1_label'\\'''\n",
"07:16:55 DEBUG : if [ -e '/sys/class/hwmon/hwmon6/name' ]; then echo 1; else echo 0; fi\n",
"07:16:55 DEBUG : sudo -- sh -c 'cat '\\''/sys/class/hwmon/hwmon6/name'\\'''\n",
"07:16:56 DEBUG : ls -1 /sys/class/hwmon/hwmon6/\n",
"07:16:56 DEBUG : sudo -- sh -c 'cat '\\''/sys/class/hwmon/hwmon6/in1_label'\\'''\n",
"07:16:57 DEBUG : if [ -e '/sys/class/hwmon/hwmon7/name' ]; then echo 1; else echo 0; fi\n",
"07:16:57 DEBUG : sudo -- sh -c 'cat '\\''/sys/class/hwmon/hwmon7/name'\\'''\n",
"07:16:58 DEBUG : ls -1 /sys/class/hwmon/hwmon7/\n",
"07:16:58 DEBUG : sudo -- sh -c 'cat '\\''/sys/class/hwmon/hwmon7/in1_label'\\'''\n",
"07:16:58 DEBUG : if [ -e '/sys/class/hwmon/hwmon8/name' ]; then echo 1; else echo 0; fi\n",
"07:16:59 DEBUG : sudo -- sh -c 'cat '\\''/sys/class/hwmon/hwmon8/name'\\'''\n",
"07:16:59 DEBUG : ls -1 /sys/class/hwmon/hwmon8/\n",
"07:17:00 DEBUG : sudo -- sh -c 'cat '\\''/sys/class/hwmon/hwmon8/power1_label'\\'''\n",
"07:17:00 DEBUG : if [ -e '/sys/class/hwmon/hwmon9/name' ]; then echo 1; else echo 0; fi\n",
"07:17:00 DEBUG : sudo -- sh -c 'cat '\\''/sys/class/hwmon/hwmon9/name'\\'''\n",
"07:17:01 DEBUG : ls -1 /sys/class/hwmon/hwmon9/\n",
"07:17:01 DEBUG : sudo -- sh -c 'cat '\\''/sys/class/hwmon/hwmon9/power1_label'\\'''\n",
"07:17:02 INFO : Target - Initializing target workdir [/root/devlib-target]\n",
"07:17:02 DEBUG : mkdir -p /root/devlib-target\n",
"07:17:02 DEBUG : mkdir -p /root/devlib-target/bin\n",
"07:17:02 DEBUG : /usr/bin/scp -r /home/derkling/Code/schedtest/libs/devlib/devlib/bin/arm64/busybox root@192.168.0.10:/root/devlib-target/bin/busybox\n",
"07:17:03 DEBUG : chmod a+x /root/devlib-target/bin/busybox\n",
"07:17:03 DEBUG : /usr/bin/scp -r /home/derkling/Code/schedtest/tools/arm64/taskset root@192.168.0.10:/root/devlib-target/bin/taskset\n",
"07:17:03 DEBUG : chmod a+x /root/devlib-target/bin/taskset\n",
"07:17:04 DEBUG : /usr/bin/scp -r /home/derkling/Code/schedtest/tools/arm64/rt-app root@192.168.0.10:/root/devlib-target/bin/rt-app\n",
"07:17:04 DEBUG : chmod a+x /root/devlib-target/bin/rt-app\n",
"07:17:04 INFO : Target topology: [[0, 3, 4, 5], [1, 2]]\n",
"07:17:04 DEBUG : sudo -- sh -c 'cat '\\''/sys/devices/system/cpu/online'\\'''\n",
"07:17:05 DEBUG : cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies\n",
"07:17:05 DEBUG : sudo -- sh -c 'cat '\\''/sys/devices/system/cpu/online'\\'''\n",
"07:17:06 DEBUG : cat /sys/devices/system/cpu/cpu1/cpufreq/scaling_available_frequencies\n",
"07:17:06 DEBUG : /usr/bin/scp -r /home/derkling/Code/schedtest/libs/devlib/devlib/bin/arm64/trace-cmd root@192.168.0.10:/root/devlib-target/bin/trace-cmd\n",
"07:17:06 DEBUG : chmod a+x /root/devlib-target/bin/trace-cmd\n",
"07:17:07 INFO : FTrace - Enabled events:\n",
"07:17:07 INFO : FTrace - ['cpu_idle', 'sched_switch']\n",
"07:17:07 INFO : EnergyMeter - Channels selected for energy sampling:\n",
"[CHAN(v2m_juno_energy/energy1, a53_energy), CHAN(v2m_juno_energy/energy1, a57_energy)]\n",
"07:17:07 INFO : Calibrating RTApp...\n",
"07:17:07 DEBUG : sudo -- sh -c 'for CPU in /sys/devices/system/cpu/cpu[0-9]*; do echo performance > $CPU/cpufreq/scaling_governor; done'\n",
"07:17:07 DEBUG : sudo -- sh -c 'cat '\\''/sys/devices/system/cpu/online'\\'''\n",
"07:17:08 INFO : CPU0 calibration...\n",
"07:17:08 DEBUG : ulimit -Hr\n",
"07:17:08 INFO : Setup new workload rta_calib\n",
"07:17:08 INFO : Workload duration defined by longest task\n",
"07:17:08 INFO : Default policy: SCHED_OTHER\n",
"07:17:08 INFO : ------------------------\n",
"07:17:08 INFO : task [task1], sched: {'policy': 'FIFO', 'prio': 0}\n",
"07:17:08 INFO : | loops count: 1\n",
"07:17:08 INFO : + phase_000001: duration 1.000000 [s] (10 loops)\n",
"07:17:08 INFO : | period 100000 [us], duty_cycle 50 %\n",
"07:17:08 INFO : | run_time 50000 [us], sleep_time 50000 [us]\n",
"07:17:08 DEBUG : /usr/bin/scp -r rta_calib_00.json root@192.168.0.10:/root/devlib-target\n",
"07:17:08 INFO : Executor [start]: /root/devlib-target/bin/taskset 0x1 /root/devlib-target/bin/rt-app /root/devlib-target/rta_calib_00.json\n",
"07:17:08 DEBUG : sudo -- sh -c '/root/devlib-target/bin/taskset 0x1 /root/devlib-target/bin/rt-app /root/devlib-target/rta_calib_00.json'\n",
"07:17:10 DEBUG : /usr/bin/scp -r root@192.168.0.10:'/root/devlib-target/*task1*.log' ./\n",
"07:17:10 DEBUG : /usr/bin/scp -r root@192.168.0.10:/root/devlib-target/rta_calib_00.json ./\n",
"07:17:10 INFO : Executor [end]: /root/devlib-target/bin/taskset 0x1 /root/devlib-target/bin/rt-app /root/devlib-target/rta_calib_00.json\n",
"07:17:10 INFO : CPU1 calibration...\n",
"07:17:10 DEBUG : ulimit -Hr\n",
"07:17:10 INFO : Setup new workload rta_calib\n",
"07:17:10 INFO : Workload duration defined by longest task\n",
"07:17:10 INFO : Default policy: SCHED_OTHER\n",
"07:17:10 INFO : ------------------------\n",
"07:17:10 INFO : task [task1], sched: {'policy': 'FIFO', 'prio': 0}\n",
"07:17:10 INFO : | loops count: 1\n",
"07:17:10 INFO : + phase_000001: duration 1.000000 [s] (10 loops)\n",
"07:17:10 INFO : | period 100000 [us], duty_cycle 50 %\n",
"07:17:10 INFO : | run_time 50000 [us], sleep_time 50000 [us]\n",
"07:17:10 DEBUG : /usr/bin/scp -r rta_calib_00.json root@192.168.0.10:/root/devlib-target\n",
"07:17:10 INFO : Executor [start]: /root/devlib-target/bin/taskset 0x2 /root/devlib-target/bin/rt-app /root/devlib-target/rta_calib_00.json\n",
"07:17:11 DEBUG : sudo -- sh -c '/root/devlib-target/bin/taskset 0x2 /root/devlib-target/bin/rt-app /root/devlib-target/rta_calib_00.json'\n",
"07:17:12 DEBUG : /usr/bin/scp -r root@192.168.0.10:'/root/devlib-target/*task1*.log' ./\n",
"07:17:12 DEBUG : /usr/bin/scp -r root@192.168.0.10:/root/devlib-target/rta_calib_00.json ./\n",
"07:17:12 INFO : Executor [end]: /root/devlib-target/bin/taskset 0x2 /root/devlib-target/bin/rt-app /root/devlib-target/rta_calib_00.json\n",
"07:17:12 INFO : CPU2 calibration...\n",
"07:17:12 DEBUG : ulimit -Hr\n",
"07:17:12 INFO : Setup new workload rta_calib\n",
"07:17:12 INFO : Workload duration defined by longest task\n",
"07:17:12 INFO : Default policy: SCHED_OTHER\n",
"07:17:12 INFO : ------------------------\n",
"07:17:12 INFO : task [task1], sched: {'policy': 'FIFO', 'prio': 0}\n",
"07:17:12 INFO : | loops count: 1\n",
"07:17:12 INFO : + phase_000001: duration 1.000000 [s] (10 loops)\n",
"07:17:12 INFO : | period 100000 [us], duty_cycle 50 %\n",
"07:17:12 INFO : | run_time 50000 [us], sleep_time 50000 [us]\n",
"07:17:12 DEBUG : /usr/bin/scp -r rta_calib_00.json root@192.168.0.10:/root/devlib-target\n",
"07:17:12 INFO : Executor [start]: /root/devlib-target/bin/taskset 0x4 /root/devlib-target/bin/rt-app /root/devlib-target/rta_calib_00.json\n",
"07:17:13 DEBUG : sudo -- sh -c '/root/devlib-target/bin/taskset 0x4 /root/devlib-target/bin/rt-app /root/devlib-target/rta_calib_00.json'\n",
"07:17:14 DEBUG : /usr/bin/scp -r root@192.168.0.10:'/root/devlib-target/*task1*.log' ./\n",
"07:17:14 DEBUG : /usr/bin/scp -r root@192.168.0.10:/root/devlib-target/rta_calib_00.json ./\n",
"07:17:14 INFO : Executor [end]: /root/devlib-target/bin/taskset 0x4 /root/devlib-target/bin/rt-app /root/devlib-target/rta_calib_00.json\n",
"07:17:14 INFO : CPU3 calibration...\n",
"07:17:14 DEBUG : ulimit -Hr\n",
"07:17:14 INFO : Setup new workload rta_calib\n",
"07:17:14 INFO : Workload duration defined by longest task\n",
"07:17:14 INFO : Default policy: SCHED_OTHER\n",
"07:17:14 INFO : ------------------------\n",
"07:17:14 INFO : task [task1], sched: {'policy': 'FIFO', 'prio': 0}\n",
"07:17:14 INFO : | loops count: 1\n",
"07:17:14 INFO : + phase_000001: duration 1.000000 [s] (10 loops)\n",
"07:17:14 INFO : | period 100000 [us], duty_cycle 50 %\n",
"07:17:14 INFO : | run_time 50000 [us], sleep_time 50000 [us]\n",
"07:17:14 DEBUG : /usr/bin/scp -r rta_calib_00.json root@192.168.0.10:/root/devlib-target\n",
"07:17:14 INFO : Executor [start]: /root/devlib-target/bin/taskset 0x8 /root/devlib-target/bin/rt-app /root/devlib-target/rta_calib_00.json\n",
"07:17:15 DEBUG : sudo -- sh -c '/root/devlib-target/bin/taskset 0x8 /root/devlib-target/bin/rt-app /root/devlib-target/rta_calib_00.json'\n",
"07:17:16 DEBUG : /usr/bin/scp -r root@192.168.0.10:'/root/devlib-target/*task1*.log' ./\n",
"07:17:16 DEBUG : /usr/bin/scp -r root@192.168.0.10:/root/devlib-target/rta_calib_00.json ./\n",
"07:17:16 INFO : Executor [end]: /root/devlib-target/bin/taskset 0x8 /root/devlib-target/bin/rt-app /root/devlib-target/rta_calib_00.json\n",
"07:17:16 INFO : CPU4 calibration...\n",
"07:17:16 DEBUG : ulimit -Hr\n",
"07:17:17 INFO : Setup new workload rta_calib\n",
"07:17:17 INFO : Workload duration defined by longest task\n",
"07:17:17 INFO : Default policy: SCHED_OTHER\n",
"07:17:17 INFO : ------------------------\n",
"07:17:17 INFO : task [task1], sched: {'policy': 'FIFO', 'prio': 0}\n",
"07:17:17 INFO : | loops count: 1\n",
"07:17:17 INFO : + phase_000001: duration 1.000000 [s] (10 loops)\n",
"07:17:17 INFO : | period 100000 [us], duty_cycle 50 %\n",
"07:17:17 INFO : | run_time 50000 [us], sleep_time 50000 [us]\n",
"07:17:17 DEBUG : /usr/bin/scp -r rta_calib_00.json root@192.168.0.10:/root/devlib-target\n",
"07:17:17 INFO : Executor [start]: /root/devlib-target/bin/taskset 0x10 /root/devlib-target/bin/rt-app /root/devlib-target/rta_calib_00.json\n",
"07:17:17 DEBUG : sudo -- sh -c '/root/devlib-target/bin/taskset 0x10 /root/devlib-target/bin/rt-app /root/devlib-target/rta_calib_00.json'\n",
"07:17:18 DEBUG : /usr/bin/scp -r root@192.168.0.10:'/root/devlib-target/*task1*.log' ./\n",
"07:17:18 DEBUG : /usr/bin/scp -r root@192.168.0.10:/root/devlib-target/rta_calib_00.json ./\n",
"07:17:18 INFO : Executor [end]: /root/devlib-target/bin/taskset 0x10 /root/devlib-target/bin/rt-app /root/devlib-target/rta_calib_00.json\n",
"07:17:18 INFO : CPU5 calibration...\n",
"07:17:18 DEBUG : ulimit -Hr\n",
"07:17:19 INFO : Setup new workload rta_calib\n",
"07:17:19 INFO : Workload duration defined by longest task\n",
"07:17:19 INFO : Default policy: SCHED_OTHER\n",
"07:17:19 INFO : ------------------------\n",
"07:17:19 INFO : task [task1], sched: {'policy': 'FIFO', 'prio': 0}\n",
"07:17:19 INFO : | loops count: 1\n",
"07:17:19 INFO : + phase_000001: duration 1.000000 [s] (10 loops)\n",
"07:17:19 INFO : | period 100000 [us], duty_cycle 50 %\n",
"07:17:19 INFO : | run_time 50000 [us], sleep_time 50000 [us]\n",
"07:17:19 DEBUG : /usr/bin/scp -r rta_calib_00.json root@192.168.0.10:/root/devlib-target\n",
"07:17:19 INFO : Executor [start]: /root/devlib-target/bin/taskset 0x20 /root/devlib-target/bin/rt-app /root/devlib-target/rta_calib_00.json\n",
"07:17:19 DEBUG : sudo -- sh -c '/root/devlib-target/bin/taskset 0x20 /root/devlib-target/bin/rt-app /root/devlib-target/rta_calib_00.json'\n",
"07:17:20 DEBUG : /usr/bin/scp -r root@192.168.0.10:'/root/devlib-target/*task1*.log' ./\n",
"07:17:20 DEBUG : /usr/bin/scp -r root@192.168.0.10:/root/devlib-target/rta_calib_00.json ./\n",
"07:17:20 INFO : Executor [end]: /root/devlib-target/bin/taskset 0x20 /root/devlib-target/bin/rt-app /root/devlib-target/rta_calib_00.json\n",
"07:17:20 INFO : Target RT-App calibration:\n",
"07:17:20 INFO : {0: 352, 1: 138, 2: 138, 3: 355, 4: 361, 5: 353}\n",
"07:17:20 INFO : Using RT-App calibration values: {0: 352, 1: 138, 2: 138, 3: 355, 4: 361, 5: 353}\n"
]
}
],
"source": [
"from env import TestEnv\n",
"\n",
"# Initialize a test environment using:\n",
"# the provided target configuration (my_target_conf)\n",
"# the provided test configuration (my_test_conf)\n",
"te = TestEnv(target_conf=my_target_conf, test_conf=my_tests_conf)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Attributes"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The initialization of the test environment pre-initialize some useful<br>\n",
"environment variables which are available to write test cases.\n",
"\n",
"These are some of the information available via the TestEnv object."
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"{\n",
" \"username\": \"root\", \n",
" \"ftrace\": {\n",
" \"buffsize\": 10240, \n",
" \"events\": [\n",
" \"cpu_idle\", \n",
" \"sched_switch\"\n",
" ]\n",
" }, \n",
" \"modules\": [\n",
" \"bl\", \n",
" \"cpufreq\"\n",
" ], \n",
" \"platform\": \"linux\", \n",
" \"host\": \"192.168.0.10\", \n",
" \"board\": \"juno\", \n",
" \"__features__\": [], \n",
" \"tftp\": {\n",
" \"kernel\": \"kern.bin\", \n",
" \"folder\": \"/var/lib/tftpboot\", \n",
" \"dtb\": \"dtb.bin\"\n",
" }, \n",
" \"password\": \"\", \n",
" \"tools\": []\n",
"}\n"
]
}
],
"source": [
"# The complete configuration of the target we have configured\n",
"print json.dumps(te.conf, indent=4)"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"None\n",
"None\n"
]
}
],
"source": [
"# Last configured kernel and DTB image\n",
"print te.kernel\n",
"print te.dtb"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"192.168.0.10\n",
"None\n"
]
}
],
"source": [
"# The IP and MAC address of the target\n",
"print te.ip\n",
"print te.mac"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"{\n",
" \"clusters\": {\n",
" \"big\": [\n",
" 1, \n",
" 2\n",
" ], \n",
" \"little\": [\n",
" 0, \n",
" 3, \n",
" 4, \n",
" 5\n",
" ]\n",
" }, \n",
" \"cpus_count\": 6, \n",
" \"freqs\": {\n",
" \"big\": [\n",
" 450000, \n",
" 625000, \n",
" 800000, \n",
" 950000, \n",
" 1100000\n",
" ], \n",
" \"little\": [\n",
" 450000, \n",
" 575000, \n",
" 700000, \n",
" 775000, \n",
" 850000\n",
" ]\n",
" }, \n",
" \"topology\": [\n",
" [\n",
" 0, \n",
" 3, \n",
" 4, \n",
" 5\n",
" ], \n",
" [\n",
" 1, \n",
" 2\n",
" ]\n",
" ]\n",
"}\n"
]
}
],
"source": [
"# A full platform descriptor\n",
"print json.dumps(te.platform, indent=4)"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"'/home/derkling/Code/schedtest/results/20151110_191720'"
]
},
"execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# A pre-created folder to host the tests results generated using this\n",
"# test environment, notice that the suite could add additional information\n",
"# in this folder, like for example a copy of the target configuration\n",
"# and other target specific collected information\n",
"te.res_dir"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"'/data/local/schedtest'"
]
},
"execution_count": 10,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# The working directory on the target\n",
"te.workdir"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"<trappy.stats.Topology.Topology at 0x7f62c4368310>"
]
},
"execution_count": 11,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# The target topology, which can be used to build BART assertions\n",
"te.topology"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Functions"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Some methods are also exposed to test developers which could be used to easy\n",
"the creation of tests.\n",
"\n",
"These are some of the methods available:"
]
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {
"collapsed": false,
"scrolled": true
},
"outputs": [
{
"data": {
"text/plain": [
"{0: 352, 1: 138, 2: 138, 3: 355, 4: 361, 5: 353}"
]
},
"execution_count": 12,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# Calibrate RT-App (if required) and get the most updated calibration value\n",
"te.calibration()"
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"# Generate a JSON file with the complete platform description\n",
"te.platform_dump(dest_dir='/tmp')"
]
},
{
"cell_type": "code",
"execution_count": 14,
"metadata": {
"collapsed": false,
"scrolled": true
},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"07:17:22 DEBUG : sudo -- sh -c 'sleep 2 && reboot -f &'\n",
"07:17:23 INFO : Reboot - Waiting 60 [s]for target to reboot...\n",
"07:18:23 INFO : Target - Connecting linux target with: {'username': 'root', 'host': '192.168.0.10', 'password': ''}\n",
"07:18:23 DEBUG : Logging in root@192.168.0.10\n",
"07:18:24 DEBUG : echo $PATH\n",
"07:18:24 DEBUG : ls -1 /usr/local/bin\n",
"07:18:25 DEBUG : cat /proc/cpuinfo\n",
"07:18:25 DEBUG : id\n",
"07:18:26 DEBUG : sudo -- sh -c 'dmidecode -s system-version'\n",
"07:18:26 DEBUG : uname -m\n",
"07:18:26 DEBUG : if [ -e '/sys/devices/system/cpu/cpufreq' ]; then echo 1; else echo 0; fi\n",
"07:18:27 DEBUG : if [ -e '/sys/devices/system/cpu/cpu0/cpufreq' ]; then echo 1; else echo 0; fi\n",
"07:18:27 DEBUG : if [ -e '/sys/class/hwmon' ]; then echo 1; else echo 0; fi\n",
"07:18:28 DEBUG : ls -1 /sys/class/hwmon\n",
"07:18:28 DEBUG : if [ -e '/sys/class/hwmon/hwmon0/name' ]; then echo 1; else echo 0; fi\n",
"07:18:29 DEBUG : sudo -- sh -c 'cat '\\''/sys/class/hwmon/hwmon0/name'\\'''\n",
"07:18:29 DEBUG : ls -1 /sys/class/hwmon/hwmon0/\n",
"07:18:29 DEBUG : sudo -- sh -c 'cat '\\''/sys/class/hwmon/hwmon0/curr1_label'\\'''\n",
"07:18:30 DEBUG : if [ -e '/sys/class/hwmon/hwmon1/name' ]; then echo 1; else echo 0; fi\n",
"07:18:30 DEBUG : sudo -- sh -c 'cat '\\''/sys/class/hwmon/hwmon1/name'\\'''\n",
"07:18:31 DEBUG : ls -1 /sys/class/hwmon/hwmon1/\n",
"07:18:31 DEBUG : sudo -- sh -c 'cat '\\''/sys/class/hwmon/hwmon1/curr1_label'\\'''\n",
"07:18:31 DEBUG : if [ -e '/sys/class/hwmon/hwmon10/name' ]; then echo 1; else echo 0; fi\n",
"07:18:32 DEBUG : sudo -- sh -c 'cat '\\''/sys/class/hwmon/hwmon10/name'\\'''\n",
"07:18:32 DEBUG : ls -1 /sys/class/hwmon/hwmon10/\n",
"07:18:33 DEBUG : sudo -- sh -c 'cat '\\''/sys/class/hwmon/hwmon10/power1_label'\\'''\n",
"07:18:33 DEBUG : if [ -e '/sys/class/hwmon/hwmon11/name' ]; then echo 1; else echo 0; fi\n",
"07:18:34 DEBUG : sudo -- sh -c 'cat '\\''/sys/class/hwmon/hwmon11/name'\\'''\n",
"07:18:34 DEBUG : ls -1 /sys/class/hwmon/hwmon11/\n",
"07:18:34 DEBUG : sudo -- sh -c 'cat '\\''/sys/class/hwmon/hwmon11/power1_label'\\'''\n",
"07:18:35 DEBUG : if [ -e '/sys/class/hwmon/hwmon12/name' ]; then echo 1; else echo 0; fi\n",
"07:18:35 DEBUG : sudo -- sh -c 'cat '\\''/sys/class/hwmon/hwmon12/name'\\'''\n",
"07:18:36 DEBUG : ls -1 /sys/class/hwmon/hwmon12/\n",
"07:18:36 DEBUG : sudo -- sh -c 'cat '\\''/sys/class/hwmon/hwmon12/energy1_label'\\'''\n",
"07:18:37 DEBUG : if [ -e '/sys/class/hwmon/hwmon13/name' ]; then echo 1; else echo 0; fi\n",
"07:18:37 DEBUG : sudo -- sh -c 'cat '\\''/sys/class/hwmon/hwmon13/name'\\'''\n",
"07:18:37 DEBUG : ls -1 /sys/class/hwmon/hwmon13/\n",
"07:18:38 DEBUG : sudo -- sh -c 'cat '\\''/sys/class/hwmon/hwmon13/energy1_label'\\'''\n",
"07:18:38 DEBUG : if [ -e '/sys/class/hwmon/hwmon14/name' ]; then echo 1; else echo 0; fi\n",
"07:18:39 DEBUG : sudo -- sh -c 'cat '\\''/sys/class/hwmon/hwmon14/name'\\'''\n",
"07:18:39 DEBUG : ls -1 /sys/class/hwmon/hwmon14/\n",
"07:18:39 DEBUG : sudo -- sh -c 'cat '\\''/sys/class/hwmon/hwmon14/energy1_label'\\'''\n",
"07:18:40 DEBUG : if [ -e '/sys/class/hwmon/hwmon15/name' ]; then echo 1; else echo 0; fi\n",
"07:18:40 DEBUG : sudo -- sh -c 'cat '\\''/sys/class/hwmon/hwmon15/name'\\'''\n",
"07:18:41 DEBUG : ls -1 /sys/class/hwmon/hwmon15/\n",
"07:18:41 DEBUG : sudo -- sh -c 'cat '\\''/sys/class/hwmon/hwmon15/energy1_label'\\'''\n",
"07:18:42 DEBUG : if [ -e '/sys/class/hwmon/hwmon2/name' ]; then echo 1; else echo 0; fi\n",
"07:18:42 DEBUG : sudo -- sh -c 'cat '\\''/sys/class/hwmon/hwmon2/name'\\'''\n",
"07:18:42 DEBUG : ls -1 /sys/class/hwmon/hwmon2/\n",
"07:18:43 DEBUG : sudo -- sh -c 'cat '\\''/sys/class/hwmon/hwmon2/curr1_label'\\'''\n",
"07:18:43 DEBUG : if [ -e '/sys/class/hwmon/hwmon3/name' ]; then echo 1; else echo 0; fi\n",
"07:18:44 DEBUG : sudo -- sh -c 'cat '\\''/sys/class/hwmon/hwmon3/name'\\'''\n",
"07:18:44 DEBUG : ls -1 /sys/class/hwmon/hwmon3/\n",
"07:18:45 DEBUG : sudo -- sh -c 'cat '\\''/sys/class/hwmon/hwmon3/curr1_label'\\'''\n",
"07:18:45 DEBUG : if [ -e '/sys/class/hwmon/hwmon4/name' ]; then echo 1; else echo 0; fi\n",
"07:18:45 DEBUG : sudo -- sh -c 'cat '\\''/sys/class/hwmon/hwmon4/name'\\'''\n",
"07:18:46 DEBUG : ls -1 /sys/class/hwmon/hwmon4/\n",
"07:18:46 DEBUG : sudo -- sh -c 'cat '\\''/sys/class/hwmon/hwmon4/in1_label'\\'''\n",
"07:18:47 DEBUG : if [ -e '/sys/class/hwmon/hwmon5/name' ]; then echo 1; else echo 0; fi\n",
"07:18:47 DEBUG : sudo -- sh -c 'cat '\\''/sys/class/hwmon/hwmon5/name'\\'''\n",
"07:18:47 DEBUG : ls -1 /sys/class/hwmon/hwmon5/\n",
"07:18:48 DEBUG : sudo -- sh -c 'cat '\\''/sys/class/hwmon/hwmon5/in1_label'\\'''\n",
"07:18:48 DEBUG : if [ -e '/sys/class/hwmon/hwmon6/name' ]; then echo 1; else echo 0; fi\n",
"07:18:49 DEBUG : sudo -- sh -c 'cat '\\''/sys/class/hwmon/hwmon6/name'\\'''\n",
"07:18:49 DEBUG : ls -1 /sys/class/hwmon/hwmon6/\n",
"07:18:50 DEBUG : sudo -- sh -c 'cat '\\''/sys/class/hwmon/hwmon6/in1_label'\\'''\n",
"07:18:50 DEBUG : if [ -e '/sys/class/hwmon/hwmon7/name' ]; then echo 1; else echo 0; fi\n",
"07:18:50 DEBUG : sudo -- sh -c 'cat '\\''/sys/class/hwmon/hwmon7/name'\\'''\n",
"07:18:51 DEBUG : ls -1 /sys/class/hwmon/hwmon7/\n",
"07:18:51 DEBUG : sudo -- sh -c 'cat '\\''/sys/class/hwmon/hwmon7/in1_label'\\'''\n",
"07:18:52 DEBUG : if [ -e '/sys/class/hwmon/hwmon8/name' ]; then echo 1; else echo 0; fi\n",
"07:18:52 DEBUG : sudo -- sh -c 'cat '\\''/sys/class/hwmon/hwmon8/name'\\'''\n",
"07:18:53 DEBUG : ls -1 /sys/class/hwmon/hwmon8/\n",
"07:18:53 DEBUG : sudo -- sh -c 'cat '\\''/sys/class/hwmon/hwmon8/power1_label'\\'''\n",
"07:18:53 DEBUG : if [ -e '/sys/class/hwmon/hwmon9/name' ]; then echo 1; else echo 0; fi\n",
"07:18:54 DEBUG : sudo -- sh -c 'cat '\\''/sys/class/hwmon/hwmon9/name'\\'''\n",
"07:18:54 DEBUG : ls -1 /sys/class/hwmon/hwmon9/\n",
"07:18:55 DEBUG : sudo -- sh -c 'cat '\\''/sys/class/hwmon/hwmon9/power1_label'\\'''\n",
"07:18:55 INFO : Target - Initializing target workdir [/root/devlib-target]\n",
"07:18:55 DEBUG : mkdir -p /root/devlib-target\n",
"07:18:55 DEBUG : mkdir -p /root/devlib-target/bin\n",
"07:18:56 DEBUG : /usr/bin/scp -r /home/derkling/Code/schedtest/libs/devlib/devlib/bin/arm64/busybox root@192.168.0.10:/root/devlib-target/bin/busybox\n",
"07:18:56 DEBUG : chmod a+x /root/devlib-target/bin/busybox\n",
"07:18:57 DEBUG : /usr/bin/scp -r /home/derkling/Code/schedtest/tools/arm64/taskset root@192.168.0.10:/root/devlib-target/bin/taskset\n",
"07:18:57 DEBUG : chmod a+x /root/devlib-target/bin/taskset\n",
"07:18:57 DEBUG : /usr/bin/scp -r /home/derkling/Code/schedtest/tools/arm64/rt-app root@192.168.0.10:/root/devlib-target/bin/rt-app\n",
"07:18:58 DEBUG : chmod a+x /root/devlib-target/bin/rt-app\n",
"07:18:58 INFO : Target topology: [[0, 3, 4, 5], [1, 2]]\n",
"07:18:58 DEBUG : sudo -- sh -c 'cat '\\''/sys/devices/system/cpu/online'\\'''\n",
"07:18:58 DEBUG : cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies\n",
"07:18:59 DEBUG : sudo -- sh -c 'cat '\\''/sys/devices/system/cpu/online'\\'''\n",
"07:18:59 DEBUG : cat /sys/devices/system/cpu/cpu1/cpufreq/scaling_available_frequencies\n",
"07:19:00 DEBUG : /usr/bin/scp -r /home/derkling/Code/schedtest/libs/devlib/devlib/bin/arm64/trace-cmd root@192.168.0.10:/root/devlib-target/bin/trace-cmd\n",
"07:19:00 DEBUG : chmod a+x /root/devlib-target/bin/trace-cmd\n",
"07:19:00 INFO : FTrace - Enabled events:\n",
"07:19:00 INFO : FTrace - ['cpu_idle', 'sched_switch']\n",
"07:19:00 INFO : EnergyMeter - Channels selected for energy sampling:\n",
"[CHAN(v2m_juno_energy/energy1, a53_energy), CHAN(v2m_juno_energy/energy1, a57_energy)]\n"
]
}
],
"source": [
"# Force a reboot of the target (and wait specified [s] before reconnect)\n",
"te.reboot(reboot_time=60)"
]
},
{
"cell_type": "code",
"execution_count": 15,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"07:19:00 INFO : HostResolver - Target (00:02:F7:00:5A:5B) at IP address: 192.168.0.10\n"
]
},
{
"data": {
"text/plain": [
"('00:02:F7:00:5A:5B', '192.168.0.10')"
]
},
"execution_count": 15,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# Resolve a MAC address into an IP address\n",
"te.resolv_host(host='00:02:F7:00:5A:5B')"
]
},
{
"cell_type": "code",
"execution_count": 16,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"07:19:00 INFO : TFTP - Deploy /etc/group into /var/lib/tftpboot/group\n"
]
}
],
"source": [
"# Copy the specified file into the TFTP server folder defined by configuration\n",
"te.tftp_deploy('/etc/group')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"A special TestEnv attribute is <b>target</b>, which represent a <b>devlib instance</b>.<br>\n",
"Using the target attribute we can access to the full set of devlib provided<br>\n",
"functionalities. Which are summarized in the following sections."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"\n",
"# Access to the devlib API"
]
},
{
"cell_type": "code",
"execution_count": 17,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"07:19:01 DEBUG : echo -n 'Hello Test Environment'\n"
]
},
{
"data": {
"text/plain": [
"'Hello Test Environment'"
]
},
"execution_count": 17,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# Run a command on the target\n",
"te.target.execute(\"echo -n 'Hello Test Environment'\", as_root=False)"
]
},
{
"cell_type": "code",
"execution_count": 18,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"07:19:01 DEBUG : sudo -- sh -c 'sh -c \"sleep 10\" 1>/dev/null 2>/dev/null &'\n"
]
},
{
"data": {
"text/plain": [
"''"
]
},
"execution_count": 18,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# Spawn a command in background on the target\n",
"te.target.kick_off(\"sleep 10\", as_root=True)"
]
},
{
"cell_type": "code",
"execution_count": 19,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"ABI : arm64\n",
"big Core Family : A57\n",
"LITTLE Core Family : A53\n",
"CPU's Clusters IDs : [0, 1, 1, 0, 0, 0]\n",
"CPUs type : ['A53', 'A57', 'A57', 'A53', 'A53', 'A53']\n"
]
}
],
"source": [
"# Acces to many target specific information\n",
"print \"ABI : \", te.target.abi\n",
"print \"big Core Family : \", te.target.big_core\n",
"print \"LITTLE Core Family : \", te.target.little_core\n",
"print \"CPU's Clusters IDs : \", te.target.core_clusters\n",
"print \"CPUs type : \", te.target.core_names"
]
},
{
"cell_type": "code",
"execution_count": 20,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"07:19:02 DEBUG : sudo -- sh -c 'cat '\\''/sys/devices/system/cpu/online'\\'''\n",
"07:19:02 DEBUG : sudo -- sh -c 'cat '\\''/sys/devices/system/cpu/cpu1/cpufreq/scaling_cur_freq'\\'''\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"big CPUs IDs : [1, 2]\n",
"LITTLE CPUs IDs : [0, 3, 4, 5]\n",
"big CPUs freqs : 1100000"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"07:19:03 DEBUG : sudo -- sh -c 'cat '\\''/sys/devices/system/cpu/online'\\'''\n",
"07:19:03 DEBUG : sudo -- sh -c 'cat '\\''/sys/devices/system/cpu/cpu1/cpufreq/scaling_governor'\\'''\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"\n",
"big CPUs governor : performance\n"
]
}
],
"source": [
"# Access to big.LITTLE specific information\n",
"print \"big CPUs IDs : \", te.target.bl.bigs\n",
"print \"LITTLE CPUs IDs : \", te.target.bl.littles\n",
"print \"big CPUs freqs : {}\".format(te.target.bl.get_bigs_frequency())\n",
"print \"big CPUs governor : {}\".format(te.target.bl.get_bigs_governor())"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Sample energy from the target"
]
},
{
"cell_type": "code",
"execution_count": 26,
"metadata": {
"collapsed": false,
"scrolled": false
},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"07:20:08 DEBUG : sudo -- sh -c 'cat '\\''/sys/class/hwmon/hwmon14/energy1_input'\\'''\n",
"07:20:09 DEBUG : sudo -- sh -c 'cat '\\''/sys/class/hwmon/hwmon13/energy1_input'\\'''\n",
"07:20:09 DEBUG : sudo -- sh -c 'cat '\\''/sys/class/hwmon/hwmon14/energy1_input'\\'''\n",
"07:20:10 DEBUG : sudo -- sh -c 'cat '\\''/sys/class/hwmon/hwmon13/energy1_input'\\'''\n",
"07:20:10 DEBUG : sudo -- sh -c 'cat '\\''/sys/class/hwmon/hwmon14/energy1_input'\\'''\n",
"07:20:10 DEBUG : sudo -- sh -c 'cat '\\''/sys/class/hwmon/hwmon13/energy1_input'\\'''\n",
"07:20:13 DEBUG : sudo -- sh -c 'cat '\\''/sys/class/hwmon/hwmon14/energy1_input'\\'''\n",
"07:20:13 DEBUG : sudo -- sh -c 'cat '\\''/sys/class/hwmon/hwmon13/energy1_input'\\'''\n",
"07:20:14 DEBUG : sudo -- sh -c 'cat '\\''/sys/class/hwmon/hwmon14/energy1_input'\\'''\n",
"07:20:14 DEBUG : sudo -- sh -c 'cat '\\''/sys/class/hwmon/hwmon13/energy1_input'\\'''\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"First read: {\n",
" \"a53\": {\n",
" \"total\": 0.5966060000000013, \n",
" \"last\": 57.526971, \n",
" \"delta\": 0.29631200000000035\n",
" }, \n",
" \"a57\": {\n",
" \"total\": 0.6072220000000002, \n",
" \"last\": 61.852674, \n",
" \"delta\": 0.30055699999999774\n",
" }\n",
"}\n",
"Second read: {\n",
" \"a53\": {\n",
" \"total\": 1.513701999999995, \n",
" \"last\": 58.444067, \n",
" \"delta\": 0.29879099999999426\n",
" }, \n",
" \"a57\": {\n",
" \"total\": 1.6665810000000008, \n",
" \"last\": 62.912033, \n",
" \"delta\": 0.3054509999999979\n",
" }\n",
"}\n"
]
}
],
"source": [
"# Reset and sample energy counters\n",
"te.emeter.reset()\n",
"nrg = te.emeter.sample()\n",
"nrg = json.dumps(te.emeter.sample(), indent=4)\n",
"print \"First read: \", nrg\n",
"time.sleep(2)\n",
"nrg = te.emeter.sample()\n",
"nrg = json.dumps(te.emeter.sample(), indent=4)\n",
"print \"Second read: \", nrg"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Configure FTrace for a sepcific experiment"
]
},
{
"cell_type": "code",
"execution_count": 27,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"07:20:32 DEBUG : /usr/bin/scp -r /home/derkling/Code/schedtest/libs/devlib/devlib/bin/arm64/trace-cmd root@192.168.0.10:/root/devlib-target/bin/trace-cmd\n",
"07:20:32 DEBUG : chmod a+x /root/devlib-target/bin/trace-cmd\n",
"07:20:33 INFO : FTrace - Enabled events:\n",
"07:20:33 INFO : FTrace - ['cpu_idle', 'cpu_capacity', 'cpu_frequency', 'sched_switch']\n"
]
}
],
"source": [
"# Configure a specific set of events to trace\n",
"te.ftrace_conf(\n",
" { \n",
" \"events\" : [ \n",
" \"cpu_idle\", \n",
" \"cpu_capacity\",\n",
" \"cpu_frequency\",\n",
" \"sched_switch\"\n",
" ], \n",
" \"buffsize\" : 10240 \n",
" }\n",
")"
]
},
{
"cell_type": "code",
"execution_count": 30,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"07:21:25 DEBUG : sudo -- sh -c 'echo 10240 > '\\''/sys/kernel/debug/tracing/buffer_size_kb'\\'''\n",
"07:21:26 DEBUG : sudo -- sh -c 'cat '\\''/sys/kernel/debug/tracing/buffer_size_kb'\\'''\n",
"07:21:26 DEBUG : sudo -- sh -c '/root/devlib-target/bin/trace-cmd reset'\n",
"07:21:29 DEBUG : sudo -- sh -c 'echo TRACE_MARKER_START > '\\''/sys/kernel/debug/tracing/trace_marker'\\'''\n",
"07:21:29 DEBUG : sudo -- sh -c '/root/devlib-target/bin/trace-cmd start -e cpu_idle -e cpu_capacity -e cpu_frequency -e sched_switch'\n",
"07:21:34 DEBUG : sudo -- sh -c 'echo TRACE_MARKER_STOP > '\\''/sys/kernel/debug/tracing/trace_marker'\\'''\n",
"07:21:34 DEBUG : sudo -- sh -c '/root/devlib-target/bin/trace-cmd stop'\n"
]
}
],
"source": [
"# Start/Stop a FTrace session\n",
"te.ftrace.start()\n",
"time.sleep(2)\n",
"te.ftrace.stop()"
]
},
{
"cell_type": "code",
"execution_count": 31,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"07:21:37 DEBUG : sudo -- sh -c '/root/devlib-target/bin/trace-cmd extract -o /root/devlib-target/trace.dat'\n",
"07:21:40 DEBUG : /usr/bin/scp -r root@192.168.0.10:/root/devlib-target/trace.dat /home/derkling/Code/schedtest/results/20151110_191720/trace.dat\n"
]
}
],
"source": [
"# Collect and visualuze the collected trace\n",
"trace_file = os.path.join(te.res_dir, 'trace.dat')\n",
"te.ftrace.get_trace(trace_file)\n",
"te.ftrace.view(trace_file)"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 2",
"language": "python",
"name": "python2"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 2
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython2",
"version": "2.7.9"
}
},
"nbformat": 4,
"nbformat_minor": 0
}