import logging
from lisa.utils import setup_logging
setup_logging()
2022-04-28 17:09:54,369 INFO : root : Using LISA logging configuration: /data/llu/lisa/logging.conf
from lisa.target import Target, TargetConf
import os, time
import pandas as pd
import numpy as np
import holoviews as hv
hv.extension('bokeh')
from lisa.trace import FtraceCollector
from lisa.trace import Trace
from lisa.platforms.platinfo import PlatformInfo
target = Target(
kind='linux',
name='myjuno_r0',
host='192.168.2.100',
username='root',
password='root',
)
2022-04-28 17:10:00,538 INFO : lisa.target.Target : Creating result directory: /data/llu/lisa/results/Target-myjuno_r0-20220428_171000.537973 2022-04-28 17:10:02,012 INFO : lisa.target.Target : Connected to target myjuno_r0 2022-04-28 17:10:02,041 WARNING : lisa.target.Target : Will not load cgroups devlib module: target is using systemd, which already uses cgroups 2022-04-28 17:10:02,144 INFO : lisa.energy_model.EnergyModel.from_target : Attempting to load EM using LinuxEnergyModel 2022-04-28 17:10:02,516 INFO : lisa.target.Target : Loading target devlib module cpuidle 2022-04-28 17:10:03,326 INFO : lisa.target.Target : Loading target devlib module cpufreq 2022-04-28 17:10:03,841 INFO : lisa.target.Target : Loading target devlib module sched 2022-04-28 17:10:04,518 INFO : sched : Scheduler sched_domain procfs entries found 2022-04-28 17:10:04,520 INFO : sched : Detected kernel compiled with SCHED_DEBUG=y 2022-04-28 17:10:04,520 INFO : sched : CPU capacity sysfs entries found 2022-04-28 17:10:05,756 INFO : lisa.target.Target : Effective platform information: |- abi from target (str): arm64 +- cpu-capacities: |- orig from target (dict): {0: 446, 1: 1024, 2: 1024, 3: 446, 4: 446, 5: 446} |- writeable from target (bool): False |- rtapp from target(platform-info/rtapp/calib),target(platform-info/cpu-capacities/orig),target(platform-info/cpu-capacities/writeable) (str): <depends on lazy keys: platform-info/rtapp/calib> |- cpus-count from target (int): 6 |- freq-domains from target (list): [[0, 3, 4, 5], [1, 2]] |- freqs from target (dict): {0: [450000, 575000, 700000, 775000, 850000], 1: [450000, 625000, 800000, 950000, 1100000], 2: [450000, 625000, 800000, 950000, 1100000], 3: [450000, 575000, 700000, 775000, 850000], 4: [450000, 575000, 700000, 775000, 850000], 5: [450000, 575000, 700000, 775000, 850000]} +- kernel: |- config from target (TypedKernelConfig): <kernel config> |- symbols-address from target (DeferredValue): <symbols address> |- version from target (KernelVersion): 5.17.0-00687-gf4b0640aa709-dirty 18 SMP PREEMPT Thu Apr 28 15:27:41 BST 2022 |- name from target-conf (str): myjuno_r0 |- nrg-model from target (LinuxEnergyModel): <lisa.energy_model.LinuxEnergyModel object at 0x7f78bba78490> |- numa-nodes-count from target (int): 1 |- os from target (str): linux +- rtapp: |- calib from target (DeferredValue): <lazy value of RTA.get_cpu_calibrations> |- capacity-classes from target(platform-info/cpu-capacities/orig) (list): [[0, 3, 4, 5], [1, 2]]
def provide_calibration(calibration):
target.plat_info["rtapp"].add_src("user", {"calib" : calibration})
provide_calibration({0: 621, 1: 245, 2: 245, 3: 621, 4: 621, 5: 621})
NR_CPUS = 6
target.execute("echo power_allocator > /sys/class/thermal/thermal_zone2/policy")
target.execute("echo enabled > /sys/class/thermal/thermal_zone2/mode")
''
def set_polling_period(pp):
target.execute("echo {} > /sys/class/thermal/thermal_zone2/polling_period".format(int(pp)))
def set_max_cooling_state(cs):
target.execute("echo {} > /sys/class/thermal/thermal_zone2/cmax_state".format(cs))
def set_thermal_pressure_shifter(shifter):
target.execute("echo {} > /sys/class/thermal/thermal_zone2/thermal_pressure_shifter".format(shifter))
target.cpufreq.set_all_governors("performance")
target.hotplug.online_all()
2022-04-28 17:10:06,018 INFO : lisa.target.Target : Loading target devlib module hotplug
def generate_test_cases(throttle_periods, cooling_states, shifters):
test_cases = []
for shifter in shifters:
for cs in cooling_states:
for tp in throttle_periods:
test_cases.append({"throttle_period": tp, "cooling_state": cs, "shifter": shifter})
return test_cases
test_cases = generate_test_cases([0.05, 0.1], [1, 3], [0, -2, -3, -4, 2, 4])
events = ["thermal*", "power*", "pelt_thermal_tp"]
ftrace_coll = FtraceCollector(target, events=events, buffer_size=10240)
trace_path = os.path.join(target.get_res_dir(), "trace_thermal_pressure.dat")
target.background("/root/test_sched_pipe_long.sh")
with ftrace_coll:
for tc in test_cases:
print(tc)
set_thermal_pressure_shifter(tc["shifter"])
set_max_cooling_state(tc["cooling_state"])
set_polling_period(tc["throttle_period"] * 1000)
time.sleep(1)
test_time = tc["throttle_period"] * 20
time.sleep(test_time)
set_polling_period(3000)
time.sleep(2)
ftrace_coll.get_trace(trace_path)
2022-04-28 17:10:07,575 INFO : lisa.target.Target : Creating result directory: /data/llu/lisa/results/Target-myjuno_r0-20220428_171000.537973/20220428_171007.574908
{'throttle_period': 0.05, 'cooling_state': 1, 'shifter': 0} {'throttle_period': 0.1, 'cooling_state': 1, 'shifter': 0} {'throttle_period': 0.05, 'cooling_state': 3, 'shifter': 0} {'throttle_period': 0.1, 'cooling_state': 3, 'shifter': 0} {'throttle_period': 0.05, 'cooling_state': 1, 'shifter': -2} {'throttle_period': 0.1, 'cooling_state': 1, 'shifter': -2} {'throttle_period': 0.05, 'cooling_state': 3, 'shifter': -2} {'throttle_period': 0.1, 'cooling_state': 3, 'shifter': -2} {'throttle_period': 0.05, 'cooling_state': 1, 'shifter': -3} {'throttle_period': 0.1, 'cooling_state': 1, 'shifter': -3} {'throttle_period': 0.05, 'cooling_state': 3, 'shifter': -3} {'throttle_period': 0.1, 'cooling_state': 3, 'shifter': -3} {'throttle_period': 0.05, 'cooling_state': 1, 'shifter': -4} {'throttle_period': 0.1, 'cooling_state': 1, 'shifter': -4} {'throttle_period': 0.05, 'cooling_state': 3, 'shifter': -4} {'throttle_period': 0.1, 'cooling_state': 3, 'shifter': -4} {'throttle_period': 0.05, 'cooling_state': 1, 'shifter': 2} {'throttle_period': 0.1, 'cooling_state': 1, 'shifter': 2} {'throttle_period': 0.05, 'cooling_state': 3, 'shifter': 2} {'throttle_period': 0.1, 'cooling_state': 3, 'shifter': 2} {'throttle_period': 0.05, 'cooling_state': 1, 'shifter': 4} {'throttle_period': 0.1, 'cooling_state': 1, 'shifter': 4} {'throttle_period': 0.05, 'cooling_state': 3, 'shifter': 4} {'throttle_period': 0.1, 'cooling_state': 3, 'shifter': 4}
2022-04-28 17:12:06,734 WARNING : py.warnings : /tmp/ipykernel_7024/3316600413.py:19: DeprecationWarning: lisa.trace.CollectorBase.get_trace is deprecated and will be removed in version 3.0, use lisa.trace.CollectorBase.get_data instead (see: https://lisa-linux-integrated-system-analysis.readthedocs.io/en/latest/trace_analysis.html#lisa.trace.CollectorBase.get_data) ftrace_coll.get_trace(trace_path)
[</data/llu/lisa/results/Target-myjuno_r0-20220428_171000.537973/20220428_171007.574908/trace_thermal_pressure.dat (file)>]
plat_info_path = os.path.join(target.get_res_dir(), "platinfo.yaml")
target.plat_info.to_yaml_map(plat_info_path)
plat_info = PlatformInfo.from_yaml_map(plat_info_path)
trace = Trace(trace_path, plat_info, events=events)
2022-04-28 17:12:13,704 INFO : lisa.target.Target : Creating result directory: /data/llu/lisa/results/Target-myjuno_r0-20220428_171000.537973/20220428_171213.703919 2022-04-28 17:12:13,845 INFO : lisa.platforms.platinfo.PlatformInfo : Attempting to read kallsyms from target 2022-04-28 17:12:26,261 WARNING : lisa.trace.Trace : Events not found in the trace /data/llu/lisa/results/Target-myjuno_r0-20220428_171000.537973/20220428_171007.574908/trace_thermal_pressure.dat: Trace is missing the following required events: (power* and thermal*). Available events are: pelt_thermal_tp
df_thermal_update = trace.df_event("thermal_pressure_update")
df_thermal_update
__comm | __pid | __cpu | thermal_pressure | cpu | |
---|---|---|---|---|---|
Time | |||||
2179.749495 | bash | 1339 | 0 | 40 | 0 |
2179.749564 | bash | 1339 | 0 | 140 | 1 |
2179.806764 | kworker/u12:0 | 7 | 5 | 0 | 0 |
2179.806785 | kworker/u12:0 | 7 | 5 | 0 | 1 |
2179.861496 | kworker/u12:0 | 7 | 5 | 40 | 0 |
... | ... | ... | ... | ... | ... |
2289.785106 | kworker/u12:0 | 7 | 5 | 0 | 1 |
2289.889055 | kworker/u12:0 | 7 | 5 | 145 | 0 |
2289.889064 | kworker/u12:0 | 7 | 5 | 443 | 1 |
2289.915337 | bash | 1525 | 5 | 0 | 0 |
2289.915444 | bash | 1525 | 5 | 0 | 1 |
1656 rows × 5 columns
df_tu_big = df_thermal_update[df_thermal_update["cpu"] == 1]
df_thermal_load_avg = trace.df_event("pelt_thermal_tp")
df_thermal_load_avg
__comm | __pid | __cpu | press | cpu | |
---|---|---|---|---|---|
Time | |||||
2179.401460 | bash | 1312 | 3 | 125 | 3 |
2179.404682 | sshd | 994 | 0 | 124 | 0 |
2179.405451 | sched-pipe | 1304 | 1 | 380 | 1 |
2179.409453 | sched-pipe | 753 | 2 | 378 | 2 |
2179.414701 | <idle> | 0 | 4 | 123 | 4 |
... | ... | ... | ... | ... | ... |
2292.097286 | <idle> | 0 | 4 | 4 | 4 |
2292.100910 | sched-pipe | 1304 | 1 | 13 | 1 |
2292.100914 | <idle> | 0 | 0 | 4 | 0 |
2292.100915 | bash | 1532 | 5 | 4 | 5 |
2292.100932 | <idle> | 0 | 0 | 4 | 3 |
110434 rows × 5 columns
df_tla_big = df_thermal_load_avg[df_thermal_load_avg["cpu"] == 1]
df_tla_big
__comm | __pid | __cpu | press | cpu | |
---|---|---|---|---|---|
Time | |||||
2179.405451 | sched-pipe | 1304 | 1 | 380 | 1 |
2179.421451 | sched-pipe | 1303 | 1 | 372 | 1 |
2179.441449 | sched-pipe | 1303 | 1 | 363 | 1 |
2179.457448 | sched-pipe | 1304 | 1 | 355 | 1 |
2179.473448 | sched-pipe | 1303 | 1 | 348 | 1 |
... | ... | ... | ... | ... | ... |
2292.032912 | sched-pipe | 1304 | 1 | 14 | 1 |
2292.048912 | sched-pipe | 1304 | 1 | 13 | 1 |
2292.064918 | sched-pipe | 1304 | 1 | 13 | 1 |
2292.084914 | sched-pipe | 1304 | 1 | 13 | 1 |
2292.100910 | sched-pipe | 1304 | 1 | 13 | 1 |
24293 rows × 5 columns
plt_tu = hv.Curve(df_tu_big, "Time", "thermal_pressure").opts(interpolation="steps-post")
plt_tu.opts(width=1000, height=300)
plt_tla = hv.Curve(df_tla_big, "Time", "press")
plt_tla.opts(width=1000, height=300)
plt_tu * plt_tla