Skip to content

Commit

Permalink
Remove commented out incorrect precision timer code
Browse files Browse the repository at this point in the history
  • Loading branch information
ghaerr committed Oct 31, 2024
1 parent 9374e88 commit d0671aa
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 18 deletions.
9 changes: 0 additions & 9 deletions elks/arch/i86/lib/prectimer.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,21 +113,12 @@ unsigned long get_ptime(void)
count = lo | hi;
pticks = lastcount - count;
lastcount = count;
#if 1
if ((int)pticks < 0) { /* wrapped, jiffies is higher */
pticks += MAX_PTICK; /* = MAX_PTICK - count + lastcount */
jdiff--; /* adjust jiffies for wrap, won't ever be negative */
}
if (jdiff < 4286) /* < ~42.86s */
return jdiff * (unsigned long)MAX_PTICK + pticks;
#else /* incorrect (old) version - to be removed */
if ((int)pticks < 0) /* wrapped */
pticks += MAX_PTICK; /* = MAX_PTICK - count + lastcount */
if (jdiff < 2) /* < 10ms: 1..11931 */
return pticks;
if (jdiff < 4286) /* < ~42.86s */
return (jdiff - 1) * (unsigned long)MAX_PTICK + pticks;
#endif
return 0; /* overflow displays 0s */
}

Expand Down
9 changes: 0 additions & 9 deletions libc/debug/prectimer.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,21 +113,12 @@ unsigned long get_ptime(void)
count = lo | hi;
pticks = lastcount - count;
lastcount = count;
#if 1
if ((int)pticks < 0) { /* wrapped, jiffies is higher */
pticks += MAX_PTICK; /* = MAX_PTICK - count + lastcount */
jdiff--; /* adjust jiffies for wrap, won't ever be negative */
}
if (jdiff < 4286) /* < ~42.86s */
return jdiff * (unsigned long)MAX_PTICK + pticks;
#else /* incorrect (old) version - to be removed */
if ((int)pticks < 0) /* wrapped */
pticks += MAX_PTICK; /* = MAX_PTICK - count + lastcount */
if (jdiff < 2) /* < 10ms: 1..11931 */
return pticks;
if (jdiff < 4286) /* < ~42.86s */
return (jdiff - 1) * (unsigned long)MAX_PTICK + pticks;
#endif
return 0; /* overflow displays 0s */
}

Expand Down

0 comments on commit d0671aa

Please sign in to comment.