In [1]:
import logging
reload(logging)
log_fmt = '%(asctime)-9s %(levelname)-8s: %(message)s'
logging.basicConfig(format=log_fmt)

# Change to info once the notebook runs ok
#logging.getLogger().setLevel(logging.DEBUG)

In [2]:
%pylab inline

import datetime
import devlib
import os
import json
import pandas as pd
import re
import subprocess
import trappy
from trappy.plotter.Utils import get_trace_event_data

import matplotlib.gridspec as gridspec
import matplotlib.pyplot as plt

# Support to access the remote target
#import devlib
#from env import TestEnv

from executor import Executor


Populating the interactive namespace from numpy and matplotlib

Target Configuration


In [3]:
# Setup a target configuration
my_target_conf = {
    
    # Target platform and board
    "platform"    : 'linux',
    "board"       : 'aboard',
    
    # Target board IP/MAC address
    "host"        : '192.168.0.1',
    
    # Login credentials
    "username"    : 'root',
    "password"    : 'test0000',

}

Tests Configuration


In [4]:
my_tests_conf = {

    # Folder where all the results will be collected
    "results_dir" : "ExecutorExample",

    # Platform configurations to test
    "confs" : [
        {
            "tag"            : "base",
            "flags"          : "ftrace",           # Enable FTrace events
            "sched_features" : "NO_ENERGY_AWARE",  # Disable EAS
            "cpufreq"        : {                   # Use PERFORMANCE CpuFreq
                "governor" : "performance",
            },
        },
        {
            "tag"            : "eas",
            "flags"          : "ftrace",           # Enable FTrace events
            "sched_features" : "ENERGY_AWARE",     # Enable EAS
            "cpufreq"        : {                   # Use PERFORMANCE CpuFreq
                "governor" : "performance",
            },
        },
    ],
    
    # Workloads to run (on each platform configuration)
    "wloads" : {
        # Run hackbench with 1 group using pipes
        "perf" : {
            "type" : "perf_bench",
            "conf" : {
                "class" : "messaging",
                "params" : {
                    "group" :    1,
                    "loop"  :   10,
                    "pipe"  : True,
                    "thread": True,
                }
            }
        },
        # Run a 20% duty-cycle periodic task
        "rta" : {
            "type" : "rt-app",
            "loadref" : "big",
            "conf" : {
                "class"  : "profile",
                "params"  : {
                    "p20" : {
                        "kind"   : "periodic",
                        "params" : {
                            "duty_cycle_pct" : 20,
                         },
                    },
                },
            },
        },
    },
    
    # Number of iterations for each workload
    "iterations" : 1,
    
    # FTrace events to collect for all the tests configuration which have
    # the "ftrace" flag enabled
    "ftrace"  : {
         "events" : [
            "sched_switch",
            "sched_wakeup",
            "sched_wakeup_new",
            "cpu_frequency",
         ],
         "buffsize" : 80 * 1024,
    },
    
    # Tools required by the experiments
    "tools"   : [ 'trace-cmd', 'perf' ],
    
    # Modules required by these experiments
    "modules"     : [ 'bl', 'cpufreq' ],

}

Tests execution


In [5]:
executor = Executor(my_target_conf, my_tests_conf)


