From 2afdcf90f9960d0b41ba2bb3bb5286ed93d0e6bf Mon Sep 17 00:00:00 2001 From: Chris Redpath Date: Fri, 16 Sep 2016 10:45:34 +0100 Subject: [PATCH 1/2] wlgen: Improve custom rtapp workload generation support Allow custom workloads to be defined with a filename or by supplying the configuration directly. Signed-off-by: Chris Redpath --- libs/wlgen/wlgen/rta.py | 50 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 48 insertions(+), 2 deletions(-) diff --git a/libs/wlgen/wlgen/rta.py b/libs/wlgen/wlgen/rta.py index 1b792ffe9..b5ac07806 100644 --- a/libs/wlgen/wlgen/rta.py +++ b/libs/wlgen/wlgen/rta.py @@ -266,7 +266,6 @@ class RTA(Workload): self.json = '{0:s}_{1:02d}.json'.format(self.name, self.exc_id) ofile = open(self.json, 'w') - ifile = open(self.params['custom'], 'r') replacements = { '__DURATION__' : str(self.duration), '__PVALUE__' : str(calibration), @@ -274,11 +273,28 @@ class RTA(Workload): '__WORKDIR__' : '"'+self.target.working_directory+'"', } + # check for inline config + close_ifile = True + if not isinstance(self.params['custom'], basestring): + # we have a dictionary, it may contain content or a filename + if isinstance(self.params['custom'], dict): + # inline config present, turn it into a file repr + tmp_json = json.dumps(self.params['custom'], + indent=4, separators=(',', ': '), sort_keys=True) + ifile = tmp_json.splitlines(True) + close_ifile = False + else: + raise ValueError("params can be only a filename or an embedded dictionary") + else: + # we assume we are being passed a filename instead of a dict + ifile = open(self.params['custom'], 'r') + for line in ifile: for src, target in replacements.iteritems(): line = line.replace(src, target) ofile.write(line) - ifile.close() + if close_ifile: + ifile.close() ofile.close() return self.json @@ -472,6 +488,36 @@ class RTA(Workload): Custom workloads ---------------- + When 'kind' is 'custom', you can supply existing rt-app job descriptions + either directly or by supplying a file name pointing to the json. + To use a job description stored in a file you must set 'params' + to be a filename. Note that the filename is relative to the current + directory. To supply rt-app job description directly, assign the + content to 'params'. The ordering of the elements in the final json + depends upon the sort operation used by the json exporter. If the exact + ordering of the tasks in your custom job is important, we recommend + using a file which is read as lines so remains in the order specified. + This allows you to reuse the push/run-test/pull functionality with + more complex application models not covered by the workload generator. + + For example, to create an RTA wrapper for an existing rt-app task + description stored in a file whose name is held in a variable called + 'filename': + + generated_file_name = rtapp.conf( + kind='custom', + duration=-1, + params="{}".format(filename) + run_dir='/data/local/tmp' ) + + + Or to write the config into a variable directly: + + generated_file_name = rtapp.conf( + kind='custom', + duration=-1, + params={ ...my custom rt-app job description... }, + run_dir='/data/local/tmp' ) Profile based workloads -- GitLab From 2097f3145423f287d53bc25b860f626eb52d3a1d Mon Sep 17 00:00:00 2001 From: Chris Redpath Date: Wed, 28 Sep 2016 11:56:22 +0100 Subject: [PATCH 2/2] Custom workload example Create a simulated 'performance benchmark application' using RTA which has one controller thread which triggers a configurable amount of worker threads for a configurable amount of time. This is similar to what applications like geekbench look like during their benchmark phases. Signed-off-by: Chris Redpath --- ipynb/wlgen/rtapp_custom_example.ipynb | 815 +++++++++++++++++++++++++ 1 file changed, 815 insertions(+) create mode 100644 ipynb/wlgen/rtapp_custom_example.ipynb diff --git a/ipynb/wlgen/rtapp_custom_example.ipynb b/ipynb/wlgen/rtapp_custom_example.ipynb new file mode 100644 index 000000000..1bac96e64 --- /dev/null +++ b/ipynb/wlgen/rtapp_custom_example.ipynb @@ -0,0 +1,815 @@ +{ + "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)" + ] + }, + { + "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": [ + "# Generate plots inline\n", + "%pylab inline\n", + "\n", + "import json\n", + "import os\n", + "\n", + "# Support to access the remote target\n", + "import devlib\n", + "from env import TestEnv\n", + "\n", + "# Support for FTrace events parsing and visualization\n", + "import trappy\n", + "\n", + "# Support to configure and run RTApp based workloads\n", + "from wlgen import RTA, Ramp, Step, Pulse, Periodic" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Test environment setup" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false, + "scrolled": true + }, + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "11:54:37 INFO : Target - Using base path: /data/work/juno/lisa\n", + "11:54:37 INFO : Target - Loading custom (inline) target configuration\n", + "11:54:37 INFO : Target - Devlib modules to load: ['bl', 'cpufreq', 'hwmon']\n", + "11:54:37 INFO : Target - Connecting Android target [10.1.210.46:5555]\n", + "11:54:37 INFO : Target - Connection settings:\n", + "11:54:37 INFO : Target - {'device': '10.1.210.46:5555'}\n", + "11:54:38 INFO : Target - Initializing target workdir:\n", + "11:54:38 INFO : Target - /data/local/tmp/devlib-target\n", + "11:54:40 INFO : Target - Topology:\n", + "11:54:40 INFO : Target - [[0, 3, 4, 5], [1, 2]]\n", + "11:54:41 INFO : Platform - Loading default EM:\n", + "11:54:41 INFO : Platform - /data/work/juno/lisa/libs/utils/platforms/juno2.json\n", + "11:54:41 INFO : FTrace - Enabled tracepoints:\n", + "11:54:41 INFO : FTrace - sched_switch\n", + "11:54:41 INFO : FTrace - cpu_frequency\n", + "11:54:41 WARNING : Target - Using configuration provided RTApp calibration\n", + "11:54:41 INFO : Target - Using RT-App calibration values:\n", + "11:54:41 INFO : Target - {\"0\": 323, \"1\": 124, \"2\": 125, \"3\": 319, \"4\": 315, \"5\": 315}\n", + "11:54:41 INFO : HWMon - Scanning for HWMON channels, may take some time...\n", + "11:54:41 INFO : HWMon - Channels selected for energy sampling:\n", + "11:54:41 INFO : HWMon - BOARDBIG_energy\n", + "11:54:41 INFO : HWMon - BOARDLITTLE_energy\n", + "11:54:41 INFO : TestEnv - Set results folder to:\n", + "11:54:41 INFO : TestEnv - /data/work/juno/lisa/results/20160928_115441\n", + "11:54:41 INFO : TestEnv - Experiment results available also in:\n", + "11:54:41 INFO : TestEnv - /data/work/juno/lisa/results_latest\n" + ] + } + ], + "source": [ + "# Let's use the local host as a target\n", + "te = TestEnv(\n", + " # Setup a target configuration\n", + " target_conf = {\n", + " \n", + " # Define the kind of target platform to use for the experiments\n", + " \"platform\" : 'android', # Linux system, valid other options are:\n", + " # android - access via ADB\n", + " # linux - access via SSH\n", + " # host - direct access\n", + " \n", + " # Preload settings for a specific target\n", + " \"board\" : 'juno2', # load JUNO specific settings, e.g.\n", + " # - HWMON based energy sampling\n", + " # - Juno energy model\n", + " # valid options are:\n", + " # - juno - JUNO Development Board\n", + " # - tc2 - TC2 Development Board\n", + " # - oak - Mediatek MT63xx based target\n", + "\n", + " # Define devlib module to load\n", + " \"modules\" : [\n", + " 'bl', # enable big.LITTLE support\n", + " 'cpufreq', # enable CPUFreq support\n", + " 'hwmon'\n", + " ],\n", + "\n", + " # Binary tools required to run this experiment\n", + " # These tools must be present in the tools/ folder for the architecture\n", + " \"tools\" : ['rt-app', 'taskset', 'trace-cmd'],\n", + " \n", + " # FTrace events end buffer configuration\n", + " \"ftrace\" : {\n", + " \"events\" : [\n", + " \"sched_switch\",\n", + " \"cpu_frequency\"\n", + " ],\n", + " \"buffsize\" : 10240\n", + " },\n", + "\n", + " # Account to access the remote target\n", + " \"host\" : '10.1.210.46',\n", + " #\"username\" : 'root',\n", + " #\"password\" : '',\n", + "\n", + " # Comment the following line to force rt-app calibration on your target\n", + " #\"rtapp-calib\" : {\n", + " # '0': 361, '1': 138, '2': 138, '3': 352, '4': 360, '5': 353\n", + " #}\n", + " \"rtapp-calib\" : { \"0\": 323, \"1\": 124, \"2\": 125, \"3\": 319, \"4\": 315, \"5\": 315 }\n", + "\n", + "}\n", + "\n", + ")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Create a new RTA workload generator object" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "The wlgen::RTA class is a workload generator which exposes an API to configure\n", + "RTApp based workload as well as to execute them on a target." + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "11:54:48 INFO : WlGen - Setup new workload example\n" + ] + } + ], + "source": [ + "# Create a new RTApp workload generator\n", + "rtapp = RTA(\n", + " \n", + " target=te.target, # Target execution on the local machine\n", + " \n", + " name='example', # This is the name of the JSON configuration file reporting\n", + " # the generated RTApp configuration\n", + " \n", + " #calibration={0: 10, 1: 11, 2: 12, 3: 13} # These are a set of fake\n", + " # # calibration values\n", + ")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "The function here, build_perf_benchmark_rtapp, demonstrates how we can build an rt-app job description which uses a controller task to unblock a number of child tasks, which then each perform a set amount of work. This is intended to simulate performance benchmarks. Many aspects of the test can be configured via parameters." + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "def build_perf_benchmark_rtapp(run_duration_ms, calibration_cpu_name, num_tasks, iterations, logdir=\"/data/local/tmp\", file_name=\"perfbench.json\"):\n", + " # static content\n", + " json_content = { \n", + " 'global': {\n", + " 'calibration': calibration_cpu_name,\n", + " 'default_policy': \"SCHED_OTHER\",\n", + " 'duration': -1,\n", + " 'logdir': logdir\n", + " },\n", + " 'tasks': {\n", + " 'controller': {\n", + " 'loop': iterations+2, \n", + " 'phases': {\n", + " 'init_delay': {\n", + " 'sleep': run_duration_ms*4\n", + " }\n", + " }\n", + " }\n", + " }\n", + " }\n", + " # dynamic content (number of tasks)\n", + " for cpu in range(0,num_tasks):\n", + " bench_thread_name = \"bench{}\".format(cpu)\n", + " # describe the worker thread\n", + " json_content['tasks'][bench_thread_name] = {\n", + " 'loop': iterations, \n", + " 'phases': {\n", + " 'go': {\n", + " 'run': run_duration_ms\n", + " }, \n", + " 'wait': {\n", + " 'suspend': bench_thread_name\n", + " }\n", + " }\n", + " }\n", + " # hook it to the controller\n", + " json_content['tasks']['controller']['phases'][\"trigger{}\".format(cpu)] = { 'resume': bench_thread_name }\n", + " \n", + " with open(file_name, 'w') as outfile:\n", + " json.dump(json_content, outfile,\n", + " sort_keys=True, indent=4, separators=(',', ': '))\n", + " return (file_name, json_content)\n", + " " + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false, + "scrolled": true + }, + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "11:54:50 INFO : Generated RTApp JSON:\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{\n", + " \"global\": {\n", + " \"calibration\": \"CPU1\", \n", + " \"default_policy\": \"SCHED_OTHER\", \n", + " \"duration\": -1, \n", + " \"logdir\": \"/data/local/tmp\"\n", + " }, \n", + " \"tasks\": {\n", + " \"bench0\": {\n", + " \"loop\": 8, \n", + " \"phases\": {\n", + " \"go\": {\n", + " \"run\": 500000\n", + " }, \n", + " \"wait\": {\n", + " \"suspend\": \"bench0\"\n", + " }\n", + " }\n", + " }, \n", + " \"bench1\": {\n", + " \"loop\": 8, \n", + " \"phases\": {\n", + " \"go\": {\n", + " \"run\": 500000\n", + " }, \n", + " \"wait\": {\n", + " \"suspend\": \"bench1\"\n", + " }\n", + " }\n", + " }, \n", + " \"bench2\": {\n", + " \"loop\": 8, \n", + " \"phases\": {\n", + " \"go\": {\n", + " \"run\": 500000\n", + " }, \n", + " \"wait\": {\n", + " \"suspend\": \"bench2\"\n", + " }\n", + " }\n", + " }, \n", + " \"bench3\": {\n", + " \"loop\": 8, \n", + " \"phases\": {\n", + " \"go\": {\n", + " \"run\": 500000\n", + " }, \n", + " \"wait\": {\n", + " \"suspend\": \"bench3\"\n", + " }\n", + " }\n", + " }, \n", + " \"bench4\": {\n", + " \"loop\": 8, \n", + " \"phases\": {\n", + " \"go\": {\n", + " \"run\": 500000\n", + " }, \n", + " \"wait\": {\n", + " \"suspend\": \"bench4\"\n", + " }\n", + " }\n", + " }, \n", + " \"bench5\": {\n", + " \"loop\": 8, \n", + " \"phases\": {\n", + " \"go\": {\n", + " \"run\": 500000\n", + " }, \n", + " \"wait\": {\n", + " \"suspend\": \"bench5\"\n", + " }\n", + " }\n", + " }, \n", + " \"controller\": {\n", + " \"loop\": 10, \n", + " \"phases\": {\n", + " \"init_delay\": {\n", + " \"sleep\": 2000000\n", + " }, \n", + " \"trigger0\": {\n", + " \"resume\": \"bench0\"\n", + " }, \n", + " \"trigger1\": {\n", + " \"resume\": \"bench1\"\n", + " }, \n", + " \"trigger2\": {\n", + " \"resume\": \"bench2\"\n", + " }, \n", + " \"trigger3\": {\n", + " \"resume\": \"bench3\"\n", + " }, \n", + " \"trigger4\": {\n", + " \"resume\": \"bench4\"\n", + " }, \n", + " \"trigger5\": {\n", + " \"resume\": \"bench5\"\n", + " }\n", + " }\n", + " }\n", + " }\n", + "}\n" + ] + } + ], + "source": [ + "run_duration_ms = 500000\n", + "calibration = 'CPU1'\n", + "num_tasks = 6\n", + "iterations = 8\n", + "\n", + "(filename, inline_config)=build_perf_benchmark_rtapp(run_duration_ms, calibration, num_tasks, iterations)\n", + "\n", + "# Configure this RTApp instance to:\n", + "name=rtapp.conf(\n", + " # 1. generate a \"profile based\" set of tasks\n", + " #kind='profile',\n", + " kind='custom',\n", + " duration=-1, \n", + " # 2. define the \"profile\" of each task\n", + " # to use inline job description:\n", + " params=inline_config,\n", + "# to use filename instead:\n", + "# params=\"{}\".format(filename),\n", + "\n", + " # 3. use this folder for task logfiles\n", + " run_dir='/data/local/tmp'\n", + ")\n", + "\n", + "logging.info('Generated RTApp JSON:')\n", + "print json.dumps(inline_config, indent=4, sort_keys=True)\n" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "def configure_target(is_big_little=0, initial_task_util=0, num_of_cpus=6, governor=\"sched\", disabled_idle_states=[]):\n", + " # device paths\n", + " isBigLittle='/proc/sys/kernel/sched_is_big_little'\n", + " initialTaskUtil='/proc/sys/kernel/sched_initial_task_util'\n", + " cpuFreqGovernor='/sys/devices/system/cpu/cpu{}/cpufreq/scaling_governor'\n", + " cpuIdleState='/sys/devices/system/cpu/cpu{}/cpuidle/state{}/disable'\n", + " \n", + " # Configure 'is_big_little' flag\n", + " te.target.execute(\"echo {} > {}\".format(is_big_little, isBigLittle))\n", + " # Configure 'initial_task_util' flag\n", + " te.target.execute(\"echo {} > {}\".format(initial_task_util, initialTaskUtil))\n", + " # set cpufreq governors\n", + " te.target.execute(\"echo {} > {}\".format(governor, cpuFreqGovernor.format(0)))\n", + " te.target.execute(\"echo {} > {}\".format(governor, cpuFreqGovernor.format(1)))\n", + " # configure idle states\n", + " idle_states=[ 0,1,2 ]\n", + " if len(disabled_idle_states):\n", + " for state in disabled_idle_states:\n", + " idle_states.remove(state)\n", + " \n", + " for cpu in range(0, num_of_cpus):\n", + " # disable states\n", + " if len(disabled_idle_states):\n", + " for idle_state in disabled_idle_states:\n", + " te.target.execute(\"echo 0 > {}\".format(cpuIdleState.format(cpu, idle_state)))\n", + " #enable states\n", + " if len(idle_states):\n", + " for idle_state in idle_states:\n", + " te.target.execute(\"echo 1 > {}\".format(cpuIdleState.format(cpu, idle_state)))\n", + " # report\n", + " #print \"sched_is_big_little: {}\".format(te.target.read_value(isBigLittle))\n", + " #print \"sched_initial_task_util: {}\".format(te.target.read_value(initialTaskUtil))\n", + " #print \"Little Cluster Governor: {}\".format(te.target.read_value(cpuFreqGovernor.format(0)))\n", + " #print \"Big Cluster Governor: {}\".format(te.target.read_value(cpuFreqGovernor.format(1)))\n", + " #idle_states=[ 0,1,2 ]\n", + " #for cpu in range(0, num_of_cpus):\n", + " # print \"Cpu {} Idle States:\".format(cpu)\n", + " # for state in idle_states:\n", + " # val = te.target.read_value(cpuIdleState.format(cpu, state))\n", + " # result='disabled'\n", + " # if val > 0:\n", + " # result='enabled'\n", + " # print \" State {} : {}\".format(state, result)" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": { + "collapsed": false, + "scrolled": false + }, + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "11:55:03 INFO : #### Setup FTrace\n", + "11:55:07 INFO : #### Start energy sampling\n", + "11:55:07 INFO : #### Start RTApp execution\n", + "11:55:07 INFO : WlGen - Workload execution START:\n", + "11:55:07 INFO : WlGen - /data/local/tmp/bin/rt-app /data/local/tmp/example_00.json 2>&1\n", + "11:55:27 INFO : #### Read energy consumption: /data/work/juno/lisa/results/20160928_115441/energy.json\n", + "11:55:27 INFO : #### Stop FTrace\n", + "11:55:27 INFO : #### Save FTrace: /data/work/juno/lisa/results/20160928_115441/trace.dat\n", + "11:55:30 INFO : #### Save platform description: /data/work/juno/lisa/results/20160928_115441/platform.json\n" + ] + }, + { + "data": { + "text/html": [ + "\n", + "
\n", + "\n", + "\n", + "\n", + " \n", + "
" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "configure_target(governor='sched')\n", + "\n", + "logging.info('#### Setup FTrace')\n", + "te.ftrace.start()\n", + "\n", + "logging.info('#### Start energy sampling')\n", + "te.emeter.reset()\n", + "\n", + "logging.info('#### Start RTApp execution')\n", + "rtapp.run(cgroup=\"\")\n", + "\n", + "logging.info('#### Read energy consumption: %s/energy.json', te.res_dir)\n", + "(nrg, nrg_file) = te.emeter.report(out_dir=te.res_dir)\n", + "\n", + "logging.info('#### Stop FTrace')\n", + "te.ftrace.stop()\n", + "\n", + "trace_file = os.path.join(te.res_dir, 'trace.dat')\n", + "logging.info('#### Save FTrace: %s', trace_file)\n", + "te.ftrace.get_trace(trace_file)\n", + "\n", + "logging.info('#### Save platform description: %s/platform.json', te.res_dir)\n", + "(plt, plt_file) = te.platform_dump(te.res_dir)\n", + "\n", + "# NOTE: The interactive trace visualization is available only if you run\n", + "# the workload to generate a new trace-file\n", + "trappy.plotter.plot_trace(te.res_dir)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "configure_target(1,0)\n", + "\n", + "logging.info('#### Setup FTrace')\n", + "te.ftrace.start()\n", + "\n", + "logging.info('#### Start energy sampling')\n", + "te.emeter.reset()\n", + "\n", + "logging.info('#### Start RTApp execution')\n", + "rtapp.run(cgroup=\"\")\n", + "\n", + "logging.info('#### Read energy consumption: %s/energy.json', te.res_dir)\n", + "(nrg, nrg_file) = te.emeter.report(out_dir=te.res_dir)\n", + "\n", + "logging.info('#### Stop FTrace')\n", + "te.ftrace.stop()\n", + "\n", + "trace_file = os.path.join(te.res_dir, 'trace.dat')\n", + "logging.info('#### Save FTrace: %s', trace_file)\n", + "te.ftrace.get_trace(trace_file)\n", + "\n", + "logging.info('#### Save platform description: %s/platform.json', te.res_dir)\n", + "(plt, plt_file) = te.platform_dump(te.res_dir)\n", + "\n", + "# NOTE: The interactive trace visualization is available only if you run\n", + "# the workload to generate a new trace-file\n", + "trappy.plotter.plot_trace(te.res_dir)" + ] + }, + { + "cell_type": "code", + "execution_count": 22, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{}\n" + ] + } + ], + "source": [ + "print te.emeter.readings\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false, + "scrolled": true + }, + "outputs": [], + "source": [ + "configure_target(0,1024)\n", + "\n", + "logging.info('#### Setup FTrace')\n", + "te.ftrace.start()\n", + "\n", + "logging.info('#### Start energy sampling')\n", + "te.emeter.reset()\n", + "\n", + "logging.info('#### Start RTApp execution')\n", + "rtapp.run(cgroup=\"\")\n", + "\n", + "logging.info('#### Read energy consumption: %s/energy.json', te.res_dir)\n", + "(nrg, nrg_file) = te.emeter.report(out_dir=te.res_dir)\n", + "\n", + "logging.info('#### Stop FTrace')\n", + "te.ftrace.stop()\n", + "\n", + "trace_file = os.path.join(te.res_dir, 'trace.dat')\n", + "logging.info('#### Save FTrace: %s', trace_file)\n", + "te.ftrace.get_trace(trace_file)\n", + "\n", + "logging.info('#### Save platform description: %s/platform.json', te.res_dir)\n", + "(plt, plt_file) = te.platform_dump(te.res_dir)\n", + "\n", + "# NOTE: The interactive trace visualization is available only if you run\n", + "# the workload to generate a new trace-file\n", + "trappy.plotter.plot_trace(te.res_dir)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false, + "scrolled": true + }, + "outputs": [], + "source": [ + "configure_target(1,1024)\n", + "\n", + "logging.info('#### Setup FTrace')\n", + "te.ftrace.start()\n", + "\n", + "logging.info('#### Start energy sampling')\n", + "te.emeter.reset()\n", + "\n", + "logging.info('#### Start RTApp execution')\n", + "rtapp.run(cgroup=\"\")\n", + "\n", + "logging.info('#### Read energy consumption: %s/energy.json', te.res_dir)\n", + "(nrg, nrg_file) = te.emeter.report(out_dir=te.res_dir)\n", + "\n", + "logging.info('#### Stop FTrace')\n", + "te.ftrace.stop()\n", + "\n", + "trace_file = os.path.join(te.res_dir, 'trace.dat')\n", + "logging.info('#### Save FTrace: %s', trace_file)\n", + "te.ftrace.get_trace(trace_file)\n", + "\n", + "logging.info('#### Save platform description: %s/platform.json', te.res_dir)\n", + "(plt, plt_file) = te.platform_dump(te.res_dir)\n", + "\n", + "# NOTE: The interactive trace visualization is available only if you run\n", + "# the workload to generate a new trace-file\n", + "trappy.plotter.plot_trace(te.res_dir)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [] + } + ], + "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.6" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} -- GitLab