| { |
| "cells": [ |
| { |
| "cell_type": "code", |
| "execution_count": 1, |
| "metadata": { |
| "collapsed": false |
| }, |
| "outputs": [], |
| "source": [ |
| "import logging\n", |
| "reload(logging)\n", |
| "log_fmt = '%(asctime)-9s %(levelname)-8s: %(message)s'\n", |
| "logging.basicConfig(format=log_fmt)\n", |
| "\n", |
| "# Change to info once the notebook runs ok\n", |
| "#logging.getLogger().setLevel(logging.DEBUG)" |
| ] |
| }, |
| { |
| "cell_type": "code", |
| "execution_count": 2, |
| "metadata": { |
| "collapsed": false |
| }, |
| "outputs": [ |
| { |
| "name": "stdout", |
| "output_type": "stream", |
| "text": [ |
| "Populating the interactive namespace from numpy and matplotlib\n" |
| ] |
| } |
| ], |
| "source": [ |
| "%pylab inline\n", |
| "\n", |
| "import datetime\n", |
| "import devlib\n", |
| "import os\n", |
| "import json\n", |
| "import pandas as pd\n", |
| "import re\n", |
| "import subprocess\n", |
| "import trappy\n", |
| "from trappy.plotter.Utils import get_trace_event_data\n", |
| "\n", |
| "import matplotlib.gridspec as gridspec\n", |
| "import matplotlib.pyplot as plt\n", |
| "\n", |
| "# Support to access the remote target\n", |
| "#import devlib\n", |
| "#from env import TestEnv\n", |
| "\n", |
| "from executor import Executor" |
| ] |
| }, |
| { |
| "cell_type": "markdown", |
| "metadata": {}, |
| "source": [ |
| "# Target Configuration" |
| ] |
| }, |
| { |
| "cell_type": "code", |
| "execution_count": 3, |
| "metadata": { |
| "collapsed": false |
| }, |
| "outputs": [], |
| "source": [ |
| "# Setup a target configuration\n", |
| "my_target_conf = {\n", |
| " \n", |
| " # Target platform and board\n", |
| " \"platform\" : 'linux',\n", |
| " \"board\" : 'aboard',\n", |
| " \n", |
| " # Target board IP/MAC address\n", |
| " \"host\" : '192.168.0.1',\n", |
| " \n", |
| " # Login credentials\n", |
| " \"username\" : 'root',\n", |
| " \"password\" : 'test0000',\n", |
| "\n", |
| "}" |
| ] |
| }, |
| { |
| "cell_type": "markdown", |
| "metadata": {}, |
| "source": [ |
| "# Tests Configuration" |
| ] |
| }, |
| { |
| "cell_type": "code", |
| "execution_count": 4, |
| "metadata": { |
| "collapsed": false, |
| "scrolled": false |
| }, |
| "outputs": [], |
| "source": [ |
| "my_tests_conf = {\n", |
| "\n", |
| " # Folder where all the results will be collected\n", |
| " \"results_dir\" : \"ExecutorExample\",\n", |
| "\n", |
| " # Platform configurations to test\n", |
| " \"confs\" : [\n", |
| " {\n", |
| " \"tag\" : \"base\",\n", |
| " \"flags\" : \"ftrace\", # Enable FTrace events\n", |
| " \"sched_features\" : \"NO_ENERGY_AWARE\", # Disable EAS\n", |
| " \"cpufreq\" : { # Use PERFORMANCE CpuFreq\n", |
| " \"governor\" : \"performance\",\n", |
| " },\n", |
| " },\n", |
| " {\n", |
| " \"tag\" : \"eas\",\n", |
| " \"flags\" : \"ftrace\", # Enable FTrace events\n", |
| " \"sched_features\" : \"ENERGY_AWARE\", # Enable EAS\n", |
| " \"cpufreq\" : { # Use PERFORMANCE CpuFreq\n", |
| " \"governor\" : \"performance\",\n", |
| " },\n", |
| " },\n", |
| " ],\n", |
| " \n", |
| " # Workloads to run (on each platform configuration)\n", |
| " \"wloads\" : {\n", |
| " # Run hackbench with 1 group using pipes\n", |
| " \"perf\" : {\n", |
| " \"type\" : \"perf_bench\",\n", |
| " \"conf\" : {\n", |
| " \"class\" : \"messaging\",\n", |
| " \"params\" : {\n", |
| " \"group\" : 1,\n", |
| " \"loop\" : 10,\n", |
| " \"pipe\" : True,\n", |
| " \"thread\": True,\n", |
| " }\n", |
| " }\n", |
| " },\n", |
| " # Run a 20% duty-cycle periodic task\n", |
| " \"rta\" : {\n", |
| " \"type\" : \"rt-app\",\n", |
| " \"loadref\" : \"big\",\n", |
| " \"conf\" : {\n", |
| " \"class\" : \"profile\",\n", |
| " \"params\" : {\n", |
| " \"p20\" : {\n", |
| " \"kind\" : \"periodic\",\n", |
| " \"params\" : {\n", |
| " \"duty_cycle_pct\" : 20,\n", |
| " },\n", |
| " },\n", |
| " },\n", |
| " },\n", |
| " },\n", |
| " },\n", |
| " \n", |
| " # Number of iterations for each workload\n", |
| " \"iterations\" : 1,\n", |
| " \n", |
| " # FTrace events to collect for all the tests configuration which have\n", |
| " # the \"ftrace\" flag enabled\n", |
| " \"ftrace\" : {\n", |
| " \"events\" : [\n", |
| " \"sched_switch\",\n", |
| " \"sched_wakeup\",\n", |
| " \"sched_wakeup_new\",\n", |
| " \"cpu_frequency\",\n", |
| " ],\n", |
| " \"buffsize\" : 80 * 1024,\n", |
| " },\n", |
| " \n", |
| " # Tools required by the experiments\n", |
| " \"tools\" : [ 'trace-cmd', 'perf' ],\n", |
| " \n", |
| " # Modules required by these experiments\n", |
| " \"modules\" : [ 'bl', 'cpufreq' ],\n", |
| "\n", |
| "}" |
| ] |
| }, |
| { |
| "cell_type": "markdown", |
| "metadata": {}, |
| "source": [ |
| "# Tests execution" |
| ] |
| }, |
| { |
| "cell_type": "code", |
| "execution_count": 5, |
| "metadata": { |
| "collapsed": false |
| }, |
| "outputs": [ |
| { |
| "name": "stderr", |
| "output_type": "stream", |
| "text": [ |
| "10:22:10 INFO : Target - Loading custom (inline) test configuration\n", |
| "10:22:10 INFO : Target - Using base path: /home/derkling/Code/lisa\n", |
| "10:22:10 INFO : Target - Loading custom (inline) target configuration\n", |
| "10:22:10 INFO : Target - Loading custom (inline) test configuration\n", |
| "10:22:10 INFO : Target - Devlib modules to load: ['bl', 'cpufreq']\n", |
| "10:22:10 INFO : Target - Connecting linux target:\n", |
| "10:22:10 INFO : Target - username : root\n", |
| "10:22:10 INFO : Target - host : 192.168.0.1\n", |
| "10:22:10 INFO : Target - password : test0000\n", |
| "10:22:15 INFO : Target - Initializing target workdir:\n", |
| "10:22:15 INFO : Target - /root/devlib-target\n", |
| "10:22:21 INFO : Target - Topology:\n", |
| "10:22:21 INFO : Target - [[0, 3, 4, 5], [1, 2]]\n", |
| "10:22:25 INFO : FTrace - Enabled tracepoints:\n", |
| "10:22:25 INFO : FTrace - sched_switch\n", |
| "10:22:25 INFO : FTrace - sched_wakeup\n", |
| "10:22:25 INFO : FTrace - sched_wakeup_new\n", |
| "10:22:25 INFO : FTrace - cpu_frequency\n", |
| "10:22:25 INFO : TestEnv - Set results folder to:\n", |
| "10:22:25 INFO : TestEnv - /home/derkling/Code/lisa/results/ExecutorExample\n", |
| "10:22:25 INFO : TestEnv - Experiment results available also in:\n", |
| "10:22:25 INFO : TestEnv - /home/derkling/Code/lisa/results_latest\n", |
| "10:22:25 INFO : \n", |
| "10:22:25 INFO : ################################################################################\n", |
| "10:22:25 INFO : Executor - Experiments configuration\n", |
| "10:22:25 INFO : ################################################################################\n", |
| "10:22:25 INFO : Executor - Configured to run:\n", |
| "10:22:25 INFO : Executor - 2 targt configurations:\n", |
| "10:22:25 INFO : Executor - base, eas\n", |
| "10:22:25 INFO : Executor - 2 workloads (1 iterations each)\n", |
| "10:22:25 INFO : Executor - rta, perf\n", |
| "10:22:25 INFO : Executor - Total: 4 experiments\n", |
| "10:22:25 INFO : Executor - Results will be collected under:\n", |
| "10:22:25 INFO : Executor - /home/derkling/Code/lisa/results/ExecutorExample\n" |
| ] |
| } |
| ], |
| "source": [ |
| "executor = Executor(my_target_conf, my_tests_conf)" |
| ] |
| }, |
| { |
| "cell_type": "code", |
| "execution_count": 6, |
| "metadata": { |
| "collapsed": false |
| }, |
| "outputs": [ |
| { |
| "name": "stderr", |
| "output_type": "stream", |
| "text": [ |
| "10:22:25 INFO : \n", |
| "10:22:25 INFO : ################################################################################\n", |
| "10:22:25 INFO : Executor - Experiments execution\n", |
| "10:22:25 INFO : ################################################################################\n", |
| "10:22:25 INFO : \n", |
| "10:22:25 INFO : ================================================================================\n", |
| "10:22:25 INFO : TargetConfig - configuring target for [base] experiments\n", |
| "10:22:27 INFO : SchedFeatures - Set scheduler feature: NO_ENERGY_AWARE\n", |
| "10:22:27 INFO : CPUFreq - Configuring all CPUs to use [performance] governor\n", |
| "10:22:27 INFO : WlGen - Setup new workload rta\n", |
| "10:22:27 INFO : RTApp - Workload duration defined by longest task\n", |
| "10:22:27 INFO : RTApp - Default policy: SCHED_OTHER\n", |
| "10:22:27 INFO : RTApp - ------------------------\n", |
| "10:22:27 INFO : RTApp - task [task_p20], sched: using default policy\n", |
| "10:22:27 INFO : RTApp - | calibration CPU: 1\n", |
| "10:22:27 INFO : RTApp - | loops count: 1\n", |
| "10:22:27 INFO : RTApp - + phase_000001: duration 1.000000 [s] (10 loops)\n", |
| "10:22:27 INFO : RTApp - | period 100000 [us], duty_cycle 20 %\n", |
| "10:22:27 INFO : RTApp - | run_time 20000 [us], sleep_time 80000 [us]\n", |
| "10:22:28 INFO : ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n", |
| "10:22:28 INFO : Executor - Experiment 1/4, [base:rta] 1/1\n", |
| "10:22:28 WARNING : Executor - FTrace events collection enabled\n", |
| "10:22:34 INFO : WlGen - Workload execution START:\n", |
| "10:22:34 INFO : WlGen - /root/devlib-target/bin/rt-app /root/devlib-target/run_dir/rta_00.json\n", |
| "10:22:43 INFO : Executor - Collected FTrace binary trace:\n", |
| "10:22:43 INFO : Executor - <res_dir>/rtapp:base:rta/1/trace.dat\n", |
| "10:22:43 INFO : Executor - Collected FTrace function profiling:\n", |
| "10:22:43 INFO : Executor - <res_dir>/rtapp:base:rta/1/trace_stat.json\n", |
| "10:22:43 INFO : WlGen - Setup new workload perf\n", |
| "10:22:43 INFO : ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n", |
| "10:22:43 INFO : Executor - Experiment 2/4, [base:perf] 1/1\n", |
| "10:22:43 WARNING : Executor - FTrace events collection enabled\n", |
| "10:22:49 INFO : WlGen - Workload execution START:\n", |
| "10:22:49 INFO : WlGen - /root/devlib-target/bin/perf bench sched messaging --pipe --thread --group 1 --loop 10\n", |
| "10:22:50 INFO : PerfBench - Completion time: 0.088000, Performance 11.363636\n", |
| "10:22:57 INFO : Executor - Collected FTrace binary trace:\n", |
| "10:22:57 INFO : Executor - <res_dir>/perf_bench_messaging:base:perf/1/trace.dat\n", |
| "10:22:57 INFO : Executor - Collected FTrace function profiling:\n", |
| "10:22:57 INFO : Executor - <res_dir>/perf_bench_messaging:base:perf/1/trace_stat.json\n", |
| "10:22:57 INFO : \n", |
| "10:22:57 INFO : ================================================================================\n", |
| "10:22:57 INFO : TargetConfig - configuring target for [eas] experiments\n", |
| "10:22:59 INFO : SchedFeatures - Set scheduler feature: ENERGY_AWARE\n", |
| "10:22:59 INFO : CPUFreq - Configuring all CPUs to use [performance] governor\n", |
| "10:22:59 INFO : WlGen - Setup new workload rta\n", |
| "10:22:59 INFO : RTApp - Workload duration defined by longest task\n", |
| "10:22:59 INFO : RTApp - Default policy: SCHED_OTHER\n", |
| "10:22:59 INFO : RTApp - ------------------------\n", |
| "10:22:59 INFO : RTApp - task [task_p20], sched: using default policy\n", |
| "10:22:59 INFO : RTApp - | calibration CPU: 1\n", |
| "10:22:59 INFO : RTApp - | loops count: 1\n", |
| "10:22:59 INFO : RTApp - + phase_000001: duration 1.000000 [s] (10 loops)\n", |
| "10:22:59 INFO : RTApp - | period 100000 [us], duty_cycle 20 %\n", |
| "10:22:59 INFO : RTApp - | run_time 20000 [us], sleep_time 80000 [us]\n", |
| "10:23:00 INFO : ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n", |
| "10:23:00 INFO : Executor - Experiment 3/4, [eas:rta] 1/1\n", |
| "10:23:00 WARNING : Executor - FTrace events collection enabled\n", |
| "10:23:06 INFO : WlGen - Workload execution START:\n", |
| "10:23:06 INFO : WlGen - /root/devlib-target/bin/rt-app /root/devlib-target/run_dir/rta_00.json\n", |
| "10:23:16 INFO : Executor - Collected FTrace binary trace:\n", |
| "10:23:16 INFO : Executor - <res_dir>/rtapp:eas:rta/1/trace.dat\n", |
| "10:23:16 INFO : Executor - Collected FTrace function profiling:\n", |
| "10:23:16 INFO : Executor - <res_dir>/rtapp:eas:rta/1/trace_stat.json\n", |
| "10:23:16 INFO : WlGen - Setup new workload perf\n", |
| "10:23:17 INFO : ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n", |
| "10:23:17 INFO : Executor - Experiment 4/4, [eas:perf] 1/1\n", |
| "10:23:17 WARNING : Executor - FTrace events collection enabled\n", |
| "10:23:22 INFO : WlGen - Workload execution START:\n", |
| "10:23:22 INFO : WlGen - /root/devlib-target/bin/perf bench sched messaging --pipe --thread --group 1 --loop 10\n", |
| "10:23:23 INFO : PerfBench - Completion time: 0.119000, Performance 8.403361\n", |
| "10:23:31 INFO : Executor - Collected FTrace binary trace:\n", |
| "10:23:31 INFO : Executor - <res_dir>/perf_bench_messaging:eas:perf/1/trace.dat\n", |
| "10:23:31 INFO : Executor - Collected FTrace function profiling:\n", |
| "10:23:31 INFO : Executor - <res_dir>/perf_bench_messaging:eas:perf/1/trace_stat.json\n", |
| "10:23:31 INFO : \n", |
| "10:23:31 INFO : ################################################################################\n", |
| "10:23:31 INFO : Executor - Experiments execution completed\n", |
| "10:23:31 INFO : ################################################################################\n", |
| "10:23:31 INFO : Executor - Results available in:\n", |
| "10:23:31 INFO : Executor - /home/derkling/Code/lisa/results/ExecutorExample\n" |
| ] |
| } |
| ], |
| "source": [ |
| "executor.run()" |
| ] |
| }, |
| { |
| "cell_type": "code", |
| "execution_count": 7, |
| "metadata": { |
| "collapsed": false |
| }, |
| "outputs": [ |
| { |
| "name": "stdout", |
| "output_type": "stream", |
| "text": [ |
| "\u001b[01;34m/home/derkling/Code/lisa/results/ExecutorExample\u001b[00m\r\n", |
| "├── \u001b[01;34mperf_bench_messaging:base:perf\u001b[00m\r\n", |
| "│ ├── \u001b[01;34m1\u001b[00m\r\n", |
| "│ │ ├── output.log\r\n", |
| "│ │ ├── performance.json\r\n", |
| "│ │ └── trace.dat\r\n", |
| "│ ├── kernel.config\r\n", |
| "│ ├── kernel.version\r\n", |
| "│ └── platform.json\r\n", |
| "├── \u001b[01;34mperf_bench_messaging:eas:perf\u001b[00m\r\n", |
| "│ ├── \u001b[01;34m1\u001b[00m\r\n", |
| "│ │ ├── output.log\r\n", |
| "│ │ ├── performance.json\r\n", |
| "│ │ └── trace.dat\r\n", |
| "│ ├── kernel.config\r\n", |
| "│ ├── kernel.version\r\n", |
| "│ └── platform.json\r\n", |
| "├── \u001b[01;34mrtapp:base:rta\u001b[00m\r\n", |
| "│ ├── \u001b[01;34m1\u001b[00m\r\n", |
| "│ │ ├── output.log\r\n", |
| "│ │ ├── rta_00.json\r\n", |
| "│ │ ├── rt-app-task_p20-0.log\r\n", |
| "│ │ └── trace.dat\r\n", |
| "│ ├── kernel.config\r\n", |
| "│ ├── kernel.version\r\n", |
| "│ └── platform.json\r\n", |
| "└── \u001b[01;34mrtapp:eas:rta\u001b[00m\r\n", |
| " ├── \u001b[01;34m1\u001b[00m\r\n", |
| " │ ├── output.log\r\n", |
| " │ ├── rta_00.json\r\n", |
| " │ ├── rt-app-task_p20-0.log\r\n", |
| " │ └── trace.dat\r\n", |
| " ├── kernel.config\r\n", |
| " ├── kernel.version\r\n", |
| " └── platform.json\r\n", |
| "\r\n", |
| "8 directories, 26 files\r\n" |
| ] |
| } |
| ], |
| "source": [ |
| "!tree {executor.te.res_dir}" |
| ] |
| } |
| ], |
| "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 |
| } |