summaryrefslogtreecommitdiff
path: root/rts/Profiling.h
blob: 45725e56313cbec827adcbdaf6fcf8084e62a053 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/* -----------------------------------------------------------------------------
 *
 * (c) The GHC Team, 1998-2005
 *
 * Support for profiling
 *
 * ---------------------------------------------------------------------------*/

#pragma once

#include <stdio.h>

#include "BeginPrivate.h"
#include "Rts.h"

#if defined(PROFILING)
#define PROFILING_ONLY(s) s
#else
#define PROFILING_ONLY(s) doNothing()
#endif

void initProfiling  (void);
void initProfiling2 (void);
void endProfiling   (void);
void freeProfiling  (void);

extern FILE *prof_file;
extern FILE *hp_file;

/* A summary of an execution of a profiled program */
typedef struct {
    /* Total bytes allocated */
    uint64_t total_alloc;
    /* Total number of profiler ticks */
    unsigned int total_prof_ticks;
} ProfilerTotals;

#if defined(PROFILING)

void reportCCSProfiling ( void );

void fprintCCS( FILE *f, CostCentreStack *ccs );
void fprintCCS_stderr (CostCentreStack *ccs, StgClosure *exception, StgTSO *tso);

bool ignoreCCS (CostCentreStack const *ccs);
bool ignoreCC (CostCentre const *cc);

#if defined(DEBUG)
void debugCCS( CostCentreStack *ccs );
#endif

#endif

#include "EndPrivate.h"