2012-07-23
2012-07-23 10:01:58 by 0
-
c0402da2c124f2fc91fe888fd2391a6c35237314
(11 lines)
(+6/-5)
[
Show
| Annotate
]
Branch: 7.9
On Darwin, clock_t is unsigned so Clang warns about comparison always
being false.
1387: Inside #if defined(RDTSC) && defined(USE_CLOCK_FOR_SLICES)
* out. Another is the often lousy clock(3) resolution. */
if (prev_tsc) {
- clock_t tsc_interval_time = clock_now - prev_clock;
- if (tsc_interval_time > 0) {
+ if (clock_now > prev_clock) {
/* Estimate the next interval just by extrapolating the
* tsc/clock ratio of the last one. This adapts very
* quickly but is also very "jumpy". That shouldn't matter
1401: Inside #if defined(RDTSC) && defined(USE_CLOCK_FOR_SLICES)
* (100 times/sec on linux/glibc 2.x). It also has the
* effect that the actual tsc intervals will be closer to
* 1/200 sec. */
+ clock_t tsc_interval_time = clock_now - prev_clock;
INT64 new_target_int =
(tsc_elapsed * (CLOCKS_PER_SEC / 400)) / tsc_interval_time;
if (new_target_int < target_int << 2)
1436: Inside #if defined(RDTSC) && defined(USE_CLOCK_FOR_SLICES)
* round on the old estimate, keeping prev_tsc and
* prev_clock fixed to get a longer interval for the next
* measurement. */
- if (tsc_interval_time < 0) {
+ if (clock_now < prev_clock) {
/* clock() wraps around fairly often as well. We still
* keep the old interval but update the baselines in this
* case. */
1460: Inside #if defined(RDTSC) && defined(USE_CLOCK_FOR_SLICES)
prev_tsc = tsc_now;
}
- if (clock_now - thread_start_clock < 0)
+ if (clock_now < thread_start_clock)
/* clock counter has wrapped since the start of the time
* slice. Let's reset and yield. */
thread_start_clock = 0;
1552:
#elif defined (USE_CLOCK_FOR_SLICES)
{
clock_t clock_now = clock();
- if (clock_now - thread_start_clock < 0)
+ if (clock_now < thread_start_clock)
/* clock counter has wrapped since the start of the time slice.
* Let's reset and yield. */
thread_start_clock = 0;