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;
}