| { |
| "cells": [ |
| { |
| "cell_type": "code", |
| "execution_count": 1, |
| "metadata": { |
| "collapsed": false |
| }, |
| "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 following lines to enabled CGroups verbose logging\n", |
| "#logging.getLogger('cgroups').setLevel(logging.DEBUG)\n", |
| "#logging.getLogger('cgroups.cpuset').setLevel(logging.DEBUG)" |
| ] |
| }, |
| { |
| "cell_type": "code", |
| "execution_count": 2, |
| "metadata": { |
| "collapsed": false |
| }, |
| "outputs": [], |
| "source": [ |
| "import json\n", |
| "import operator\n", |
| "\n", |
| "import devlib\n", |
| "import trappy\n", |
| "import bart\n", |
| "\n", |
| "from bart.sched.SchedMultiAssert import SchedMultiAssert\n", |
| "from wlgen import RTA" |
| ] |
| }, |
| { |
| "cell_type": "markdown", |
| "metadata": {}, |
| "source": [ |
| "## Global configuration" |
| ] |
| }, |
| { |
| "cell_type": "code", |
| "execution_count": 3, |
| "metadata": { |
| "collapsed": true |
| }, |
| "outputs": [], |
| "source": [ |
| "# Host side results folder\n", |
| "RESULTS_DIR = '/tmp/schedtest'\n", |
| "\n", |
| "# Taerget side temporary folder\n", |
| "TARGET_DIR = '/root/schedtest'\n", |
| "\n", |
| "# List of tools to install on the target system\n", |
| "TOOLS = [\"rt-app\", \"trace-cmd\", \"taskset\", \"cgroup_run_into.sh\"]\n", |
| "\n", |
| "# List of modules to enable\n", |
| "MODULES = ['cgroups', 'bl']" |
| ] |
| }, |
| { |
| "cell_type": "markdown", |
| "metadata": {}, |
| "source": [ |
| "## Target connection" |
| ] |
| }, |
| { |
| "cell_type": "code", |
| "execution_count": 4, |
| "metadata": { |
| "collapsed": false, |
| "scrolled": true |
| }, |
| "outputs": [ |
| { |
| "name": "stderr", |
| "output_type": "stream", |
| "text": [ |
| "06:18:54 INFO : Target - Using base path: /home/derkling/Code/schedtest\n", |
| "06:18:54 INFO : Target - Connecting linux target with: {'username': 'root', 'host': '192.168.0.10', 'password': ''}\n", |
| "06:19:00 INFO : Available controllers: ['cpuset', 'cpu', 'memory', 'hugetlb']\n", |
| "06:19:01 INFO : Controller cpuset mounted under: /sys/fs/cgroup/devlib_cpuset\n", |
| "06:19:04 INFO : Controller cpu mounted under: /sys/fs/cgroup/devlib_cpu\n", |
| "06:19:06 INFO : Controller memory mounted under: /sys/fs/cgroup/devlib_memory\n", |
| "06:19:08 INFO : Controller hugetlb mounted under: /sys/fs/cgroup/devlib_hugetlb\n", |
| "06:19:08 INFO : Target - Initializing target workdir [/root/devlib-target]\n", |
| "06:19:12 INFO : Target topology: [[0, 3, 4, 5], [1, 2]]\n", |
| "06:19:14 INFO : FTrace - Enabled events:\n", |
| "06:19:14 INFO : FTrace - ['sched_switch']\n", |
| "06:19:14 INFO : EnergyMeter - HWMON module not enabled\n", |
| "06:19:14 WARNING : EnergyMeter - Energy sampling disabled by configuration\n", |
| "06:19:14 INFO : Loading RTApp calibration from configuration file...\n", |
| "06:19:14 INFO : Using RT-App calibration values: {0: 363, 1: 138, 2: 139, 3: 352, 4: 353, 5: 361}\n", |
| "06:19:14 INFO : Connected to arm64 target\n" |
| ] |
| } |
| ], |
| "source": [ |
| "from env import TestEnv\n", |
| "\n", |
| "my_target_conf = {\n", |
| " \"platform\" : \"linux\",\n", |
| " \"board\" : \"juno\",\n", |
| " \"host\" : \"192.168.0.10\",\n", |
| " \"username\" : \"root\",\n", |
| " \"password\" : \"\",\n", |
| " \"rtapp-calib\" : {\n", |
| " '0': 363, '1': 138, '2': 139, '3': 352, '4': 353, '5': 361\n", |
| " },\n", |
| "}\n", |
| "\n", |
| "# Setup the required Test Environment supports\n", |
| "my_tests_conf = {\n", |
| " # list of additional devlib modules to install \n", |
| " \"modules\" : ['cgroups', 'bl', 'cpufreq'],\n", |
| " # list of additional binary tools to install\n", |
| " \"tools\" : ['rt-app', 'trace-cmd', 'cgroup_run_into.sh'],\n", |
| " \"ftrace\" : {\n", |
| " \"events\" : [\n", |
| " \"sched_switch\"\n", |
| " ],\n", |
| " \"buffsize\" : 10240\n", |
| " }\n", |
| "}\n", |
| "\n", |
| "env = TestEnv(target_conf=my_target_conf, test_conf=my_tests_conf)\n", |
| "t = env.target\n", |
| "\n", |
| "# Report target connection\n", |
| "logging.info('Connected to %s target', t.abi)" |
| ] |
| }, |
| { |
| "cell_type": "markdown", |
| "metadata": {}, |
| "source": [ |
| "## List available Controller" |
| ] |
| }, |
| { |
| "cell_type": "code", |
| "execution_count": 5, |
| "metadata": { |
| "collapsed": false, |
| "scrolled": true |
| }, |
| "outputs": [ |
| { |
| "name": "stderr", |
| "output_type": "stream", |
| "text": [ |
| "06:19:14 INFO : Controller: cpuset (hierarchy id: 1) has 1 cgroups\n", |
| "06:19:14 INFO : Controller: cpu (hierarchy id: 2) has 1 cgroups\n", |
| "06:19:14 INFO : Controller: memory (hierarchy id: 3) has 1 cgroups\n", |
| "06:19:14 INFO : Controller: hugetlb (hierarchy id: 4) has 1 cgroups\n" |
| ] |
| } |
| ], |
| "source": [ |
| "ssys = t.cgroups.list_subsystems()\n", |
| "for (n,h,g,e) in ssys:\n", |
| " logging.info('Controller: %10s (hierarchy id: %d) has %d cgroups',\n", |
| " n, h, g)" |
| ] |
| }, |
| { |
| "cell_type": "markdown", |
| "metadata": {}, |
| "source": [ |
| "## Example of CPUSET controller usage" |
| ] |
| }, |
| { |
| "cell_type": "code", |
| "execution_count": 6, |
| "metadata": { |
| "collapsed": false |
| }, |
| "outputs": [], |
| "source": [ |
| "# Get a reference to the CPUSet controller\n", |
| "cpuset = t.cgroups.controller('cpuset')" |
| ] |
| }, |
| { |
| "cell_type": "code", |
| "execution_count": 7, |
| "metadata": { |
| "collapsed": false |
| }, |
| "outputs": [ |
| { |
| "name": "stderr", |
| "output_type": "stream", |
| "text": [ |
| "06:19:15 INFO : Existing CGropups:\n", |
| "06:19:15 INFO : /\n" |
| ] |
| } |
| ], |
| "source": [ |
| "# Get the list of current configured CGroups for that controller\n", |
| "cgroups = cpuset.list_all()\n", |
| "logging.info('Existing CGropups:')\n", |
| "for cg in cgroups:\n", |
| " logging.info(' %s', cg)" |
| ] |
| }, |
| { |
| "cell_type": "code", |
| "execution_count": 8, |
| "metadata": { |
| "collapsed": false |
| }, |
| "outputs": [ |
| { |
| "name": "stderr", |
| "output_type": "stream", |
| "text": [ |
| "06:19:15 INFO : cpuset:/ cpus: 0-5\r\n" |
| ] |
| } |
| ], |
| "source": [ |
| "# Dump the configuraiton of each controller\n", |
| "for cgname in cgroups:\n", |
| " cgroup = cpuset.cgroup(cgname)\n", |
| " attrs = cgroup.get()\n", |
| " cpus = attrs['cpus']\n", |
| " logging.info('%s:%-15s cpus: %s', cpuset.kind, cgroup.name, cpus)\n", |
| " " |
| ] |
| }, |
| { |
| "cell_type": "code", |
| "execution_count": 9, |
| "metadata": { |
| "collapsed": true |
| }, |
| "outputs": [], |
| "source": [ |
| "# Create a LITTLE partition\n", |
| "cpuset_littles = cpuset.cgroup('/LITTLE')" |
| ] |
| }, |
| { |
| "cell_type": "code", |
| "execution_count": 10, |
| "metadata": { |
| "collapsed": false |
| }, |
| "outputs": [ |
| { |
| "name": "stdout", |
| "output_type": "stream", |
| "text": [ |
| "LITTLE:\n", |
| "{\n", |
| " \"cpu_exclusive\": \"0\\r\", \n", |
| " \"memory_spread_page\": \"0\\r\", \n", |
| " \"sched_load_balance\": \"1\\r\", \n", |
| " \"cpus\": \"\\r\", \n", |
| " \"effective_mems\": \"\\r\", \n", |
| " \"mem_hardwall\": \"0\\r\", \n", |
| " \"mem_exclusive\": \"0\\r\", \n", |
| " \"memory_pressure\": \"0\\r\", \n", |
| " \"effective_cpus\": \"\\r\", \n", |
| " \"mems\": \"\\r\", \n", |
| " \"sched_relax_domain_level\": \"-1\\r\", \n", |
| " \"memory_migrate\": \"0\\r\", \n", |
| " \"memory_spread_slab\": \"0\\r\"\n", |
| "}\n" |
| ] |
| } |
| ], |
| "source": [ |
| "# Check the attributes available for this control group\n", |
| "print \"LITTLE:\\n\", json.dumps(cpuset_littles.get(), indent=4)" |
| ] |
| }, |
| { |
| "cell_type": "code", |
| "execution_count": 11, |
| "metadata": { |
| "collapsed": false |
| }, |
| "outputs": [ |
| { |
| "name": "stdout", |
| "output_type": "stream", |
| "text": [ |
| "LITTLE:\n", |
| "{\n", |
| " \"cpu_exclusive\": \"0\\r\", \n", |
| " \"memory_spread_page\": \"0\\r\", \n", |
| " \"sched_load_balance\": \"1\\r\", \n", |
| " \"cpus\": \"0,3-5\\r\", \n", |
| " \"effective_mems\": \"0\\r\", \n", |
| " \"mem_hardwall\": \"0\\r\", \n", |
| " \"mem_exclusive\": \"0\\r\", \n", |
| " \"memory_pressure\": \"0\\r\", \n", |
| " \"effective_cpus\": \"0,3-5\\r\", \n", |
| " \"mems\": \"0\\r\", \n", |
| " \"sched_relax_domain_level\": \"-1\\r\", \n", |
| " \"memory_migrate\": \"0\\r\", \n", |
| " \"memory_spread_slab\": \"0\\r\"\n", |
| "}\n" |
| ] |
| } |
| ], |
| "source": [ |
| "# Tune CPUs and MEMs attributes\n", |
| "# they must be initialize for the group to be usable\n", |
| "cpuset_littles.set(cpus=t.bl.littles, mems=0)\n", |
| "print \"LITTLE:\\n\", json.dumps(cpuset_littles.get(), indent=4)" |
| ] |
| }, |
| { |
| "cell_type": "code", |
| "execution_count": 12, |
| "metadata": { |
| "collapsed": false |
| }, |
| "outputs": [ |
| { |
| "name": "stderr", |
| "output_type": "stream", |
| "text": [ |
| "06:19:18 INFO : Setup new workload simple\n", |
| "06:19:18 INFO : Workload duration defined by longest task\n", |
| "06:19:18 INFO : Default policy: SCHED_OTHER\n", |
| "06:19:18 INFO : ------------------------\n", |
| "06:19:18 INFO : task [task0], sched: using default policy\n", |
| "06:19:18 INFO : | loops count: 1\n", |
| "06:19:18 INFO : + phase_000001: duration 5.000000 [s] (50 loops)\n", |
| "06:19:18 INFO : | period 100000 [us], duty_cycle 80 %\n", |
| "06:19:18 INFO : | run_time 80000 [us], sleep_time 20000 [us]\n", |
| "06:19:18 INFO : ------------------------\n", |
| "06:19:18 INFO : task [task1], sched: using default policy\n", |
| "06:19:18 INFO : | loops count: 1\n", |
| "06:19:18 INFO : + phase_000001: duration 5.000000 [s] (50 loops)\n", |
| "06:19:18 INFO : | period 100000 [us], duty_cycle 80 %\n", |
| "06:19:18 INFO : | run_time 80000 [us], sleep_time 20000 [us]\n", |
| "06:19:18 INFO : ------------------------\n", |
| "06:19:18 INFO : task [task2], sched: using default policy\n", |
| "06:19:18 INFO : | loops count: 1\n", |
| "06:19:18 INFO : + phase_000001: duration 5.000000 [s] (50 loops)\n", |
| "06:19:18 INFO : | period 100000 [us], duty_cycle 80 %\n", |
| "06:19:18 INFO : | run_time 80000 [us], sleep_time 20000 [us]\n", |
| "06:19:18 INFO : ------------------------\n", |
| "06:19:18 INFO : task [task3], sched: using default policy\n", |
| "06:19:18 INFO : | loops count: 1\n", |
| "06:19:18 INFO : + phase_000001: duration 5.000000 [s] (50 loops)\n", |
| "06:19:18 INFO : | period 100000 [us], duty_cycle 80 %\n", |
| "06:19:18 INFO : | run_time 80000 [us], sleep_time 20000 [us]\n", |
| "06:19:18 INFO : ------------------------\n", |
| "06:19:18 INFO : task [task4], sched: using default policy\n", |
| "06:19:18 INFO : | loops count: 1\n", |
| "06:19:18 INFO : + phase_000001: duration 5.000000 [s] (50 loops)\n", |
| "06:19:18 INFO : | period 100000 [us], duty_cycle 80 %\n", |
| "06:19:18 INFO : | run_time 80000 [us], sleep_time 20000 [us]\n", |
| "06:19:18 INFO : ------------------------\n", |
| "06:19:18 INFO : task [task5], sched: using default policy\n", |
| "06:19:18 INFO : | loops count: 1\n", |
| "06:19:18 INFO : + phase_000001: duration 5.000000 [s] (50 loops)\n", |
| "06:19:18 INFO : | period 100000 [us], duty_cycle 80 %\n", |
| "06:19:18 INFO : | run_time 80000 [us], sleep_time 20000 [us]\n" |
| ] |
| } |
| ], |
| "source": [ |
| "# Define a periodic big (80%) task\n", |
| "task = RTA.periodic(\n", |
| " period_ms=100,\n", |
| " duty_cycle_pct=80,\n", |
| " duration_s=5)\n", |
| "\n", |
| "# Create one task per each CPU in the target\n", |
| "tasks={}\n", |
| "for tid in enumerate(t.core_names):\n", |
| " tasks['task{}'.format(tid[0])] = task\n", |
| "\n", |
| "# Configure RTA to run all these tasks\n", |
| "rtapp = RTA(t, 'simple', calibration=env.calibration())\n", |
| "rtapp.conf(kind='profile', params=tasks, run_dir=TARGET_DIR);" |
| ] |
| }, |
| { |
| "cell_type": "code", |
| "execution_count": 13, |
| "metadata": { |
| "collapsed": false |
| }, |
| "outputs": [ |
| { |
| "name": "stderr", |
| "output_type": "stream", |
| "text": [ |
| "06:19:24 INFO : Executor [start]: /root/devlib-target/bin/cgroup_run_into.sh /LITTLE '/root/devlib-target/bin/rt-app /root/schedtest/simple_00.json'\n", |
| "06:19:42 INFO : Pulling trace file into [.//simple_00.dat]...\n", |
| "06:19:45 INFO : Executor [end]: /root/devlib-target/bin/cgroup_run_into.sh /LITTLE '/root/devlib-target/bin/rt-app /root/schedtest/simple_00.json'\n" |
| ] |
| } |
| ], |
| "source": [ |
| "# Test execution of all these tasks into the LITTLE cluster\n", |
| "trace = rtapp.run(ftrace=env.ftrace, cgroup=cpuset_littles.name)" |
| ] |
| }, |
| { |
| "cell_type": "code", |
| "execution_count": 14, |
| "metadata": { |
| "collapsed": false, |
| "scrolled": false |
| }, |
| "outputs": [ |
| { |
| "data": { |
| "text/html": [ |
| "<style>\n", |
| "/*\n", |
| "\n", |
| " * Copyright 2015-2015 ARM Limited\n", |
| "\n", |
| " *\n", |
| "\n", |
| " * Licensed under the Apache License, Version 2.0 (the \"License\");\n", |
| "\n", |
| " * you may not use this file except in compliance with the License.\n", |
| "\n", |
| " * You may obtain a copy of the License at\n", |
| "\n", |
| " *\n", |
| "\n", |
| " * http://www.apache.org/licenses/LICENSE-2.0\n", |
| "\n", |
| " *\n", |
| "\n", |
| " * Unless required by applicable law or agreed to in writing, software\n", |
| "\n", |
| " * distributed under the License is distributed on an \"AS IS\" BASIS,\n", |
| "\n", |
| " * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n", |
| "\n", |
| " * See the License for the specific language governing permissions and\n", |
| "\n", |
| " * limitations under the License.\n", |
| "\n", |
| " */\n", |
| "\n", |
| "\n", |
| "\n", |
| ".d3-tip {\n", |
| "\n", |
| " line-height: 1;\n", |
| "\n", |
| " padding: 12px;\n", |
| "\n", |
| " background: rgba(0, 0, 0, 0.6);\n", |
| "\n", |
| " color: #fff;\n", |
| "\n", |
| " border-radius: 2px;\n", |
| "\n", |
| " position: absolute !important;\n", |
| "\n", |
| " z-index: 99999;\n", |
| "\n", |
| "}\n", |
| "\n", |
| "\n", |
| "\n", |
| ".d3-tip:after {\n", |
| "\n", |
| " box-sizing: border-box;\n", |
| "\n", |
| " pointer-events: none;\n", |
| "\n", |
| " display: inline;\n", |
| "\n", |
| " font-size: 10px;\n", |
| "\n", |
| " width: 100%;\n", |
| "\n", |
| " line-height: 1;\n", |
| "\n", |
| " color: rgba(0, 0, 0, 0.6);\n", |
| "\n", |
| " content: \"\\25BC\";\n", |
| "\n", |
| " position: absolute !important;\n", |
| "\n", |
| " z-index: 99999;\n", |
| "\n", |
| " text-align: center;\n", |
| "\n", |
| "}\n", |
| "\n", |
| "\n", |
| "\n", |
| ".d3-tip.n:after {\n", |
| "\n", |
| " margin: -1px 0 0 0;\n", |
| "\n", |
| " top: 100%;\n", |
| "\n", |
| " left: 0;\n", |
| "\n", |
| "}\n", |
| "\n", |
| "\n", |
| "\n", |
| ".contextRect {\n", |
| "\n", |
| " fill: lightgray;\n", |
| "\n", |
| " fill-opacity: 0.5;\n", |
| "\n", |
| " stroke: black;\n", |
| "\n", |
| " stroke-width: 1;\n", |
| "\n", |
| " stroke-opacity: 1;\n", |
| "\n", |
| " pointer-events: none;\n", |
| "\n", |
| " shape-rendering: crispEdges;\n", |
| "\n", |
| "}\n", |
| "\n", |
| "\n", |
| "\n", |
| ".chart {\n", |
| "\n", |
| " shape-rendering: crispEdges;\n", |
| "\n", |
| "}\n", |
| "\n", |
| "\n", |
| "\n", |
| ".mini text {\n", |
| "\n", |
| " font: 9px sans-serif;\n", |
| "\n", |
| "}\n", |
| "\n", |
| "\n", |
| "\n", |
| ".main text {\n", |
| "\n", |
| " font: 12px sans-serif;\n", |
| "\n", |
| "}\n", |
| "\n", |
| "\n", |
| "\n", |
| ".axis line, .axis path {\n", |
| "\n", |
| " stroke: black;\n", |
| "\n", |
| "}\n", |
| "\n", |
| "\n", |
| "\n", |
| ".miniItem {\n", |
| "\n", |
| " stroke-width: 8;\n", |
| "\n", |
| "}\n", |
| "\n", |
| "\n", |
| "\n", |
| ".brush .extent {\n", |
| "\n", |
| "\n", |
| "\n", |
| " stroke: #000;\n", |
| "\n", |
| " fill-opacity: .125;\n", |
| "\n", |
| " shape-rendering: crispEdges;\n", |
| "\n", |
| "}\n", |
| "\n", |
| "</style>\n", |
| "<div id=\"fig_aa3f549e4237424ca60041520d2d8cbe\" class=\"eventplot\">\n", |
| " <script>\n", |
| " var req = require.config( {\n", |
| "\n", |
| " paths: {\n", |
| "\n", |
| " \"EventPlot\": '/nbextensions/plotter_scripts/EventPlot/EventPlot',\n", |
| " \"d3-tip\": '/nbextensions/plotter_scripts/EventPlot/d3.tip.v0.6.3',\n", |
| " \"d3-plotter\": '/nbextensions/plotter_scripts/EventPlot/d3.v3.min'\n", |
| " },\n", |
| " shim: {\n", |
| " \"d3-plotter\" : {\n", |
| " \"exports\" : \"d3\"\n", |
| " },\n", |
| " \"d3-tip\": [\"d3-plotter\"],\n", |
| " \"EventPlot\": {\n", |
| "\n", |
| " \"deps\": [\"d3-tip\", \"d3-plotter\" ],\n", |
| " \"exports\": \"EventPlot\"\n", |
| " }\n", |
| " }\n", |
| " });\n", |
| " req([\"require\", \"EventPlot\"], function() {\n", |
| " EventPlot.generate('fig_aa3f549e4237424ca60041520d2d8cbe', '/nbextensions/');\n", |
| " });\n", |
| " </script>\n", |
| " </div>" |
| ], |
| "text/plain": [ |
| "<IPython.core.display.HTML object>" |
| ] |
| }, |
| "metadata": {}, |
| "output_type": "display_data" |
| } |
| ], |
| "source": [ |
| "# Check tasks residency on little clsuter\n", |
| "trappy.plotter.plot_trace(trace)" |
| ] |
| }, |
| { |
| "cell_type": "code", |
| "execution_count": 15, |
| "metadata": { |
| "collapsed": false |
| }, |
| "outputs": [ |
| { |
| "name": "stdout", |
| "output_type": "stream", |
| "text": [ |
| "{\n", |
| " \"1256\": {\n", |
| " \"residency\": 100.0, \n", |
| " \"task_name\": \"rt-app\"\n", |
| " }, \n", |
| " \"1257\": {\n", |
| " \"residency\": 100.0, \n", |
| " \"task_name\": \"rt-app\"\n", |
| " }, \n", |
| " \"1258\": {\n", |
| " \"residency\": 100.00000000000001, \n", |
| " \"task_name\": \"rt-app\"\n", |
| " }, \n", |
| " \"1259\": {\n", |
| " \"residency\": 100.00000000000001, \n", |
| " \"task_name\": \"rt-app\"\n", |
| " }, \n", |
| " \"1260\": {\n", |
| " \"residency\": 100.0, \n", |
| " \"task_name\": \"rt-app\"\n", |
| " }, \n", |
| " \"1261\": {\n", |
| " \"residency\": 100.00000000000001, \n", |
| " \"task_name\": \"rt-app\"\n", |
| " }\n", |
| "}\n" |
| ] |
| } |
| ], |
| "source": [ |
| "# Compute and visualize tasks residencies on LITTLE clusterh CPUs\n", |
| "s = SchedMultiAssert(trappy.Run(trace), env.topology, execnames=\"task\")\n", |
| "residencies = s.getResidency('cluster', env.target.bl.littles, percent=True)\n", |
| "print json.dumps(residencies, indent=4)" |
| ] |
| }, |
| { |
| "cell_type": "code", |
| "execution_count": 16, |
| "metadata": { |
| "collapsed": false |
| }, |
| "outputs": [ |
| { |
| "data": { |
| "text/plain": [ |
| "True" |
| ] |
| }, |
| "execution_count": 16, |
| "metadata": {}, |
| "output_type": "execute_result" |
| } |
| ], |
| "source": [ |
| "# Assert that ALL tasks have always executed only on LITTLE cluster\n", |
| "s.assertResidency('cluster', env.target.bl.littles,\n", |
| " 99.9, operator.ge, percent=True, rank=len(residencies))" |
| ] |
| }, |
| { |
| "cell_type": "markdown", |
| "metadata": { |
| "collapsed": true |
| }, |
| "source": [ |
| "## Example of CPU controller usage" |
| ] |
| }, |
| { |
| "cell_type": "code", |
| "execution_count": 17, |
| "metadata": { |
| "collapsed": true |
| }, |
| "outputs": [], |
| "source": [ |
| "# Get a reference to the CPU controller\n", |
| "cpu = t.cgroups.controller('cpu')" |
| ] |
| }, |
| { |
| "cell_type": "code", |
| "execution_count": 18, |
| "metadata": { |
| "collapsed": true |
| }, |
| "outputs": [], |
| "source": [ |
| "# Create a big partition on that CPUS\n", |
| "cpu_littles = cpu.cgroup('/LITTLE')" |
| ] |
| }, |
| { |
| "cell_type": "code", |
| "execution_count": 19, |
| "metadata": { |
| "collapsed": false |
| }, |
| "outputs": [ |
| { |
| "name": "stdout", |
| "output_type": "stream", |
| "text": [ |
| "LITTLE:\n", |
| "{\n", |
| " \"stat\": \"throttled_time 0\\r\", \n", |
| " \"rt_runtime_us\": \"0\\r\", \n", |
| " \"shares\": \"1024\\r\", \n", |
| " \"cfs_quota_us\": \"-1\\r\", \n", |
| " \"rt_period_us\": \"1000000\\r\", \n", |
| " \"cfs_period_us\": \"100000\\r\"\n", |
| "}\n" |
| ] |
| } |
| ], |
| "source": [ |
| "# Check the attributes available for this control group\n", |
| "print \"LITTLE:\\n\", json.dumps(cpu_littles.get(), indent=4)" |
| ] |
| }, |
| { |
| "cell_type": "code", |
| "execution_count": 20, |
| "metadata": { |
| "collapsed": false |
| }, |
| "outputs": [ |
| { |
| "name": "stdout", |
| "output_type": "stream", |
| "text": [ |
| "LITTLE:\n", |
| "{\n", |
| " \"stat\": \"throttled_time 0\\r\", \n", |
| " \"rt_runtime_us\": \"0\\r\", \n", |
| " \"shares\": \"1024\\r\", \n", |
| " \"cfs_quota_us\": \"50000\\r\", \n", |
| " \"rt_period_us\": \"1000000\\r\", \n", |
| " \"cfs_period_us\": \"100000\\r\"\n", |
| "}\n" |
| ] |
| } |
| ], |
| "source": [ |
| "# Set a 1CPU equivalent bandwidth for that CGroup\n", |
| "cpu_littles.set(cfs_period_us=100000, cfs_quota_us=50000)\n", |
| "print \"LITTLE:\\n\", json.dumps(cpu_littles.get(), indent=4)" |
| ] |
| }, |
| { |
| "cell_type": "code", |
| "execution_count": 21, |
| "metadata": { |
| "collapsed": false |
| }, |
| "outputs": [ |
| { |
| "name": "stderr", |
| "output_type": "stream", |
| "text": [ |
| "06:19:56 INFO : Executor [start]: /root/devlib-target/bin/cgroup_run_into.sh /LITTLE '/root/devlib-target/bin/rt-app /root/schedtest/simple_00.json'\n", |
| "06:22:03 INFO : Pulling trace file into [.//simple_00.dat]...\n", |
| "06:22:07 INFO : Executor [end]: /root/devlib-target/bin/cgroup_run_into.sh /LITTLE '/root/devlib-target/bin/rt-app /root/schedtest/simple_00.json'\n" |
| ] |
| } |
| ], |
| "source": [ |
| "# Test execution of all these tasks into the LITTLE cluster\n", |
| "trace = rtapp.run(ftrace=env.ftrace, cgroup=cpu_littles.name)" |
| ] |
| }, |
| { |
| "cell_type": "code", |
| "execution_count": 22, |
| "metadata": { |
| "collapsed": false |
| }, |
| "outputs": [ |
| { |
| "data": { |
| "text/html": [ |
| "<style>\n", |
| "/*\n", |
| "\n", |
| " * Copyright 2015-2015 ARM Limited\n", |
| "\n", |
| " *\n", |
| "\n", |
| " * Licensed under the Apache License, Version 2.0 (the \"License\");\n", |
| "\n", |
| " * you may not use this file except in compliance with the License.\n", |
| "\n", |
| " * You may obtain a copy of the License at\n", |
| "\n", |
| " *\n", |
| "\n", |
| " * http://www.apache.org/licenses/LICENSE-2.0\n", |
| "\n", |
| " *\n", |
| "\n", |
| " * Unless required by applicable law or agreed to in writing, software\n", |
| "\n", |
| " * distributed under the License is distributed on an \"AS IS\" BASIS,\n", |
| "\n", |
| " * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n", |
| "\n", |
| " * See the License for the specific language governing permissions and\n", |
| "\n", |
| " * limitations under the License.\n", |
| "\n", |
| " */\n", |
| "\n", |
| "\n", |
| "\n", |
| ".d3-tip {\n", |
| "\n", |
| " line-height: 1;\n", |
| "\n", |
| " padding: 12px;\n", |
| "\n", |
| " background: rgba(0, 0, 0, 0.6);\n", |
| "\n", |
| " color: #fff;\n", |
| "\n", |
| " border-radius: 2px;\n", |
| "\n", |
| " position: absolute !important;\n", |
| "\n", |
| " z-index: 99999;\n", |
| "\n", |
| "}\n", |
| "\n", |
| "\n", |
| "\n", |
| ".d3-tip:after {\n", |
| "\n", |
| " box-sizing: border-box;\n", |
| "\n", |
| " pointer-events: none;\n", |
| "\n", |
| " display: inline;\n", |
| "\n", |
| " font-size: 10px;\n", |
| "\n", |
| " width: 100%;\n", |
| "\n", |
| " line-height: 1;\n", |
| "\n", |
| " color: rgba(0, 0, 0, 0.6);\n", |
| "\n", |
| " content: \"\\25BC\";\n", |
| "\n", |
| " position: absolute !important;\n", |
| "\n", |
| " z-index: 99999;\n", |
| "\n", |
| " text-align: center;\n", |
| "\n", |
| "}\n", |
| "\n", |
| "\n", |
| "\n", |
| ".d3-tip.n:after {\n", |
| "\n", |
| " margin: -1px 0 0 0;\n", |
| "\n", |
| " top: 100%;\n", |
| "\n", |
| " left: 0;\n", |
| "\n", |
| "}\n", |
| "\n", |
| "\n", |
| "\n", |
| ".contextRect {\n", |
| "\n", |
| " fill: lightgray;\n", |
| "\n", |
| " fill-opacity: 0.5;\n", |
| "\n", |
| " stroke: black;\n", |
| "\n", |
| " stroke-width: 1;\n", |
| "\n", |
| " stroke-opacity: 1;\n", |
| "\n", |
| " pointer-events: none;\n", |
| "\n", |
| " shape-rendering: crispEdges;\n", |
| "\n", |
| "}\n", |
| "\n", |
| "\n", |
| "\n", |
| ".chart {\n", |
| "\n", |
| " shape-rendering: crispEdges;\n", |
| "\n", |
| "}\n", |
| "\n", |
| "\n", |
| "\n", |
| ".mini text {\n", |
| "\n", |
| " font: 9px sans-serif;\n", |
| "\n", |
| "}\n", |
| "\n", |
| "\n", |
| "\n", |
| ".main text {\n", |
| "\n", |
| " font: 12px sans-serif;\n", |
| "\n", |
| "}\n", |
| "\n", |
| "\n", |
| "\n", |
| ".axis line, .axis path {\n", |
| "\n", |
| " stroke: black;\n", |
| "\n", |
| "}\n", |
| "\n", |
| "\n", |
| "\n", |
| ".miniItem {\n", |
| "\n", |
| " stroke-width: 8;\n", |
| "\n", |
| "}\n", |
| "\n", |
| "\n", |
| "\n", |
| ".brush .extent {\n", |
| "\n", |
| "\n", |
| "\n", |
| " stroke: #000;\n", |
| "\n", |
| " fill-opacity: .125;\n", |
| "\n", |
| " shape-rendering: crispEdges;\n", |
| "\n", |
| "}\n", |
| "\n", |
| "</style>\n", |
| "<div id=\"fig_931accaef9e54b439227a93fbd22b1d1\" class=\"eventplot\">\n", |
| " <script>\n", |
| " var req = require.config( {\n", |
| "\n", |
| " paths: {\n", |
| "\n", |
| " \"EventPlot\": '/nbextensions/plotter_scripts/EventPlot/EventPlot',\n", |
| " \"d3-tip\": '/nbextensions/plotter_scripts/EventPlot/d3.tip.v0.6.3',\n", |
| " \"d3-plotter\": '/nbextensions/plotter_scripts/EventPlot/d3.v3.min'\n", |
| " },\n", |
| " shim: {\n", |
| " \"d3-plotter\" : {\n", |
| " \"exports\" : \"d3\"\n", |
| " },\n", |
| " \"d3-tip\": [\"d3-plotter\"],\n", |
| " \"EventPlot\": {\n", |
| "\n", |
| " \"deps\": [\"d3-tip\", \"d3-plotter\" ],\n", |
| " \"exports\": \"EventPlot\"\n", |
| " }\n", |
| " }\n", |
| " });\n", |
| " req([\"require\", \"EventPlot\"], function() {\n", |
| " EventPlot.generate('fig_931accaef9e54b439227a93fbd22b1d1', '/nbextensions/');\n", |
| " });\n", |
| " </script>\n", |
| " </div>" |
| ], |
| "text/plain": [ |
| "<IPython.core.display.HTML object>" |
| ] |
| }, |
| "metadata": {}, |
| "output_type": "display_data" |
| } |
| ], |
| "source": [ |
| "# Check tasks residency on little clsuter\n", |
| "trappy.plotter.plot_trace(trace)" |
| ] |
| } |
| ], |
| "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 |
| } |