Commit e873a4ea authored by pku2402010330's avatar pku2402010330
Browse files

debug sleep

parent 59d83fbd
No related merge requests found
Showing with 3 additions and 1 deletion
+3 -1
......@@ -259,8 +259,10 @@ sys_nanosleep(void)
time0 = time;
acquire(&tickslock);
uint64 target_ticks = tv_sec * TICKS_PER_SECOND + (tv_nsec * TICKS_PER_SECOND) / 1000000000;
// Include nanoseconds in the sleep time calculation
while(time - time0 < tv_sec * TICKS_PER_SECOND + tv_nsec / (1000000000 / TICKS_PER_SECOND)) {
while(time - time0 < target_ticks) {
printf("time = %llu, time0 = %llu, tv_sec = %llu, tv_nsec = %llu\n", time, time0, tv_sec, tv_nsec);
printf("Sleeping... Time elapsed: %llu, target: %llu\n", time - time0, tv_sec * TICKS_PER_SECOND + tv_nsec / (1000000000 / TICKS_PER_SECOND));
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment