{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Tutorial Goal" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "This tutorial aims to show how RTApp performance metrics are computed\n", "and reported by the **perf analysis** module provided by LISA." ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "collapsed": true }, "outputs": [], "source": [ "import logging\n", "from conf import LisaLogging\n", "LisaLogging.setup()" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "collapsed": true }, "outputs": [], "source": [ "# Execute this cell to report devlib debugging information\n", "logging.getLogger('ssh').setLevel(logging.DEBUG)" ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Populating the interactive namespace from numpy and matplotlib\n" ] } ], "source": [ "# Generate plots inline\n", "%pylab inline\n", "\n", "import json\n", "import os" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Collected results" ] }, { "cell_type": "code", "execution_count": 9, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\u001b[01;34m./example_rtapp\u001b[00m\r\n", "├── energy.json\r\n", "├── output.log\r\n", "├── platform.json\r\n", "├── rt-app-task_r20_5-60-0.log\r\n", "├── rt-app-task_r20_5-60-1.log\r\n", "├── rt-app-task_r20_5-60-3.log\r\n", "├── rt-app-task_r20_5-60-6.log\r\n", "├── simple_00.json\r\n", "└── trace.dat\r\n", "\r\n", "0 directories, 9 files\r\n" ] } ], "source": [ "# Let's use an example trace\n", "res_dir = './example_rtapp'\n", "trace_file = os.path.join(res_dir, 'trace.dat')\n", "platform_file = os.path.join(res_dir, 'platform.json')\n", "!tree {res_dir}" ] }, { "cell_type": "code", "execution_count": 11, "metadata": { "collapsed": false }, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "11:58:12 INFO : Generated RTApp JSON file:\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "{\n", " \"global\": {\n", " \"calibration\": \"CPU1\", \n", " \"default_policy\": \"SCHED_OTHER\", \n", " \"duration\": -1, \n", " \"logdir\": \"/root/devlib-target\"\n", " }, \n", " \"tasks\": {\n", " \"task_r20_5-60\": {\n", " \"cpus\": [\n", " 5\n", " ], \n", " \"loop\": 1, \n", " \"phases\": {\n", " \"p000001\": {\n", " \"loop\": 10, \n", " \"run\": 5000, \n", " \"timer\": {\n", " \"period\": 100000, \n", " \"ref\": \"task_r20_5-60\"\n", " }\n", " }, \n", " \"p000002\": {\n", " \"loop\": 10, \n", " \"run\": 25000, \n", " \"timer\": {\n", " \"period\": 100000, \n", " \"ref\": \"task_r20_5-60\"\n", " }\n", " }, \n", " \"p000003\": {\n", " \"loop\": 10, \n", " \"run\": 45000, \n", " \"timer\": {\n", " \"period\": 100000, \n", " \"ref\": \"task_r20_5-60\"\n", " }\n", " }, \n", " \"p000004\": {\n", " \"loop\": 10, \n", " \"run\": 65000, \n", " \"timer\": {\n", " \"period\": 100000, \n", " \"ref\": \"task_r20_5-60\"\n", " }\n", " }\n", " }, \n", " \"policy\": \"SCHED_OTHER\"\n", " }\n", " }\n", "}\n" ] } ], "source": [ "# Inspect the JSON file used to run the application\n", "with open('{}/simple_00.json'.format(res_dir), 'r') as fh:\n", " rtapp_json = json.load(fh, )\n", "logging.info('Generated RTApp JSON file:')\n", "print json.dumps(rtapp_json, indent=4, sort_keys=True)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Trace inspection" ] }, { "cell_type": "code", "execution_count": 12, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/html": [ "\n", "