Branch: Tag:

1998-11-20

1998-11-20 01:57:24 by Fredrik Hübinette (Hubbe) <hubbe@hubbe.net>

profiling should now work with threads

Rev: src/interpret.c:1.100
Rev: src/interpret.h:1.23
Rev: src/threads.h:1.54

1:   /* -  * $Id: threads.h,v 1.53 1998/09/05 20:08:27 grubba Exp $ +  * $Id: threads.h,v 1.54 1998/11/20 01:57:24 hubbe Exp $    */   #ifndef THREADS_H   #define THREADS_H
295:    JMP_BUF *recoveries;    struct object * thread_id;    char *stack_top; +  + #ifdef PROFILING + #ifdef HAVE_GETHRTIME +  long long accounted_time; +  long long time_base; + #endif + #endif +    #ifdef THREAD_TRACE    int t_flag;   #endif /* THREAD_TRACE */
336:   #define SWAP_IN_TRACE(_tmp)   #endif /* THREAD_TRACE */    + #if defined(PROFILING) && defined(HAVE_GETHRTIME) + #define DO_IF_PROFILING(X) + #else + #define DO_IF_PROFILING(X) + #endif +    #define SWAP_OUT_THREAD(_tmp) do { \    (_tmp)->swapped=1; \    (_tmp)->evaluator_stack=evaluator_stack;\
348:    (_tmp)->sp=sp; \    (_tmp)->stack_top=stack_top; \    (_tmp)->thread_id=thread_id;\ +  DO_IF_PROFILING( (_tmp)->accounted_time=accounted_time; ) \ +  DO_IF_PROFILING( (_tmp)->time_base = gethrvtime() - time_base; ) \    SWAP_OUT_TRACE(_tmp); \    } while(0)   
363:    sp=(_tmp)->sp;\    stack_top=(_tmp)->stack_top;\    thread_id=(_tmp)->thread_id;\ +  DO_IF_PROFILING( accounted_time=(_tmp)->accounted_time; ) \ +  DO_IF_PROFILING( time_base = (_tmp)->time_base + gethrvtime(); ) \    SWAP_IN_TRACE(_tmp); \    } while(0)