blob: 37f307f9491d4adc51828dcc02caa9197f4127be [file] [log] [blame]
Patrick Bellasi4244a7d2016-01-21 15:37:35 +00001{
2 "cells": [
3 {
4 "cell_type": "code",
5 "execution_count": 1,
6 "metadata": {
7 "collapsed": true
8 },
9 "outputs": [],
10 "source": [
11 "import logging\n",
12 "reload(logging)\n",
13 "logging.basicConfig(\n",
14 " format='%(asctime)-9s %(levelname)-8s: %(message)s',\n",
15 " datefmt='%I:%M:%S')\n",
16 "\n",
17 "# Enable logging at INFO level\n",
18 "logging.getLogger().setLevel(logging.INFO)"
19 ]
20 },
21 {
22 "cell_type": "code",
23 "execution_count": 2,
24 "metadata": {
25 "collapsed": false
26 },
27 "outputs": [
28 {
29 "name": "stdout",
30 "output_type": "stream",
31 "text": [
32 "Populating the interactive namespace from numpy and matplotlib\n"
33 ]
34 }
35 ],
36 "source": [
37 "# Generate plots inline\n",
38 "%pylab inline\n",
39 "\n",
40 "import json\n",
41 "import os\n",
42 "\n",
43 "# Support to access the remote target\n",
44 "import devlib\n",
45 "from env import TestEnv\n",
46 "\n",
47 "# Support to configure and run RTApp based workloads\n",
Patrick Bellasi818ba5c2016-02-25 19:01:19 +000048 "from wlgen import RTA, Ramp, Step, Pulse, Periodic"
Patrick Bellasi4244a7d2016-01-21 15:37:35 +000049 ]
50 },
51 {
52 "cell_type": "markdown",
53 "metadata": {},
54 "source": [
55 "# Test environment setup"
56 ]
57 },
58 {
59 "cell_type": "code",
60 "execution_count": 3,
61 "metadata": {
62 "collapsed": false
63 },
64 "outputs": [
65 {
66 "name": "stderr",
67 "output_type": "stream",
68 "text": [
Patrick Bellasi818ba5c2016-02-25 19:01:19 +000069 "04:26:17 INFO : Target - Using base path: /home/derkling/Code/lisa\n",
70 "04:26:17 INFO : Target - Loading custom (inline) target configuration\n",
71 "04:26:17 INFO : Target - Devlib modules to load: []\n",
72 "04:26:17 INFO : Target - Connecting host target:\n",
73 "04:26:17 INFO : Target - username : put_here_your_username\n",
74 "04:26:17 INFO : Target - password : \n"
Patrick Bellasi4244a7d2016-01-21 15:37:35 +000075 ]
76 },
77 {
78 "name": "stdout",
79 "output_type": "stream",
80 "text": [
81 "sudo password:········\n"
82 ]
83 },
84 {
85 "name": "stderr",
86 "output_type": "stream",
87 "text": [
Patrick Bellasi818ba5c2016-02-25 19:01:19 +000088 "04:26:21 INFO : Target - Initializing target workdir:\n",
89 "04:26:21 INFO : Target - /tmp\n",
90 "04:26:21 INFO : Target - Topology:\n",
91 "04:26:21 INFO : Target - [[0, 1, 2, 3, 4, 5, 6, 7]]\n",
92 "04:26:21 WARNING : Target - Unable to identify cluster frequencies\n",
93 "04:26:21 INFO : TestEnv - Set results folder to:\n",
94 "04:26:21 INFO : TestEnv - /home/derkling/Code/lisa/results/20160225_162621\n",
95 "04:26:21 INFO : TestEnv - Experiment results available also in:\n",
96 "04:26:21 INFO : TestEnv - /home/derkling/Code/lisa/results_latest\n"
Patrick Bellasi4244a7d2016-01-21 15:37:35 +000097 ]
98 }
99 ],
100 "source": [
101 "# Let's use the local host as a target\n",
102 "te = TestEnv(\n",
103 " target_conf={\n",
104 " \"platform\": 'host',\n",
105 " \"username\": 'put_here_your_username'\n",
106 " })"
107 ]
108 },
109 {
110 "cell_type": "markdown",
111 "metadata": {},
112 "source": [
113 "# Create a new RTA workload generator object"
114 ]
115 },
116 {
117 "cell_type": "markdown",
118 "metadata": {},
119 "source": [
120 "The wlgen::RTA class is a workload generator which exposes an API to configure\n",
121 "RTApp based workload as well as to execute them on a target."
122 ]
123 },
124 {
125 "cell_type": "code",
126 "execution_count": 4,
127 "metadata": {
128 "collapsed": false
129 },
130 "outputs": [
131 {
132 "name": "stderr",
133 "output_type": "stream",
134 "text": [
Patrick Bellasi818ba5c2016-02-25 19:01:19 +0000135 "04:26:21 INFO : WlGen - Setup new workload example\n"
Patrick Bellasi4244a7d2016-01-21 15:37:35 +0000136 ]
137 }
138 ],
139 "source": [
140 "# Create a new RTApp workload generator\n",
141 "rtapp = RTA(\n",
142 " \n",
143 " target=te.target, # Target execution on the local machine\n",
144 " \n",
145 " name='example', # This is the name of the JSON configuration file reporting\n",
146 " # the generated RTApp configuration\n",
147 " \n",
148 " calibration={0: 10, 1: 11, 2: 12, 3: 13} # These are a set of fake\n",
149 " # calibration values\n",
150 ")"
151 ]
152 },
153 {
154 "cell_type": "markdown",
155 "metadata": {},
156 "source": [
157 "# Workload Generation Examples"
158 ]
159 },
160 {
161 "cell_type": "markdown",
162 "metadata": {},
163 "source": [
164 "## Single periodic task"
165 ]
166 },
167 {
168 "cell_type": "markdown",
169 "metadata": {},
170 "source": [
171 "An RTApp workload is defined by specifying a **kind**, which represents the way\n",
172 "we want to defined the behavior of each task.<br>\n",
173 "The most common kind is **profile**, which allows to define each task using one\n",
174 "of the predefined **profile** supported by the RTA base class.<br>\n",
175 "<br>\n",
176 "The following example shows how to generate a \"periodic\" task<br>"
177 ]
178 },
179 {
180 "cell_type": "code",
181 "execution_count": 5,
182 "metadata": {
183 "code_folding": [],
184 "collapsed": false
185 },
186 "outputs": [
187 {
188 "name": "stderr",
189 "output_type": "stream",
190 "text": [
Patrick Bellasi818ba5c2016-02-25 19:01:19 +0000191 "04:26:21 INFO : RTApp - Workload duration defined by longest task\n",
192 "04:26:21 INFO : RTApp - Default policy: SCHED_OTHER\n",
193 "04:26:21 INFO : RTApp - ------------------------\n",
194 "04:26:21 INFO : RTApp - task [task_per20], sched: {'policy': 'FIFO'}\n",
195 "04:26:21 INFO : RTApp - | calibration CPU: 0\n",
196 "04:26:21 INFO : RTApp - | loops count: 1\n",
197 "04:26:21 INFO : RTApp - + phase_000001: duration 5.000000 [s] (50 loops)\n",
198 "04:26:21 INFO : RTApp - | period 100000 [us], duty_cycle 20 %\n",
199 "04:26:21 INFO : RTApp - | run_time 20000 [us], sleep_time 80000 [us]\n"
Patrick Bellasi4244a7d2016-01-21 15:37:35 +0000200 ]
201 }
202 ],
203 "source": [
204 "# Configure this RTApp instance to:\n",
205 "rtapp.conf(\n",
206 " \n",
207 " # 1. generate a \"profile based\" set of tasks\n",
208 " kind='profile',\n",
209 " \n",
210 " # 2. define the \"profile\" of each task\n",
211 " params={\n",
212 " \n",
213 " # 3. PERIODIC task\n",
214 " # \n",
215 " # This class defines a task which load is periodic with a configured\n",
216 " # period and duty-cycle.\n",
217 " # \n",
218 " # This class is a specialization of the 'pulse' class since a periodic\n",
219 " # load is generated as a sequence of pulse loads.\n",
220 " # \n",
221 " # Args:\n",
222 " # cuty_cycle_pct (int, [0-100]): the pulses load [%]\n",
223 " # default: 50[%]\n",
224 " # duration_s (float): the duration in [s] of the entire workload\n",
225 " # default: 1.0[s]\n",
226 " # period_ms (float): the period used to define the load in [ms]\n",
227 " # default: 100.0[ms]\n",
228 " # delay_s (float): the delay in [s] before ramp start\n",
229 " # default: 0[s]\n",
230 " # sched (dict): the scheduler configuration for this task\n",
Patrick Bellasi818ba5c2016-02-25 19:01:19 +0000231 " 'task_per20': Periodic(\n",
Patrick Bellasi4244a7d2016-01-21 15:37:35 +0000232 " period_ms=100, # period\n",
233 " duty_cycle_pct=20, # duty cycle\n",
234 " duration_s=5, # duration\n",
235 " cpus=None, # run on all CPUS\n",
236 " sched={\n",
237 " \"policy\": \"FIFO\", # Run this task as a SCHED_FIFO task\n",
238 " },\n",
239 " delay_s=0 # start at the start of RTApp\n",
Patrick Bellasi818ba5c2016-02-25 19:01:19 +0000240 " ).get(),\n",
Patrick Bellasi4244a7d2016-01-21 15:37:35 +0000241 " \n",
242 " },\n",
243 " \n",
244 " # 4. use this folder for task logfiles\n",
245 " run_dir='/tmp'\n",
246 " \n",
247 ");"
248 ]
249 },
250 {
251 "cell_type": "markdown",
252 "metadata": {},
253 "source": [
254 "The output of the previous cell reports the main properties of the generated\n",
255 "tasks. Thus for example we see that the first task is configure to be:\n",
256 "1. named **task_per20**\n",
257 "2. will be executed as a **SCHED_FIFO** task\n",
258 "3. generating a load which is **calibrated** with respect to the **CPU 0**\n",
259 "3. with one single \"phase\" which defines a peripodic load for the **duration** of **5[s]**\n",
260 "4. that periodic load consistes of **50 cycles**\n",
261 "5. each cycle has a **period** of **100[ms]** and a **duty-cycle** of **20%**\n",
262 "6. which means that the task, for every cycle, will **run** for **20[ms]** and then sleep for **20[ms]** \n",
263 "\n",
264 "All these properties are translated into a JSON configuration file for RTApp.<br>\n",
265 "Let see what it looks like the generated configuration file:"
266 ]
267 },
268 {
269 "cell_type": "code",
270 "execution_count": 6,
271 "metadata": {
272 "collapsed": false
273 },
274 "outputs": [
275 {
276 "name": "stdout",
277 "output_type": "stream",
278 "text": [
279 "{\n",
280 " \"tasks\": {\n",
281 " \"task_per20\": {\n",
282 " \"policy\": \"SCHED_FIFO\", \n",
283 " \"phases\": {\n",
284 " \"p000001\": {\n",
285 " \"run\": 20000, \n",
286 " \"timer\": {\n",
287 " \"ref\": \"task_per20\", \n",
288 " \"period\": 100000\n",
289 " }, \n",
290 " \"loop\": 50\n",
291 " }\n",
292 " }, \n",
293 " \"loop\": 1\n",
294 " }\n",
295 " }, \n",
296 " \"global\": {\n",
297 " \"duration\": -1, \n",
298 " \"logdir\": \"/tmp\", \n",
299 " \"default_policy\": \"SCHED_OTHER\", \n",
300 " \"calibration\": 10\n",
301 " }\n",
302 "}\n"
303 ]
304 }
305 ],
306 "source": [
307 "# Dump the configured JSON file for that task\n",
308 "with open(\"./example_00.json\") as fh:\n",
309 " rtapp_config = json.load(fh)\n",
310 "print json.dumps(rtapp_config, indent=4)"
311 ]
312 },
313 {
314 "cell_type": "markdown",
315 "metadata": {},
316 "source": [
317 "## Workload mix"
318 ]
319 },
320 {
321 "cell_type": "markdown",
322 "metadata": {},
323 "source": [
324 "Using the wlgen::RTA workload generator we can easily create multiple tasks, each one with different \"profiles\", which are executed once the rtapp application is started in the target.<br>\n",
325 "<br>\n",
326 "In the following example we configure a workload mix composed by a RAMP task, a STEP task and a PULSE task:"
327 ]
328 },
329 {
330 "cell_type": "code",
331 "execution_count": 7,
332 "metadata": {
333 "code_folding": [],
334 "collapsed": false
335 },
336 "outputs": [
337 {
338 "name": "stderr",
339 "output_type": "stream",
340 "text": [
Patrick Bellasi818ba5c2016-02-25 19:01:19 +0000341 "04:26:22 INFO : RTApp - Workload duration defined by longest task\n",
342 "04:26:22 INFO : RTApp - Default policy: SCHED_OTHER\n",
343 "04:26:22 INFO : RTApp - ------------------------\n",
344 "04:26:22 INFO : RTApp - task [task_pls5-80], sched: using default policy\n",
345 "04:26:22 INFO : RTApp - | start delay: 0.500000 [s]\n",
346 "04:26:22 INFO : RTApp - | calibration CPU: 0\n",
347 "04:26:22 INFO : RTApp - | loops count: 1\n",
348 "04:26:22 INFO : RTApp - + phase_000001: duration 1.000000 [s] (10 loops)\n",
349 "04:26:22 INFO : RTApp - | period 100000 [us], duty_cycle 65 %\n",
350 "04:26:22 INFO : RTApp - | run_time 65000 [us], sleep_time 35000 [us]\n",
351 "04:26:22 INFO : RTApp - + phase_000002: duration 1.000000 [s] (10 loops)\n",
352 "04:26:22 INFO : RTApp - | period 100000 [us], duty_cycle 5 %\n",
353 "04:26:22 INFO : RTApp - | run_time 5000 [us], sleep_time 95000 [us]\n",
354 "04:26:22 INFO : RTApp - ------------------------\n",
355 "04:26:22 INFO : RTApp - task [task_rmp20_5-60], sched: using default policy\n",
356 "04:26:22 INFO : RTApp - | calibration CPU: 0\n",
357 "04:26:22 INFO : RTApp - | loops count: 1\n",
358 "04:26:22 INFO : RTApp - | CPUs affinity: 0\n",
359 "04:26:22 INFO : RTApp - + phase_000001: duration 1.000000 [s] (10 loops)\n",
360 "04:26:22 INFO : RTApp - | period 100000 [us], duty_cycle 5 %\n",
361 "04:26:22 INFO : RTApp - | run_time 5000 [us], sleep_time 95000 [us]\n",
362 "04:26:22 INFO : RTApp - + phase_000002: duration 1.000000 [s] (10 loops)\n",
363 "04:26:22 INFO : RTApp - | period 100000 [us], duty_cycle 25 %\n",
364 "04:26:22 INFO : RTApp - | run_time 25000 [us], sleep_time 75000 [us]\n",
365 "04:26:22 INFO : RTApp - + phase_000003: duration 1.000000 [s] (10 loops)\n",
366 "04:26:22 INFO : RTApp - | period 100000 [us], duty_cycle 45 %\n",
367 "04:26:22 INFO : RTApp - | run_time 45000 [us], sleep_time 55000 [us]\n",
368 "04:26:22 INFO : RTApp - + phase_000004: duration 1.000000 [s] (10 loops)\n",
369 "04:26:22 INFO : RTApp - | period 100000 [us], duty_cycle 65 %\n",
370 "04:26:22 INFO : RTApp - | run_time 65000 [us], sleep_time 35000 [us]\n",
371 "04:26:22 INFO : RTApp - ------------------------\n",
372 "04:26:22 INFO : RTApp - task [task_stp10-50], sched: using default policy\n",
373 "04:26:22 INFO : RTApp - | start delay: 0.500000 [s]\n",
374 "04:26:22 INFO : RTApp - | calibration CPU: 0\n",
375 "04:26:22 INFO : RTApp - | loops count: 1\n",
376 "04:26:22 INFO : RTApp - + phase_000001: sleep 1.000000 [s]\n",
377 "04:26:22 INFO : RTApp - + phase_000002: duration 1.000000 [s] (10 loops)\n",
378 "04:26:22 INFO : RTApp - | period 100000 [us], duty_cycle 50 %\n",
379 "04:26:22 INFO : RTApp - | run_time 50000 [us], sleep_time 50000 [us]\n"
Patrick Bellasi4244a7d2016-01-21 15:37:35 +0000380 ]
381 }
382 ],
383 "source": [
384 "# Configure this RTApp instance to:\n",
385 "rtapp.conf(\n",
386 " # 1. generate a \"profile based\" set of tasks\n",
387 " kind='profile',\n",
388 " \n",
389 " # 2. define the \"profile\" of each task\n",
390 " params={\n",
391 " \n",
392 " # 3. RAMP task\n",
393 " #\n",
394 " # This class defines a task which load is a ramp with a configured number\n",
395 " # of steps according to the input parameters.\n",
396 " # \n",
397 " # Args:\n",
398 " # start_pct (int, [0-100]): the initial load [%], (default 0[%])\n",
399 " # end_pct (int, [0-100]): the final load [%], (default 100[%])\n",
400 " # delta_pct (int, [0-100]): the load increase/decrease [%],\n",
401 " # default: 10[%]\n",
402 " # increase if start_prc < end_prc\n",
403 " # decrease if start_prc > end_prc\n",
404 " # time_s (float): the duration in [s] of each load step\n",
405 " # default: 1.0[s]\n",
406 " # period_ms (float): the period used to define the load in [ms]\n",
407 " # default: 100.0[ms]\n",
408 " # delay_s (float): the delay in [s] before ramp start\n",
409 " # default: 0[s]\n",
410 " # loops (int): number of time to repeat the ramp, with the\n",
411 " # specified delay in between\n",
412 " # default: 0\n",
413 " # sched (dict): the scheduler configuration for this task\n",
414 " # cpus (list): the list of CPUs on which task can run\n",
Patrick Bellasi818ba5c2016-02-25 19:01:19 +0000415 " 'task_rmp20_5-60': Ramp(\n",
Patrick Bellasi4244a7d2016-01-21 15:37:35 +0000416 " period_ms=100, # period\n",
417 " start_pct=5, # intial load\n",
418 " end_pct=65, # end load\n",
419 " delta_pct=20, # load % increase...\n",
420 " time_s=1, # ... every 1[s]\n",
421 " cpus=\"0\" # run just on first CPU\n",
Patrick Bellasi818ba5c2016-02-25 19:01:19 +0000422 " ).get(),\n",
Patrick Bellasi4244a7d2016-01-21 15:37:35 +0000423 " \n",
424 " # 4. STEP task\n",
425 " # \n",
426 " # This class defines a task which load is a step with a configured\n",
427 " # initial and final load.\n",
428 " # \n",
429 " # Args:\n",
430 " # start_pct (int, [0-100]): the initial load [%]\n",
431 " # default 0[%])\n",
432 " # end_pct (int, [0-100]): the final load [%]\n",
433 " # default 100[%]\n",
434 " # time_s (float): the duration in [s] of the start and end load\n",
435 " # default: 1.0[s]\n",
436 " # period_ms (float): the period used to define the load in [ms]\n",
437 " # default 100.0[ms]\n",
438 " # delay_s (float): the delay in [s] before ramp start\n",
439 " # default 0[s]\n",
440 " # loops (int): number of time to repeat the ramp, with the\n",
441 " # specified delay in between\n",
442 " # default: 0\n",
443 " # sched (dict): the scheduler configuration for this task\n",
444 " # cpus (list): the list of CPUs on which task can run\n",
Patrick Bellasi818ba5c2016-02-25 19:01:19 +0000445 " 'task_stp10-50': Step(\n",
Patrick Bellasi4244a7d2016-01-21 15:37:35 +0000446 " period_ms=100, # period\n",
447 " start_pct=0, # intial load\n",
448 " end_pct=50, # end load\n",
449 " time_s=1, # ... every 1[s]\n",
450 " delay_s=0.5 # start .5[s] after the start of RTApp\n",
Patrick Bellasi818ba5c2016-02-25 19:01:19 +0000451 " ).get(),\n",
Patrick Bellasi4244a7d2016-01-21 15:37:35 +0000452 " \n",
453 " # 5. PULSE task\n",
454 " #\n",
455 " # This class defines a task which load is a pulse with a configured\n",
456 " # initial and final load.\n",
457 " # \n",
458 " # The main difference with the 'step' class is that a pulse workload is\n",
459 " # by definition a 'step down', i.e. the workload switch from an finial\n",
460 " # load to a final one which is always lower than the initial one.\n",
461 " # Moreover, a pulse load does not generate a sleep phase in case of 0[%]\n",
462 " # load, i.e. the task ends as soon as the non null initial load has\n",
463 " # completed.\n",
464 " # \n",
465 " # Args:\n",
466 " # start_pct (int, [0-100]): the initial load [%]\n",
467 " # default: 0[%]\n",
468 " # end_pct (int, [0-100]): the final load [%]\n",
469 " # default: 100[%]\n",
470 " # NOTE: must be lower than start_pct value\n",
471 " # time_s (float): the duration in [s] of the start and end load\n",
472 " # default: 1.0[s]\n",
473 " # NOTE: if end_pct is 0, the task end after the\n",
474 " # start_pct period completed\n",
475 " # period_ms (float): the period used to define the load in [ms]\n",
476 " # default: 100.0[ms]\n",
477 " # delay_s (float): the delay in [s] before ramp start\n",
478 " # default: 0[s]\n",
479 " # loops (int): number of time to repeat the ramp, with the\n",
480 " # specified delay in between\n",
481 " # default: 0\n",
482 " # sched (dict): the scheduler configuration for this task\n",
483 " # cpus (list): the list of CPUs on which task can run\n",
Patrick Bellasi818ba5c2016-02-25 19:01:19 +0000484 " 'task_pls5-80': Pulse(\n",
Patrick Bellasi4244a7d2016-01-21 15:37:35 +0000485 " period_ms=100, # period\n",
486 " start_pct=65, # intial load\n",
487 " end_pct=5, # end load\n",
488 " time_s=1, # ... every 1[s]\n",
489 " delay_s=0.5 # start .5[s] after the start of RTApp\n",
Patrick Bellasi818ba5c2016-02-25 19:01:19 +0000490 " ).get(),\n",
Patrick Bellasi4244a7d2016-01-21 15:37:35 +0000491 " \n",
492 " \n",
493 " },\n",
494 " \n",
495 " # 6. use this folder for task logfiles\n",
496 " run_dir='/tmp'\n",
497 " \n",
498 ");"
499 ]
500 },
501 {
502 "cell_type": "code",
503 "execution_count": 8,
504 "metadata": {
505 "collapsed": false
506 },
507 "outputs": [
508 {
509 "name": "stdout",
510 "output_type": "stream",
511 "text": [
512 "{\n",
513 " \"tasks\": {\n",
514 " \"task_rmp20_5-60\": {\n",
515 " \"policy\": \"SCHED_OTHER\", \n",
516 " \"phases\": {\n",
517 " \"p000004\": {\n",
518 " \"run\": 65000, \n",
519 " \"timer\": {\n",
520 " \"ref\": \"task_rmp20_5-60\", \n",
521 " \"period\": 100000\n",
522 " }, \n",
523 " \"loop\": 10\n",
524 " }, \n",
525 " \"p000003\": {\n",
526 " \"run\": 45000, \n",
527 " \"timer\": {\n",
528 " \"ref\": \"task_rmp20_5-60\", \n",
529 " \"period\": 100000\n",
530 " }, \n",
531 " \"loop\": 10\n",
532 " }, \n",
533 " \"p000002\": {\n",
534 " \"run\": 25000, \n",
535 " \"timer\": {\n",
536 " \"ref\": \"task_rmp20_5-60\", \n",
537 " \"period\": 100000\n",
538 " }, \n",
539 " \"loop\": 10\n",
540 " }, \n",
541 " \"p000001\": {\n",
542 " \"run\": 5000, \n",
543 " \"timer\": {\n",
544 " \"ref\": \"task_rmp20_5-60\", \n",
545 " \"period\": 100000\n",
546 " }, \n",
547 " \"loop\": 10\n",
548 " }\n",
549 " }, \n",
550 " \"cpus\": [\n",
551 " 0\n",
552 " ], \n",
553 " \"loop\": 1\n",
554 " }, \n",
555 " \"task_pls5-80\": {\n",
556 " \"policy\": \"SCHED_OTHER\", \n",
557 " \"phases\": {\n",
558 " \"p000002\": {\n",
559 " \"run\": 5000, \n",
560 " \"timer\": {\n",
561 " \"ref\": \"task_pls5-80\", \n",
562 " \"period\": 100000\n",
563 " }, \n",
564 " \"loop\": 10\n",
565 " }, \n",
566 " \"p000001\": {\n",
567 " \"run\": 65000, \n",
568 " \"timer\": {\n",
569 " \"ref\": \"task_pls5-80\", \n",
570 " \"period\": 100000\n",
571 " }, \n",
572 " \"loop\": 10\n",
573 " }, \n",
574 " \"p000000\": {\n",
Patrick Bellasi818ba5c2016-02-25 19:01:19 +0000575 " \"delay\": 500000\n",
Patrick Bellasi4244a7d2016-01-21 15:37:35 +0000576 " }\n",
577 " }, \n",
578 " \"loop\": 1\n",
579 " }, \n",
580 " \"task_stp10-50\": {\n",
581 " \"policy\": \"SCHED_OTHER\", \n",
582 " \"phases\": {\n",
583 " \"p000002\": {\n",
584 " \"run\": 50000, \n",
585 " \"timer\": {\n",
586 " \"ref\": \"task_stp10-50\", \n",
587 " \"period\": 100000\n",
588 " }, \n",
589 " \"loop\": 10\n",
590 " }, \n",
591 " \"p000001\": {\n",
592 " \"sleep\": 1000000, \n",
593 " \"loop\": 1\n",
594 " }, \n",
595 " \"p000000\": {\n",
Patrick Bellasi818ba5c2016-02-25 19:01:19 +0000596 " \"delay\": 500000\n",
Patrick Bellasi4244a7d2016-01-21 15:37:35 +0000597 " }\n",
598 " }, \n",
599 " \"loop\": 1\n",
600 " }\n",
601 " }, \n",
602 " \"global\": {\n",
603 " \"duration\": -1, \n",
604 " \"logdir\": \"/tmp\", \n",
605 " \"default_policy\": \"SCHED_OTHER\", \n",
606 " \"calibration\": 10\n",
607 " }\n",
608 "}\n"
609 ]
610 }
611 ],
612 "source": [
613 "# Dump the configured JSON file for that task\n",
614 "with open(\"./example_00.json\") as fh:\n",
615 " rtapp_config = json.load(fh)\n",
616 "print json.dumps(rtapp_config, indent=4)"
617 ]
618 }
619 ],
620 "metadata": {
621 "kernelspec": {
622 "display_name": "Python 2",
623 "language": "python",
624 "name": "python2"
625 },
626 "language_info": {
627 "codemirror_mode": {
628 "name": "ipython",
629 "version": 2
630 },
631 "file_extension": ".py",
632 "mimetype": "text/x-python",
633 "name": "python",
634 "nbconvert_exporter": "python",
635 "pygments_lexer": "ipython2",
636 "version": "2.7.9"
637 }
638 },
639 "nbformat": 4,
640 "nbformat_minor": 0
641}