1 /* -----------------------------------------------------------------------------
3 * (c) The GHC Team, 1998-1999
5 * Profiling interval timer
7 * ---------------------------------------------------------------------------*/
9 #include "PosixSource.h"
12 #include "Profiling.h"
13 #include "Proftimer.h"
16 static rtsBool do_prof_ticks = rtsFalse; // enable profiling ticks
19 static rtsBool do_heap_prof_ticks = rtsFalse; // enable heap profiling ticks
21 // Number of ticks until next heap census
22 static int ticks_to_heap_profile;
24 // Time for a heap profile on the next context switch
25 rtsBool performHeapProfile;
32 do_prof_ticks = rtsFalse;
36 startProfTimer( void )
38 do_prof_ticks = rtsTrue;
44 stopHeapProfTimer( void )
46 do_heap_prof_ticks = rtsFalse;
50 startHeapProfTimer( void )
52 if (RtsFlags.ProfFlags.doHeapProfile &&
53 RtsFlags.ProfFlags.profileIntervalTicks > 0) {
54 do_heap_prof_ticks = rtsTrue;
61 performHeapProfile = rtsFalse;
63 ticks_to_heap_profile = RtsFlags.ProfFlags.profileIntervalTicks;
78 if (do_heap_prof_ticks) {
79 ticks_to_heap_profile--;
80 if (ticks_to_heap_profile <= 0) {
81 ticks_to_heap_profile = RtsFlags.ProfFlags.profileIntervalTicks;
82 performHeapProfile = rtsTrue;