10:22:10  INFO    :         Target - Loading custom (inline) test configuration
10:22:10  INFO    :         Target - Using base path: /home/derkling/Code/lisa
10:22:10  INFO    :         Target - Loading custom (inline) target configuration
10:22:10  INFO    :         Target - Loading custom (inline) test configuration
10:22:10  INFO    :         Target - Devlib modules to load: ['bl', 'cpufreq']
10:22:10  INFO    :         Target - Connecting linux target:
10:22:10  INFO    :         Target -   username : root
10:22:10  INFO    :         Target -       host : 192.168.0.1
10:22:10  INFO    :         Target -   password : test0000
10:22:15  INFO    :         Target - Initializing target workdir:
10:22:15  INFO    :         Target -    /root/devlib-target
10:22:21  INFO    :         Target - Topology:
10:22:21  INFO    :         Target -    [[0, 3, 4, 5], [1, 2]]
10:22:25  INFO    :         FTrace - Enabled tracepoints:
10:22:25  INFO    :         FTrace -   sched_switch
10:22:25  INFO    :         FTrace -   sched_wakeup
10:22:25  INFO    :         FTrace -   sched_wakeup_new
10:22:25  INFO    :         FTrace -   cpu_frequency
10:22:25  INFO    :        TestEnv - Set results folder to:
10:22:25  INFO    :        TestEnv -    /home/derkling/Code/lisa/results/ExecutorExample
10:22:25  INFO    :        TestEnv - Experiment results available also in:
10:22:25  INFO    :        TestEnv -    /home/derkling/Code/lisa/results_latest
10:22:25  INFO    : 
10:22:25  INFO    : ################################################################################
10:22:25  INFO    :       Executor - Experiments configuration
10:22:25  INFO    : ################################################################################
10:22:25  INFO    :       Executor - Configured to run:
10:22:25  INFO    :       Executor -     2 targt configurations:
10:22:25  INFO    :       Executor -       base, eas
10:22:25  INFO    :       Executor -     2 workloads (1 iterations each)
10:22:25  INFO    :       Executor -       rta, perf
10:22:25  INFO    :       Executor - Total: 4 experiments
10:22:25  INFO    :       Executor - Results will be collected under:
10:22:25  INFO    :       Executor -       /home/derkling/Code/lisa/results/ExecutorExample

In [6]:
executor.run()


