Fix #15038
[ghc.git] / rts / Profiling.h
1 /* -----------------------------------------------------------------------------
2 *
3 * (c) The GHC Team, 1998-2005
4 *
5 * Support for profiling
6 *
7 * ---------------------------------------------------------------------------*/
8
9 #pragma once
10
11 #include <stdio.h>
12
13 #include "BeginPrivate.h"
14 #include "Rts.h"
15
16 #if defined(PROFILING)
17 #define PROFILING_ONLY(s) s
18 #else
19 #define PROFILING_ONLY(s) doNothing()
20 #endif
21
22 void initProfiling (void);
23 void initProfiling2 (void);
24 void endProfiling (void);
25 void freeProfiling (void);
26
27 extern FILE *prof_file;
28 extern FILE *hp_file;
29
30 /* A summary of an execution of a profiled program */
31 typedef struct {
32 /* Total bytes allocated */
33 uint64_t total_alloc;
34 /* Total number of profiler ticks */
35 unsigned int total_prof_ticks;
36 } ProfilerTotals;
37
38 #if defined(PROFILING)
39
40 void reportCCSProfiling ( void );
41
42 void fprintCCS( FILE *f, CostCentreStack *ccs );
43 void fprintCCS_stderr (CostCentreStack *ccs, StgClosure *exception, StgTSO *tso);
44
45 bool ignoreCCS (CostCentreStack const *ccs);
46 bool ignoreCC (CostCentre const *cc);
47
48 #if defined(DEBUG)
49 void debugCCS( CostCentreStack *ccs );
50 #endif
51
52 #endif
53
54 #include "EndPrivate.h"