In [4]:
import sys,os
import tempfile
import shutil
sys.path.append("..")
%pylab inline
import trappy
trace_thermal = "./trace.txt"
trace_sched = "../tests/trace_sched.txt"
TEMP_BASE = "/tmp"


Populating the interactive namespace from numpy and matplotlib

In [5]:
def setup_thermal():
    tDir = tempfile.mkdtemp(dir="/tmp", prefix="trappy_doc", suffix = ".tempDir")
    shutil.copyfile(trace_thermal, os.path.join(tDir, "trace.txt"))
    return tDir

def setup_sched():
    tDir = tempfile.mkdtemp(dir="/tmp", prefix="trappy_doc", suffix = ".tempDir")
    shutil.copyfile(trace_sched, os.path.join(tDir, "trace.txt"))
    return tDir

In [6]:
temp_thermal_location = setup_thermal()
run1 = trappy.Run(temp_thermal_location)
run2 = trappy.Run(temp_thermal_location)
run2.thermal.data_frame["temp"] = run1.thermal.data_frame["temp"] * 2
run2.cpu_out_power.data_frame["power"] = run1.cpu_out_power.data_frame["power"] * 2

No Pivot Simple


In [7]:
l = trappy.LinePlot(run1, trappy.thermal.Thermal, column="temp")
        l.view()


No Pivot Multi Run


In [8]:
l = trappy.LinePlot(
            [run1, run2], trappy.thermal.Thermal, column="temp")
        l.view()


No Pivot Mutiple Columns and Runs


In [9]:
l = trappy.LinePlot([run1,
                                  run2],
                                 [trappy.thermal.Thermal,
                                  trappy.thermal.ThermalGovernor],
                                 column=["temp",
                                         "power_range"])
        l.view()


No Pivot With Filters


In [10]:
l = trappy.LinePlot([run1,
                                  run2],
                                 [trappy.cpu_power.CpuOutPower],
                                 column="power",
                                 filters={"cdev_state": [0]})
        l.view()


Pivoted Data


In [11]:
l = trappy.LinePlot(
            run1,
            trappy.thermal.Thermal,
            column="temp",
            pivot="thermal_zone")
        l.view()


Pivoted Multi Run Data


In [12]:
l = trappy.LinePlot(
            [run1, run2], trappy.cpu_power.CpuOutPower, column="power", pivot="cpus")
        l.view()


Pivoted Data Multiple Runs and Columns


In [13]:
l = trappy.LinePlot([run1,
                                  run2],
                                 [trappy.cpu_power.CpuInPower,
                                  trappy.cpu_power.CpuOutPower],
                                 column=["dynamic_power", "power"],
                                 pivot="cpus")
        l.view()


Pivoted Data with filters


In [14]:
l = trappy.LinePlot(
            run1,
            trappy.cpu_power.CpuInPower,
            column=[
                "dynamic_power",
                "load1"],
            filters={
                "cdev_state": [
                    1,
                    0]},
            pivot="cpus")
        l.view()