10:22:25  INFO    : 
10:22:25  INFO    : ################################################################################
10:22:25  INFO    :       Executor - Experiments execution
10:22:25  INFO    : ################################################################################
10:22:25  INFO    : 
10:22:25  INFO    : ================================================================================
10:22:25  INFO    :   TargetConfig - configuring target for [base] experiments
10:22:27  INFO    :  SchedFeatures - Set scheduler feature: NO_ENERGY_AWARE
10:22:27  INFO    :        CPUFreq - Configuring all CPUs to use [performance] governor
10:22:27  INFO    :          WlGen - Setup new workload rta
10:22:27  INFO    :          RTApp - Workload duration defined by longest task
10:22:27  INFO    :          RTApp - Default policy: SCHED_OTHER
10:22:27  INFO    :          RTApp - ------------------------
10:22:27  INFO    :          RTApp - task [task_p20], sched: using default policy
10:22:27  INFO    :          RTApp -  | calibration CPU: 1
10:22:27  INFO    :          RTApp -  | loops count: 1
10:22:27  INFO    :          RTApp - + phase_000001: duration 1.000000 [s] (10 loops)
10:22:27  INFO    :          RTApp - |  period   100000 [us], duty_cycle  20 %
10:22:27  INFO    :          RTApp - |  run_time  20000 [us], sleep_time  80000 [us]
10:22:28  INFO    : ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
10:22:28  INFO    :       Executor - Experiment 1/4, [base:rta] 1/1
10:22:28  WARNING :       Executor - FTrace events collection enabled
10:22:34  INFO    :          WlGen - Workload execution START:
10:22:34  INFO    :          WlGen -    /root/devlib-target/bin/rt-app /root/devlib-target/run_dir/rta_00.json
10:22:43  INFO    :       Executor - Collected FTrace binary trace:
10:22:43  INFO    :       Executor -    <res_dir>/rtapp:base:rta/1/trace.dat
10:22:43  INFO    :       Executor - Collected FTrace function profiling:
10:22:43  INFO    :       Executor -    <res_dir>/rtapp:base:rta/1/trace_stat.json
10:22:43  INFO    :          WlGen - Setup new workload perf
10:22:43  INFO    : ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
10:22:43  INFO    :       Executor - Experiment 2/4, [base:perf] 1/1
10:22:43  WARNING :       Executor - FTrace events collection enabled
10:22:49  INFO    :          WlGen - Workload execution START:
10:22:49  INFO    :          WlGen -    /root/devlib-target/bin/perf bench sched messaging --pipe --thread --group 1 --loop 10
10:22:50  INFO    :      PerfBench - Completion time: 0.088000, Performance 11.363636
10:22:57  INFO    :       Executor - Collected FTrace binary trace:
10:22:57  INFO    :       Executor -    <res_dir>/perf_bench_messaging:base:perf/1/trace.dat
10:22:57  INFO    :       Executor - Collected FTrace function profiling:
10:22:57  INFO    :       Executor -    <res_dir>/perf_bench_messaging:base:perf/1/trace_stat.json
10:22:57  INFO    : 
10:22:57  INFO    : ================================================================================
10:22:57  INFO    :   TargetConfig - configuring target for [eas] experiments
10:22:59  INFO    :  SchedFeatures - Set scheduler feature: ENERGY_AWARE
10:22:59  INFO    :        CPUFreq - Configuring all CPUs to use [performance] governor
10:22:59  INFO    :          WlGen - Setup new workload rta
10:22:59  INFO    :          RTApp - Workload duration defined by longest task
10:22:59  INFO    :          RTApp - Default policy: SCHED_OTHER
10:22:59  INFO    :          RTApp - ------------------------
10:22:59  INFO    :          RTApp - task [task_p20], sched: using default policy
10:22:59  INFO    :          RTApp -  | calibration CPU: 1
10:22:59  INFO    :          RTApp -  | loops count: 1
10:22:59  INFO    :          RTApp - + phase_000001: duration 1.000000 [s] (10 loops)
10:22:59  INFO    :          RTApp - |  period   100000 [us], duty_cycle  20 %
10:22:59  INFO    :          RTApp - |  run_time  20000 [us], sleep_time  80000 [us]
10:23:00  INFO    : ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
10:23:00  INFO    :       Executor - Experiment 3/4, [eas:rta] 1/1
10:23:00  WARNING :       Executor - FTrace events collection enabled
10:23:06  INFO    :          WlGen - Workload execution START:
10:23:06  INFO    :          WlGen -    /root/devlib-target/bin/rt-app /root/devlib-target/run_dir/rta_00.json
10:23:16  INFO    :       Executor - Collected FTrace binary trace:
10:23:16  INFO    :       Executor -    <res_dir>/rtapp:eas:rta/1/trace.dat
10:23:16  INFO    :       Executor - Collected FTrace function profiling:
10:23:16  INFO    :       Executor -    <res_dir>/rtapp:eas:rta/1/trace_stat.json
10:23:16  INFO    :          WlGen - Setup new workload perf
10:23:17  INFO    : ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
10:23:17  INFO    :       Executor - Experiment 4/4, [eas:perf] 1/1
10:23:17  WARNING :       Executor - FTrace events collection enabled
10:23:22  INFO    :          WlGen - Workload execution START:
10:23:22  INFO    :          WlGen -    /root/devlib-target/bin/perf bench sched messaging --pipe --thread --group 1 --loop 10
10:23:23  INFO    :      PerfBench - Completion time: 0.119000, Performance 8.403361
10:23:31  INFO    :       Executor - Collected FTrace binary trace:
10:23:31  INFO    :       Executor -    <res_dir>/perf_bench_messaging:eas:perf/1/trace.dat
10:23:31  INFO    :       Executor - Collected FTrace function profiling:
10:23:31  INFO    :       Executor -    <res_dir>/perf_bench_messaging:eas:perf/1/trace_stat.json
10:23:31  INFO    : 
10:23:31  INFO    : ################################################################################
10:23:31  INFO    :       Executor - Experiments execution completed
10:23:31  INFO    : ################################################################################
10:23:31  INFO    :       Executor - Results available in:
10:23:31  INFO    :       Executor -       /home/derkling/Code/lisa/results/ExecutorExample

In [7]:
!tree {executor.te.res_dir}


/home/derkling/Code/lisa/results/ExecutorExample
├── perf_bench_messaging:base:perf
│   ├── 1
│   │   ├── output.log
│   │   ├── performance.json
│   │   └── trace.dat
│   ├── kernel.config
│   ├── kernel.version
│   └── platform.json
├── perf_bench_messaging:eas:perf
│   ├── 1
│   │   ├── output.log
│   │   ├── performance.json
│   │   └── trace.dat
│   ├── kernel.config
│   ├── kernel.version
│   └── platform.json
├── rtapp:base:rta
│   ├── 1
│   │   ├── output.log
│   │   ├── rta_00.json
│   │   ├── rt-app-task_p20-0.log
│   │   └── trace.dat
│   ├── kernel.config
│   ├── kernel.version
│   └── platform.json
└── rtapp:eas:rta
    ├── 1
    │   ├── output.log
    │   ├── rta_00.json
    │   ├── rt-app-task_p20-0.log
    │   └── trace.dat
    ├── kernel.config
    ├── kernel.version
    └── platform.json

8 directories, 26 files