-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathgptl.h
188 lines (167 loc) · 6.6 KB
/
gptl.h
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
/*
** $Id: gptl.h,v 1.59 2011-03-28 20:55:19 rosinski Exp $
**
** Author: Jim Rosinski
**
** GPTL header file to be included in user code
*/
#ifndef GPTL_H
#define GPTL_H
#ifdef INCLUDE_CMAKE_FCI
#include "cmake_fortran_c_interface.h"
#endif
/* following block for camtimers only */
#ifndef NO_GETTIMEOFDAY
#ifndef HAVE_GETTIMEOFDAY
#define HAVE_GETTIMEOFDAY
#endif
#endif
#ifdef SPMD
#undef HAVE_MPI
#define HAVE_MPI
#endif
#ifdef _OPENMP
#ifndef THREADED_PTHREADS
#define THREADED_OMP
#endif
#endif
/* above block for camtimers only */
#ifdef HAVE_MPI
#include <mpi.h>
#endif
/*
** Options settable by a call to GPTLsetoption() (default in parens)
** These numbers need to be small integers because GPTLsetoption can
** be passed PAPI counters, and we need to avoid collisions in that
** integer space. PAPI presets are big negative integers, and PAPI
** native events are big positive integers.
*/
typedef enum {
GPTLsync_mpi = 0, /* Synchronize before certain MPI calls (PMPI-mode only) */
GPTLwall = 1, /* Collect wallclock stats (true) */
GPTLcpu = 2, /* Collect CPU stats (false)*/
GPTLabort_on_error = 3, /* Abort on failure (false) */
GPTLoverhead = 4, /* Estimate overhead of underlying timing routine (true) */
GPTLdepthlimit = 5, /* Only print timers this depth or less in the tree (inf) */
GPTLverbose = 6, /* Verbose output (false) */
GPTLnarrowprint = 7, /* Print PAPI and derived stats in 8 columns not 16 (true) */
GPTLpercent = 9, /* Add a column for percent of first timer (false) */
GPTLpersec = 10, /* Add a PAPI column that prints "per second" stats (true) */
GPTLmultiplex = 11, /* Allow PAPI multiplexing (false) */
GPTLdopr_preamble = 12, /* Print preamble info (true) */
GPTLdopr_threadsort = 13, /* Print sorted thread stats (true) */
GPTLdopr_multparent = 14, /* Print multiple parent info (true) */
GPTLdopr_collision = 15, /* Print hastable collision info (true) */
GPTLprint_method = 16, /* Tree print method: first parent, last parent
most frequent, or full tree (most frequent) */
GPTLprint_mode = 50, /* Write mode for output file (overwrite, append) */
GPTLtablesize = 51, /* per-thread size of hash table (1024) */
GPTLmaxthreads = 52, /* maximum number of threads */
/*
** These are derived counters based on PAPI counters. All default to false
*/
GPTL_IPC = 17, /* Instructions per cycle */
GPTL_CI = 18, /* Computational intensity */
GPTL_FPC = 19, /* FP ops per cycle */
GPTL_FPI = 20, /* FP ops per instruction */
GPTL_LSTPI = 21, /* Load-store instruction fraction */
GPTL_DCMRT = 22, /* L1 miss rate (fraction) */
GPTL_LSTPDCM = 23, /* Load-stores per L1 miss */
GPTL_L2MRT = 24, /* L2 miss rate (fraction) */
GPTL_LSTPL2M = 25, /* Load-stores per L2 miss */
GPTL_L3MRT = 26, /* L3 read miss rate (fraction) */
/*
** New ESMF options for GPTL
*/
GPTLprofile_ovhd = 27, /* Direct measurement of profiling overhead (false) */
GPTLdopr_quotes = 28 /* Add double quotes to timer names on output (false) */
} Option;
/*
** Underlying wallclock timer: optimize for best granularity with least overhead.
** These numbers need not be distinct from the above because these are passed
** to GPTLsetutr() and the above are passed to GPTLsetoption()
*/
typedef enum {
GPTLgettimeofday = 1, /* the default */
GPTLnanotime = 2, /* only available on x86 */
GPTLmpiwtime = 4, /* MPI_Wtime */
GPTLclockgettime = 5, /* clock_gettime */
GPTLpapitime = 6, /* only if PAPI is available */
GPTLread_real_time = 3 /* AIX only */
} Funcoption;
/*
** How to report parent/child relationships at print time (for children with multiple parents)
*/
typedef enum {
GPTLfirst_parent = 1, /* first parent found */
GPTLlast_parent = 2, /* last parent found */
GPTLmost_frequent = 3, /* most frequent parent (default) */
GPTLfull_tree = 4 /* complete call tree */
} Method;
/*
** Whether to overwrite or append to output file
*/
typedef enum {
GPTLprint_write = 1, /* overwrite */
GPTLprint_append = 2, /* append */
} PRMode;
/*
** Function prototypes
*/
#ifdef __cplusplus
extern "C" {
#endif
extern int GPTLsetoption (const int, const int);
extern int GPTLinitialize (void);
extern int GPTLprefix_set (const char *);
extern int GPTLprefix_setf (const char *, const int);
extern int GPTLprefix_unset (void);
extern int GPTLstart (const char *);
extern int GPTLstart_handle (const char *, void **);
extern int GPTLstartf (const char *, const int);
extern int GPTLstartf_virtual (const char *, int *, const int);
extern int GPTLstartf_handle (const char *, const int, void **);
extern int GPTLstop (const char *);
extern int GPTLstopf (const char *, const int);
extern int GPTLstopf_virtual (const char *, int *, const int);
extern int GPTLstop_handle (const char *, void **);
extern int GPTLstopf_handle (const char *, const int, void **);
extern int GPTLstartstop_vals (const char *, double, int);
extern int GPTLstartstop_valsf (const char *, const int, double, int);
extern int GPTLrecordf (const char *, int *, int *, double *,
double *, double *, const int);
extern int GPTLstamp (double *, double *, double *);
extern int GPTLprint_mode_query (void);
extern int GPTLprint_mode_set (const int);
extern int GPTLpr (const int);
extern int GPTLpr_file (const char *);
#ifdef HAVE_MPI
extern int GPTLpr_summary (MPI_Comm comm);
extern int GPTLpr_summary_file (MPI_Comm, const char *);
extern int GPTLbarrier (MPI_Comm comm, const char *);
#else
extern int GPTLpr_summary (int);
extern int GPTLpr_summary_file (int, const char *);
extern int GPTLbarrier (int, const char *);
#endif
extern int GPTLreset (void);
extern int GPTLfinalize (void);
extern int GPTLget_memusage (int *, int *, int *, int *, int *);
extern int GPTLprint_memusage (const char *);
extern int GPTLenable (void);
extern int GPTLdisable (void);
extern int GPTLsetutr (const int);
extern int GPTLquery (const char *, int, int *, int *, double *, double *, double *,
long long *, const int);
extern int GPTLquerycounters (const char *, int, long long *);
extern int GPTLget_wallclock (const char *, int, double *);
extern int GPTLget_eventvalue (const char *, const char *, int, double *);
extern int GPTLget_nregions (int, int *);
extern int GPTLget_regionname (int, int, char *, int);
extern int GPTL_PAPIlibraryinit (void);
extern int GPTLevent_name_to_code (const char *, int *);
extern int GPTLevent_code_to_name (const int, char *);
#ifdef __cplusplus
}
#endif
#endif