Updated docstrings, removed out of date comments, added some new ones.
+"""
+Contains various helper functions and information for benchmarking RTEMS CAN GW implementation.
+"""
+
import subprocess
import sys
import os
import subprocess
import sys
import os
def original_name_from_histogram_name(hist_name):
"""Retuns name of the original test from the name of its histogram."""
def original_name_from_histogram_name(hist_name):
"""Retuns name of the original test from the name of its histogram."""
- return "-".join(hist_name.split("-")[:-1])
\ No newline at end of file
+ return "-".join(hist_name.split("-")[:-1])
+
+def set_txqueuelen(length):
+ """Sets txqueuelen on can0 interface to given length"""
+ subprocess.call("ifconfig can0 txqueuelen {}".format(length).split())
"""
Quick and dirty script to automate benchmarking ryu board with RTEMS on board.
"""
Quick and dirty script to automate benchmarking ryu board with RTEMS on board.
-Should create the same directory structure as the shell scripts used when targeting linux,
-but only uses two tests (one actually, the second one is reinterpretation of the data of the first one.)
+Creates the same general directory structure and contents as do the shell scripts.
+
+Takes tests from tests.py (see its docstring for defining new tests) and relies on functions from lib.py
Expects to be run from within the gw-tests directory and that the layout of boot files remains constant.
"""
Expects to be run from within the gw-tests directory and that the layout of boot files remains constant.
"""
-import subprocess
-import sys, os, shutil, stat
from time import sleep
import tests
from time import sleep
import tests
for traffic in lib.traffic_modes:
if traffic == "flood":
for traffic in lib.traffic_modes:
if traffic == "flood":
- subprocess.call("ifconfig can0 txqueuelen 200".split()) #this stops latester from ending due to ENOBUFS errors
+ lib.set_txqueuelen(200) #this stops latester from ending due to ENOBUFS errors
print("Can mode: ", traffic)
lib.set_traffic(traffic)
print("Can mode: ", traffic)
lib.set_traffic(traffic)
#give time to recover from load?
sleep(5)
#give time to recover from load?
sleep(5)
- #Currently, because of problems with serial port, tests have associated images for behaviour\r
- #otherwise, they are just histogram generators\r
- if test.has_image:\r
+ #Currently, because of problems with serial port, tests have associated images for behaviour
+ #otherwise, they are just histogram generators
+ if test.has_image:
#second part of the load "handlers" -> stopping the load
if load == "cpu":
#we have to reflash "no cpu load" image
#second part of the load "handlers" -> stopping the load
if load == "cpu":
#we have to reflash "no cpu load" image
+"""
+This file contains and defines tests for use in rtems_bench.
+
+Any new tests should be added to module variable tests to be seen by the bench.
+"""
+
self.has_image = has_image
def run(self):
self.has_image = has_image
def run(self):
def nop(self):
print(self.name)
def nop(self):
print(self.name)
lib.symlink_results(lib.original_name_from_histogram_name(self.name))
lib.create_plot_script()
lib.symlink_results(lib.original_name_from_histogram_name(self.name))
lib.create_plot_script()