pike.git / src / threads.c

version» Context lines:

pike.git/src/threads.c:373:   static clock_t prev_clock; /* clock() at the beg of the last tsc interval */   #endif   #endif      #define THIS_THREAD ((struct thread_state *)CURRENT_STORAGE)      static struct callback *threads_evaluator_callback=0;      PMOD_EXPORT int num_threads = 1;   PMOD_EXPORT int threads_disabled = 0; + PMOD_EXPORT cpu_time_t threads_disabled_acc_time = 0; + PMOD_EXPORT cpu_time_t threads_disabled_start = 0;      #ifdef PIKE_DEBUG   static THREAD_T threads_disabled_thread = 0;   #endif   #ifdef INTERNAL_PROFILING   PMOD_EXPORT unsigned long thread_yields = 0;   #endif   static int th_running = 0;   static MUTEX_T interpreter_lock;   static MUTEX_T interpreter_lock_wanted;
pike.git/src/threads.c:894:    mt_lock(&(im->lock));       im = im->next;    }    }       THREADS_FPRINTF(0, (stderr,    "low_init_threads_disable(): Disabling threads.\n"));       threads_disabled = 1; +  threads_disabled_start = get_real_time();   #ifdef PIKE_DEBUG    threads_disabled_thread = th_self();   #endif    } else {    threads_disabled++;    }       THREADS_FPRINTF(0,    (stderr, "low_init_threads_disable(): threads_disabled:%d\n",    threads_disabled));
pike.git/src/threads.c:951:    }   }      void exit_threads_disable(struct object *UNUSED(o))   {    THREADS_FPRINTF(0, (stderr, "exit_threads_disable(): threads_disabled:%d\n",    threads_disabled));    if(threads_disabled) {    if(!--threads_disabled) {    IMUTEX_T *im = (IMUTEX_T *)interleave_list; +  threads_disabled_acc_time += get_real_time() - threads_disabled_start;       /* Order shouldn't matter for unlock, so no need to do it backwards. */    while(im) {    THREADS_FPRINTF(0, (stderr,    "exit_threads_disable(): Unlocking IM %p\n", im));    mt_unlock(&(im->lock));    im = im->next;    }       mt_unlock(&interleave_lock);