masters-thesis/listings/rdtscp_wait.c
Dennis af25b4b828 Initial commit of master's thesis
This is the version I submitted to RWTH Aachen University at November 9,
2018.
2018-11-12 12:56:59 +01:00

15 lines
214 B
C

uint64_t task_wait(struct task *t)
{
int ret;
uint64_t steps, now;
do {
now = rdtscp();
} while (now < t->next);
for (steps = 0; t->next < now; steps++)
t->next += t->period;
return steps;
}