summaryrefslogtreecommitdiff
path: root/robot/hypervisor.c
diff options
context:
space:
mode:
Diffstat (limited to 'robot/hypervisor.c')
-rw-r--r--robot/hypervisor.c24
1 files changed, 18 insertions, 6 deletions
diff --git a/robot/hypervisor.c b/robot/hypervisor.c
index 381d9af..2e263ce 100644
--- a/robot/hypervisor.c
+++ b/robot/hypervisor.c
@@ -1,19 +1,31 @@
-#include <pololu/orangutan.h>
-
#include "consts.h"
#include "errcatch.h"
#include "hypervisor.h"
#include "io.h"
#include "modes.h"
+#include "orangutan_shim.h"
#include "sercomm.h"
void w2_hypervisor_main() {
+ time_reset();
+
w2_sercomm_main();
+ unsigned long sercomm_time = get_ms();
w2_errcatch_main();
+ unsigned long errcatch_time = get_ms() - sercomm_time;
w2_io_main();
-
- time_reset();
+ unsigned long io_time = get_ms() - errcatch_time;
w2_modes_main();
- unsigned long elapsed_ms = get_ms();
- if (elapsed_ms > W2_MAX_MODULE_CYCLE_MS) w2_errcatch_throw(W2_ERR_CYCLE_EXPIRED);
+ unsigned long mode_time = get_ms() - io_time;
+
+ #ifdef W2_SIM
+ siminfo("sercomm: %lums\n", sercomm_time);
+ siminfo("errcatch: %lums\n", errcatch_time);
+ siminfo("io: %lums\n", io_time);
+ siminfo("mode: %lums\n", mode_time);
+
+ usleep(100e3);
+ #endif
+
+ if (mode_time > W2_MAX_MODULE_CYCLE_MS) w2_errcatch_throw(W2_ERR_CYCLE_EXPIRED);
}