/* * tor > 0 == event is "from" * tor < 0 == event is "to" */ static inline long evt_get(void) { long eid = (ncached == 0) ? evt_create(cos_spd_id()) : evt_cache[--ncached]; assert(eid > 0); return eid; }
void core0_high() { printc("core %ld high prio thd %d running.\n", cos_cpuid(), cos_get_thd_id()); create_thd(0, LOW_PRIO); // creates low on core 0 int i = 0; n_wait = 1; delay(20); evt = evt_create(cos_spd_id()); printc("core %ld created evt %d....\n", cos_cpuid(), evt); int my_ret; u64_t s, e; while (i < ITER) { /* rdtscll(s); */ shared_mem[0] = 2; shared_mem[1] = 4; shared_mem[2] = 6; shared_mem[3] = 8; /* add async inv here. */ /* rdtscll(e); */ /* data[i] = e - s; */ /* printc("core %d ipi sent, going to evt_wait....\n", cos_cpuid()); */ /* rdtscll(c0_high); */ int ret = evt_wait_n(cos_spd_id(), evt, n_wait); my_ret = shared_ret; rdtscll(e); data[i] = e - c0_tsc; assert(my_ret == 10); /* printc("core %d up from evt_wait....\n", cos_cpuid()); */ i++; } printc("core %ld test done, going to output...\n", cos_cpuid()); output(); printc("core %ld output done.\n", cos_cpuid()); }