diff --git a/src/interpret.c b/src/interpret.c index 09b9cfc19806493a55bac4c20d5113d4700e9ece..148dac6a219b18e8d7ff1e6ba79f87fd668ae0b6 100644 --- a/src/interpret.c +++ b/src/interpret.c @@ -4,7 +4,7 @@ ||| See the files COPYING and DISCLAIMER for more information. \*/ #include "global.h" -RCSID("$Id: interpret.c,v 1.107 1998/11/20 08:38:12 hubbe Exp $"); +RCSID("$Id: interpret.c,v 1.108 1998/11/20 18:38:44 hubbe Exp $"); #include "interpret.h" #include "object.h" #include "program.h" @@ -1808,6 +1808,12 @@ void mega_apply(enum apply_type type, INT32 args, void *arg1, void *arg2) long long children_base = accounted_time; long long start_time = gethrtime() - time_base; unsigned INT32 self_time_base; + if(start_time < 0) + { + fatal("gethrtime() shrunk\n start_time=%ld\n time_base=%ld\n", + (long)(start_time/100000), + (long)(time_base/100000)); + } #endif #endif diff --git a/src/threads.h b/src/threads.h index 098c5a6512cbe2ea24bcc17ddc4722d661006da9..89af21e37639b5e37a966cedb3f7cfc05d1613dc 100644 --- a/src/threads.h +++ b/src/threads.h @@ -1,5 +1,5 @@ /* - * $Id: threads.h,v 1.56 1998/11/20 08:18:54 hubbe Exp $ + * $Id: threads.h,v 1.57 1998/11/20 18:38:46 hubbe Exp $ */ #ifndef THREADS_H #define THREADS_H @@ -350,6 +350,12 @@ struct thread_state { #define DO_IF_PROFILING(X) #endif +#ifdef DEBUG +#define DO_IF_DEBUG(X) X +#else +#define DO_IF_DEBUG(X) +#endif + #define SWAP_OUT_THREAD(_tmp) do { \ (_tmp)->swapped=1; \ (_tmp)->evaluator_stack=evaluator_stack;\ @@ -364,6 +370,8 @@ struct thread_state { (_tmp)->thread_id=thread_id;\ DO_IF_PROFILING( (_tmp)->accounted_time=accounted_time; ) \ DO_IF_PROFILING( (_tmp)->time_base = gethrtime() - time_base; ) \ + DO_IF_DEBUG( DO_IF_PROFILING( if(accounted_time<0) fatal("Accounted time out of whack!\n");)) \ + DO_IF_DEBUG( DO_IF_PROFILING( if((_tmp)->time_base<0) fatal("time base out of whack!\n");)) \ SWAP_OUT_TRACE(_tmp); \ } while(0) @@ -381,6 +389,8 @@ struct thread_state { thread_id=(_tmp)->thread_id;\ DO_IF_PROFILING( accounted_time=(_tmp)->accounted_time; ) \ DO_IF_PROFILING( time_base = (_tmp)->time_base + gethrtime(); ) \ + DO_IF_DEBUG( DO_IF_PROFILING( if(accounted_time<0) fatal("Accounted time out of whack!\n");)) \ + DO_IF_DEBUG( DO_IF_PROFILING( if(time_base<0) fatal("time base out of whack!\n");)) \ SWAP_IN_TRACE(_tmp); \ } while(0)