pike.git / src / threads.c

version» Context lines:

pike.git/src/threads.c:1326: Inside #if defined(RDTSC) && defined(USE_CLOCK_FOR_SLICES) and #if defined(PROFILE_CHECK_THREADS)
   double delta = tsc_elapsed - tsc_int_mean;    tsc_int_n++;    tsc_int_mean += delta / tsc_int_n;    tsc_int_m2 += delta * (tsc_elapsed - tsc_int_mean);    }    clock_checks++;   #endif       elapsed = clock() - thread_start_clock;    +  if (thread_start_clock && prev_tsc) {    if (elapsed < (clock_t) (CLOCKS_PER_SEC/30)) {    tsc_mincycles |= 0xffff;    if ((tsc_elapsed - target_int)<=(tsc_mincycles<<4))    tsc_mincycles += (tsc_mincycles>>1);    target_int = (tsc_mincycles>>1);    return;    }    if (elapsed > (clock_t) (CLOCKS_PER_SEC/18)) {    tsc_mincycles -= tsc_mincycles>>2;    if (elapsed > (clock_t) (CLOCKS_PER_SEC/10))    tsc_mincycles >>= 2;    } -  +  } +     target_int = tsc_mincycles;    prev_tsc = now; -  +     goto do_yield;    }   #endif /* RDTSC && USE_CLOCK_FOR_SLICES */      #ifdef HAVE_GETHRTIME    {    static hrtime_t last_ = 0;    hrtime_t now = gethrtime();    if( now-last_ < 50000000 ) /* 0.05s slice */    return;