pike.git / src / threads.c

version» Context lines:

pike.git/src/threads.c:276: Inside #if defined(SIMULATE_COND_WITH_EVENT)
   if(t) return -1;    mt_destroy(& c->lock);    return 0;   }      #else /* !SIMULATE_COND_WITH_EVENT */      #ifndef CONFIGURE_TEST   PMOD_EXPORT int co_wait_timeout(COND_T *c, PIKE_MUTEX_T *m, long s, long nanos)   { +  struct timeval ct;   #ifdef POSIX_THREADS    struct timespec timeout;   #ifdef HAVE_PTHREAD_COND_RELTIMEDWAIT_NP    /* Solaris extension: relative timeout. */    timeout.tv_sec = s;    timeout.tv_nsec = nanos;    return pthread_cond_reltimedwait_np(c, m, &timeout);   #else /* !HAVE_PTHREAD_COND_RELTIMEDWAIT_NP */    /* Absolute timeout. */ -  GETTIMEOFDAY(&current_time); -  timeout.tv_sec = current_time.tv_sec + s; -  timeout.tv_nsec = current_time.tv_usec * 1000 + nanos; +  ACCURATE_GETTIMEOFDAY(&ct); +  timeout.tv_sec = ct.tv_sec + s; +  timeout.tv_nsec = ct.tv_usec * 1000 + nanos;    return pthread_cond_timedwait(c, m, &timeout);   #endif /* HAVE_PTHREAD_COND_RELTIMEDWAIT_NP */   #else /* !POSIX_THREADS */   #error co_wait_timeout does not support this thread model.   #endif /* POSIX_THREADS */   }   #endif /* !CONFIGURE_TEST */      #endif /* SIMULATE_COND_WITH_EVENT */   
pike.git/src/threads.c:1493:   #elif defined(HAVE_MACH_TASK_INFO_H) && defined(TASK_THREAD_TIMES_INFO)    {    static struct timeval last_check = { 0, 0 };    task_thread_times_info_data_t info;    mach_msg_type_number_t info_size = TASK_THREAD_TIMES_INFO_COUNT;       /* Before making an expensive call to task_info() we perform a    preliminary check that at least 35 ms real time has passed. If    not yet true we'll postpone the next check a full interval. */    struct timeval tv; -  if (GETTIMEOFDAY(&tv) == 0) { +  if (ACCURATE_GETTIMEOFDAY(&tv) == 0) {   #ifdef INT64    static INT64 real_time_last_check = 0;    INT64 real_time_now = tv.tv_sec * 1000000 + tv.tv_usec;    if (real_time_now - real_time_last_check < 35000)    return;    real_time_last_check = real_time_now;   #else    static struct timeval real_time_last_check = { 0, 0 };    struct timeval diff;    timersub(&real_time_now, &real_time_last_check, &diff);
pike.git/src/threads.c:1581: Inside #if defined(PROFILE_CHECK_THREADS), #if 0 and #if defined(USE_CLOCK_FOR_SLICES)
   double slice_time =    (double) (clock() - thread_start_clock) / CLOCKS_PER_SEC;    double delta = slice_time - slice_int_mean;    slice_int_n++;    slice_int_mean += delta / slice_int_n;    slice_int_m2 += delta * (slice_time - slice_int_mean);    }   #endif   #endif    -  GETTIMEOFDAY (&now); +  ACCURATE_GETTIMEOFDAY (&now);    if (now.tv_sec > last_time) {    fprintf (stderr, "[%d:%f] check_threads: %lu calls, "    "%lu clocks, %lu no advs, %lu yields"   #if 0    ", slice %.3f:%.1e, tsc int %.2e:%.1e, tsc tgt %.2e:%.1e"   #endif    ", tps %g:%.1e\n",    getpid(), get_real_time() * (1.0 / CPU_TIME_TICKS),    calls, clock_checks, no_clock_advs, yields,   #if 0