1. Prepare SSH connection


In [1]:
import logging
reload(logging)
logging.basicConfig(
    format='%(asctime)-9s %(levelname)-8s: %(message)s',
    datefmt='%I:%M:%S')

# Enable logging at INFO level
logging.getLogger().setLevel(logging.DEBUG)
# Comment the follwing line to disable devlib debugging statements
logging.getLogger('ssh').setLevel(logging.DEBUG)

In [2]:
# Generate plots inline
%pylab inline

import json
import os
import subprocess

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

# Support for trace events analysis
from trace import Trace
#from trace_analysis import TraceAnalysis

# Support to configure and run RTApp based workloads
from wlgen import RTA, Ramp, Step, Pulse, Periodic

# Support for performance analysis of RTApp workloads
from perf_analysis import PerfAnalysis

# Suport for FTrace events parsing and visualization
import trappy


/home/lubaoquan/anaconda2/lib/python2.7/site-packages/matplotlib/font_manager.py:273: UserWarning: Matplotlib is building the font cache using fc-list. This may take a moment.
  warnings.warn('Matplotlib is building the font cache using fc-list. This may take a moment.')
Populating the interactive namespace from numpy and matplotlib

In [3]:
#run workload automation
#!pwd
#!wa run antutu.yaml -f
# Let's use an example trace
res_dir = "/home/lubaoquan/tools/lisa/lisa/ipynb/android/antutu/wa_output/antutu_1_1"
#tracefile = os.path.join(res_dir, 'trace.dat')
platformfile = os.path.join('.', 'platform.json')
#platformfile = os.path.join(res_dir, 'platform.json')
#!tree {res_dir}

In [4]:
# Platform description
with open(platformfile, 'r') as fh:
    platform = json.load(fh)

print platform

# Time range from the analysis
(t_min, t_max) = (0, None)

platform['nrg_model']['little']['cpu']['cap_max'] = 1024
platform['clusters']['little'] = [0, 1, 2, 3]
        
platform['nrg_model']['big']['cpu']['cap_max'] = 1024
platform['clusters']['big'] = [4, 5, 6, 7]
platform['cpus_count'] = 8

logging.info("CPUs max capacities:")
logging.info("   big: %5d (cpus: %s)",
             platform['nrg_model']['big']['cpu']['cap_max'],
             platform['clusters']['big'])
logging.info("LITTLE: %5d (cpus: %s)",
             platform['nrg_model']['little']['cpu']['cap_max'],
             platform['clusters']['little'])



IOErrorTraceback (most recent call last)
<ipython-input-4-d123ed55f703> in <module>()
      1 # Platform description
----> 2 with open(platformfile, 'r') as fh:
      3     platform = json.load(fh)
      4 
      5 print platform

IOError: [Errno 2] No such file or directory: './platform.json'

In [ ]:
# Load the LISA::Trace parsing module
from trace import Trace

# Trace events of interest
events_to_parse = [
    "sched_switch",
    "sched_wakeup",
    "sched_wakeup_new",
    "sched_contrib_scale_f",
    "sched_load_avg_cpu",
    "sched_load_avg_task",
    "sched_tune_config",
    "sched_tune_tasks_update",
    "sched_tune_boostgroup_update",
    "sched_tune_filter",
    "sched_boost_cpu",
    "sched_boost_task",
    "sched_energy_diff",
    "cpu_frequency",
    "cpu_capacity",
    "cpu_idle",
]

# allows to keep track of platform specific details to support the generation
# of
res_dir = "/home/lubaoquan/tools/lisa/lisa/ipynb/android/antutu/wa_output/antutu_1_1"

trace = Trace(platform, res_dir, events_to_parse, window=(t_min,t_max))

In [ ]:
trace.setXTimeRange(t_min, t_max)

trace.analysis.frequency.plotClusterFrequencies()
#trace.analysis.frequency.plotCPUFrequencyResidency()
#trace.analysis.frequency.plotClusterFrequencyResidency()

In [ ]: