1 /* -----------------------------------------------------------------------------
3 * (c) The GHC Team, 1998-1999
5 * Profiling interval timer
7 * ---------------------------------------------------------------------------*/
9 #include "PosixSource.h"
12 #include "Profiling.h"
14 #include "Proftimer.h"
17 static rtsBool do_prof_ticks = rtsFalse; // enable profiling ticks
18 static rtsBool do_heap_prof_ticks = rtsFalse; // enable heap profiling ticks
20 // Number of ticks until next heap census
21 static int ticks_to_heap_profile;
23 // Time for a heap profile on the next context switch
24 rtsBool performHeapProfile;
29 do_prof_ticks = rtsFalse;
33 startProfTimer( void )
35 do_prof_ticks = rtsTrue;
39 stopHeapProfTimer( void )
41 do_heap_prof_ticks = rtsFalse;
45 startHeapProfTimer( void )
47 if (RtsFlags.ProfFlags.doHeapProfile &&
48 RtsFlags.ProfFlags.profileIntervalTicks > 0) {
49 do_heap_prof_ticks = rtsTrue;
56 performHeapProfile = rtsFalse;
58 ticks_to_heap_profile = RtsFlags.ProfFlags.profileIntervalTicks;
73 if (do_heap_prof_ticks) {
74 ticks_to_heap_profile--;
75 if (ticks_to_heap_profile <= 0) {
76 ticks_to_heap_profile = RtsFlags.ProfFlags.profileIntervalTicks;
77 performHeapProfile = rtsTrue;