Merge branch 'master' of http://darcs.haskell.org/ghc
[ghc.git] / rts / Stats.h
1 /* -----------------------------------------------------------------------------
2 *
3 * (c) The GHC Team, 1998-2005
4 *
5 * Statistics and timing-related functions.
6 *
7 * ---------------------------------------------------------------------------*/
8
9 #ifndef STATS_H
10 #define STATS_H
11
12 #include "GetTime.h"
13
14 #include "BeginPrivate.h"
15
16 #if defined(mingw32_HOST_OS)
17 /* On Win64, if we say "printf" then gcc thinks we are going to use
18 MS format specifiers like %I64d rather than %llu */
19 #define PRINTF gnu_printf
20 #else
21 /* However, on OS X, "gnu_printf" isn't recognised */
22 #define PRINTF printf
23 #endif
24
25 struct gc_thread_;
26
27 void stat_startInit(void);
28 void stat_endInit(void);
29
30 void stat_startGC(Capability *cap, struct gc_thread_ *_gct);
31 void stat_endGC (Capability *cap, struct gc_thread_ *_gct,
32 W_ alloc, W_ live, W_ copied, W_ slop, nat gen,
33 nat n_gc_threads, W_ par_max_copied, W_ par_tot_copied);
34
35 void stat_gcWorkerThreadStart (struct gc_thread_ *_gct);
36 void stat_gcWorkerThreadDone (struct gc_thread_ *_gct);
37
38 #ifdef PROFILING
39 void stat_startRP(void);
40 void stat_endRP(nat,
41 #ifdef DEBUG_RETAINER
42 nat, int,
43 #endif
44 double);
45 #endif /* PROFILING */
46
47 #if defined(PROFILING) || defined(DEBUG)
48 void stat_startHeapCensus(void);
49 void stat_endHeapCensus(void);
50 #endif
51
52 void stat_startExit(void);
53 void stat_endExit(void);
54
55 void stat_exit(int alloc);
56 void stat_workerStop(void);
57
58 void initStats0(void);
59 void initStats1(void);
60
61 double mut_user_time_until(Time t);
62 double mut_user_time(void);
63
64 #ifdef PROFILING
65 double mut_user_time_during_RP(void);
66 double mut_user_time_during_heap_census(void);
67 #endif /* PROFILING */
68
69 void statDescribeGens( void );
70
71 Time stat_getElapsedGCTime(void);
72 Time stat_getElapsedTime(void);
73
74 /* Only exported for Papi.c */
75 void statsPrintf( char *s, ... )
76 GNUC3_ATTRIBUTE(format (PRINTF, 1, 2));
77
78 #include "EndPrivate.h"
79
80 #endif /* STATS_H */