Skip to content

Commit

Permalink
Add minimum payload length
Browse files Browse the repository at this point in the history
  • Loading branch information
miri64 committed Jun 4, 2016
1 parent d612467 commit 9d4cbb2
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 14 deletions.
31 changes: 19 additions & 12 deletions stack_comparison/run.py
Expand Up @@ -11,6 +11,8 @@
import sys
import time

MAX_EXP_MINUTES=12

EMPTY_APP_PATH = "../empty/"
APPS = ['time_tx', 'time_tx_rpl', 'time_rx', 'time_rx_rpl']
STACKS = ['emb6', 'gnrc', 'lwip']
Expand All @@ -19,12 +21,16 @@
IOTLAB_SITE = 'paris'
IOTLAB_NODE = 43
IOTLAB_EXP_NAME = 'masterthesis_run'
IOTLAB_DURATION = 2 * 15 * len(APPS) * len(STACKS)
IOTLAB_DURATION = 2 * MAX_EXP_MINUTES * len(APPS) * len(STACKS)

MINUTE=60
MAX_BUILD_TIME=5 * MINUTE
MAX_EXP_TIME=MAX_EXP_MINUTES * MINUTE

def build(stacktest=False):
env = os.environ
env.update({'STACKTEST': str(int(bool(stacktest)))})
make = pexpect.spawn("make -B clean all", env=env, timeout=5 * 60)
make = pexpect.spawn("make -B clean all", env=env, timeout=MAX_BUILD_TIME)
start = time.time()
for app in APPS:
for stack in STACKS:
Expand All @@ -37,7 +43,7 @@ def build(stacktest=False):
print("... done")
duration = time.time() - start
make.wait()
print("Building took %.2f minutes" % (duration / 60.0))
print("Building took %.2f minutes" % (duration / MINUTE))

def start_exp(site, node, duration, iotlab_exp_name):
env = os.environ
Expand All @@ -46,7 +52,7 @@ def start_exp(site, node, duration, iotlab_exp_name):
'IOTLAB_DURATION': str(duration),
'IOTLAB_EXP_NAME': str(iotlab_exp_name)})
make = pexpect.spawn("make -C %s iotlab-exp" % EMPTY_APP_PATH, env=env,
timeout=5 * 60)
timeout=MAX_BUILD_TIME)
print("Starting experiment")
make.expect(r"Waiting that experiment (\d+) gets in state Running")
iotlab_exp_id = int(make.match.group(1))
Expand All @@ -60,7 +66,7 @@ def stop_exp(iotlab_exp_id=None):
if iotlab_exp_id != None:
env.update({'IOTLAB_EXP_ID': str(iotlab_exp_id)})
make = pexpect.spawn("make -C %s iotlab-stop" % EMPTY_APP_PATH, env=env,
timeout=60)
timeout=MINUTE)
make.expect("Deleting the job = %d ...REGISTERED." % iotlab_exp_id)
make.wait()
IOTLAB_EXP_ID = 0
Expand All @@ -71,7 +77,7 @@ def flash(path, iotlab_exp_id):
env = os.environ
env.update({'IOTLAB_EXP_ID': str(iotlab_exp_id)})
make = pexpect.spawn("make -C %s iotlab-flash" % path, env=env,
timeout=60)
timeout=MINUTE)
make.expect("\"0\": \\[")
make.expect("\"m3-\\d+.\\w+.iot-lab.info\"")
make.wait()
Expand All @@ -90,7 +96,7 @@ def run_experiments(site, node, iotlab_exp_id, stacktest=False):
(iotlab_exp_id, log_name)])
time.sleep(5)
watcher = pexpect.spawn("ssh %s@%s.iot-lab.info 'tail -F %s'" %
(IOTLAB_USER, site, log_name), timeout=15 * 60)
(IOTLAB_USER, site, log_name), timeout=MAX_EXP_TIME)

for app in APPS:
for stack in STACKS:
Expand All @@ -102,19 +108,20 @@ def run_experiments(site, node, iotlab_exp_id, stacktest=False):
duration = time.time() - start
print("%s_%s%s ran for %.2f minutes" %
(stack, app, " (stacktest)" if stacktest else "",
duration / 60.0))
watcher.sendcontrol('C')
duration / MINUTE))
watcher.terminate()
watcher.wait()
logger.terminate()
logger.wait()

if __name__ == "__main__":
os.chdir(os.path.dirname(sys.argv[0]))
build()
build(True)
IOTLAB_EXP_ID = start_exp(IOTLAB_SITE, IOTLAB_NODE, IOTLAB_DURATION,
IOTLAB_EXP_NAME)
try:
run_experiments(IOTLAB_SITE, IOTLAB_NODE, IOTLAB_EXP_ID)
build(True)
run_experiments(IOTLAB_SITE, IOTLAB_NODE, IOTLAB_EXP_ID, True)
# build(True)
# run_experiments(IOTLAB_SITE, IOTLAB_NODE, IOTLAB_EXP_ID, True)
finally:
stop_exp(IOTLAB_EXP_ID)
2 changes: 1 addition & 1 deletion stack_comparison/time_rx/gnrc/exp.c
Expand Up @@ -186,7 +186,7 @@ void exp_run(void)
#else
puts("payload_len,rx_traversal_time");
#endif
for (payload_size = EXP_PAYLOAD_STEP; payload_size <= EXP_MAX_PAYLOAD;
for (payload_size = EXP_MIN_PAYLOAD; payload_size <= EXP_MAX_PAYLOAD;
payload_size += EXP_PAYLOAD_STEP) {
bool fragmented = prepare_sixlowpan();
for (unsigned id = 0; id < EXP_RUNS; id++) {
Expand Down
2 changes: 1 addition & 1 deletion stack_comparison/time_tx/gnrc/exp.c
Expand Up @@ -106,7 +106,7 @@ void exp_run(void)
#else
puts("payload_len,tx_traversal_time");
#endif
for (payload_size = EXP_PAYLOAD_STEP; payload_size <= EXP_MAX_PAYLOAD;
for (payload_size = EXP_MIN_PAYLOAD; payload_size <= EXP_MAX_PAYLOAD;
payload_size += EXP_PAYLOAD_STEP) {
for (unsigned id = 0; id < EXP_RUNS; id++) {
for (unsigned j = 0; j < (payload_size - TAIL_LEN); j++) {
Expand Down
6 changes: 6 additions & 0 deletions stack_comparison/time_tx/gnrc/exp.h
Expand Up @@ -59,6 +59,12 @@ extern "C" {
#define EXP_FRAGMENT_DELAY (0U)
#endif

#ifndef EXP_MIN_PAYLOAD
#define EXP_MIN_PAYLOAD (8U)
#elif EXP_MIN_PAYLOAD < 5
#error "EXP_MAX_PAYLOAD needs to be at least 5"
#endif

#ifndef EXP_MAX_PAYLOAD
#define EXP_MAX_PAYLOAD (1232U)
#elif EXP_MAX_PAYLOAD < 5
Expand Down

0 comments on commit 9d4cbb2

Please sign in to comment.