X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Fruntime%2Fprofiling%2FTimer.lc;h=10f95293275c106c867e031cba46c5989fc65b62;hb=967cc47f37cb93a5e2b6df7822c9a646f0428247;hp=c76ad4aba129490b0596fb5078e2d93f17063ea2;hpb=e7d21ee4f8ac907665a7e170c71d59e13a01da09;p=ghc-hetmet.git diff --git a/ghc/runtime/profiling/Timer.lc b/ghc/runtime/profiling/Timer.lc index c76ad4a..10f9529 100644 --- a/ghc/runtime/profiling/Timer.lc +++ b/ghc/runtime/profiling/Timer.lc @@ -1,9 +1,9 @@ -Only have cost centres etc if @USE_COST_CENTRES@ defined +Only have cost centres etc if @PROFILING@ defined \begin{code} #include "rtsdefs.h" -#if defined (USE_COST_CENTRES) || defined(GUM) +#if defined (PROFILING) || defined(PAR) \end{code} %************************************************************************ @@ -26,13 +26,8 @@ I_ interval_ticks = DEFAULT_INTERVAL; /* No of ticks in an interval */ I_ previous_ticks = 0; /* ticks in previous intervals */ I_ current_ticks = 0; /* ticks in current interval */ -#ifdef CONCURRENT -I_ tick_millisecs; /* milliseconds per timer tick */ -#endif - void -set_profile_timer(ms) -I_ ms; +set_profile_timer(I_ ms) { if (initialize_virtual_timer(ms)) { fflush(stdout); @@ -47,14 +42,22 @@ handle_tick_serial(STG_NO_ARGS) CC_TICK(CCC); /* fprintf(stderr,"tick for %s\n", CCC->label); */ -#if defined(USE_COST_CENTRES) && defined(DEBUG) +#if defined(PROFILING) && defined(DEBUG) /* Why is this here? --JSM Debugging --WDP */ if (CCC == STATIC_CC_REF(CC_OVERHEAD)) abort(); #endif +#if 0 + /* Experimental - don't tick if we're in the middle + of reporting a cc_profile. Untested. + */ + if (interval_expired) + return; +#endif + if (++current_ticks >= interval_ticks && CCC != STATIC_CC_REF(CC_GC)) { -#if defined(USE_COST_CENTRES) +#if defined(PROFILING) interval_expired = 1; /* stop to process interval */ #else report_cc_profiling(0 /*partial*/); @@ -68,6 +71,7 @@ void handle_tick_noserial(STG_NO_ARGS) { CC_TICK(CCC); + ++current_ticks; return; } @@ -82,7 +86,7 @@ stop_time_profiler() void restart_time_profiler() { /* Restarts time profile */ -#if defined(USE_COST_CENTRES) +#if defined(PROFILING) if (interval_expired) #endif { @@ -97,8 +101,8 @@ void start_time_profiler() { /* Starts time profile */ if (time_profiling) { -#ifdef CONCURRENT - set_profile_timer(tick_millisecs); +#ifdef PAR + set_profile_timer(RTSflags.CcFlags.msecsPerTick); #else set_profile_timer(TICK_MILLISECS); #endif @@ -107,5 +111,5 @@ start_time_profiler() \end{code} \begin{code} -#endif /* USE_COST_CENTRES || GUM */ +#endif /* PROFILING || PAR */ \end{code}