From 9d4cbb2a7ce8f60f586fe89524c6afc4a54de049 Mon Sep 17 00:00:00 2001 From: Martine Lenders Date: Sat, 4 Jun 2016 19:12:03 +0200 Subject: [PATCH] Add minimum payload length --- stack_comparison/run.py | 31 ++++++++++++++++++----------- stack_comparison/time_rx/gnrc/exp.c | 2 +- stack_comparison/time_tx/gnrc/exp.c | 2 +- stack_comparison/time_tx/gnrc/exp.h | 6 ++++++ 4 files changed, 27 insertions(+), 14 deletions(-) diff --git a/stack_comparison/run.py b/stack_comparison/run.py index 9fb1144..c911063 100755 --- a/stack_comparison/run.py +++ b/stack_comparison/run.py @@ -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'] @@ -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: @@ -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 @@ -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)) @@ -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 @@ -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() @@ -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: @@ -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) diff --git a/stack_comparison/time_rx/gnrc/exp.c b/stack_comparison/time_rx/gnrc/exp.c index a44f6fd..d4db5e4 100644 --- a/stack_comparison/time_rx/gnrc/exp.c +++ b/stack_comparison/time_rx/gnrc/exp.c @@ -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++) { diff --git a/stack_comparison/time_tx/gnrc/exp.c b/stack_comparison/time_tx/gnrc/exp.c index ec3dc58..a6e397a 100644 --- a/stack_comparison/time_tx/gnrc/exp.c +++ b/stack_comparison/time_tx/gnrc/exp.c @@ -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++) { diff --git a/stack_comparison/time_tx/gnrc/exp.h b/stack_comparison/time_tx/gnrc/exp.h index e84f612..c5d5084 100644 --- a/stack_comparison/time_tx/gnrc/exp.h +++ b/stack_comparison/time_tx/gnrc/exp.h @@ -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