PIO  1.7.1
 All Classes Files Functions Groups Pages
gptl.h
1 /*
2 ** $Id: gptl.h,v 1.59 2011-03-28 20:55:19 rosinski Exp $
3 **
4 ** Author: Jim Rosinski
5 **
6 ** GPTL header file to be included in user code
7 */
8 
9 #ifndef GPTL_H
10 #define GPTL_H
11 
12 #ifdef INCLUDE_CMAKE_FCI
13 #include "cmake_fortran_c_interface.h"
14 #endif
15 
16 /* following block for camtimers only */
17 #ifndef NO_GETTIMEOFDAY
18 #define HAVE_GETTIMEOFDAY
19 #endif
20 
21 #ifdef SPMD
22 #define HAVE_MPI
23 #endif
24 
25 #ifdef _OPENMP
26 #ifndef THREADED_PTHREADS
27 #define THREADED_OMP
28 #endif
29 #endif
30 /* above block for camtimers only */
31 
32 #ifdef HAVE_MPI
33 #include <mpi.h>
34 #endif
35 
36 /*
37 ** Options settable by a call to GPTLsetoption() (default in parens)
38 ** These numbers need to be small integers because GPTLsetoption can
39 ** be passed PAPI counters, and we need to avoid collisions in that
40 ** integer space. PAPI presets are big negative integers, and PAPI
41 ** native events are big positive integers.
42 */
43 
44 typedef enum {
45  GPTLsync_mpi = 0, /* Synchronize before certain MPI calls (PMPI-mode only) */
46  GPTLwall = 1, /* Collect wallclock stats (true) */
47  GPTLcpu = 2, /* Collect CPU stats (false)*/
48  GPTLabort_on_error = 3, /* Abort on failure (false) */
49  GPTLoverhead = 4, /* Estimate overhead of underlying timing routine (true) */
50  GPTLdepthlimit = 5, /* Only print timers this depth or less in the tree (inf) */
51  GPTLverbose = 6, /* Verbose output (false) */
52  GPTLnarrowprint = 7, /* Print PAPI and derived stats in 8 columns not 16 (true) */
53  GPTLpercent = 9, /* Add a column for percent of first timer (false) */
54  GPTLpersec = 10, /* Add a PAPI column that prints "per second" stats (true) */
55  GPTLmultiplex = 11, /* Allow PAPI multiplexing (false) */
56  GPTLdopr_preamble = 12, /* Print preamble info (true) */
57  GPTLdopr_threadsort = 13, /* Print sorted thread stats (true) */
58  GPTLdopr_multparent = 14, /* Print multiple parent info (true) */
59  GPTLdopr_collision = 15, /* Print hastable collision info (true) */
60  GPTLprint_method = 16, /* Tree print method: first parent, last parent
61  most frequent, or full tree (most frequent) */
62  GPTLtablesize = 50, /* per-thread size of hash table (1024) */
63  /*
64  ** These are derived counters based on PAPI counters. All default to false
65  */
66  GPTL_IPC = 17, /* Instructions per cycle */
67  GPTL_CI = 18, /* Computational intensity */
68  GPTL_FPC = 19, /* FP ops per cycle */
69  GPTL_FPI = 20, /* FP ops per instruction */
70  GPTL_LSTPI = 21, /* Load-store instruction fraction */
71  GPTL_DCMRT = 22, /* L1 miss rate (fraction) */
72  GPTL_LSTPDCM = 23, /* Load-stores per L1 miss */
73  GPTL_L2MRT = 24, /* L2 miss rate (fraction) */
74  GPTL_LSTPL2M = 25, /* Load-stores per L2 miss */
75  GPTL_L3MRT = 26 /* L3 read miss rate (fraction) */
76 } Option;
77 
78 /*
79 ** Underlying wallclock timer: optimize for best granularity with least overhead.
80 ** These numbers need not be distinct from the above because these are passed
81 ** to GPTLsetutr() and the above are passed to GPTLsetoption()
82 */
83 
84 typedef enum {
85  GPTLgettimeofday = 1, /* the default */
86  GPTLnanotime = 2, /* only available on x86 */
87  GPTLmpiwtime = 4, /* MPI_Wtime */
88  GPTLclockgettime = 5, /* clock_gettime */
89  GPTLpapitime = 6, /* only if PAPI is available */
90  GPTLread_real_time = 3 /* AIX only */
91 } Funcoption;
92 
93 /*
94 ** How to report parent/child relationships at print time (for children with multiple parents)
95 */
96 
97 typedef enum {
98  GPTLfirst_parent = 1, /* first parent found */
99  GPTLlast_parent = 2, /* last parent found */
100  GPTLmost_frequent = 3, /* most frequent parent (default) */
101  GPTLfull_tree = 4 /* complete call tree */
102 } Method;
103 
104 /*
105 ** Function prototypes
106 */
107 
108 #ifdef __cplusplus
109 extern "C" {
110 #endif
111 
112 extern int GPTLsetoption (const int, const int);
113 extern int GPTLinitialize (void);
114 extern int GPTLstart (const char *);
115 extern int GPTLstart_handle (const char *, void **);
116 extern int GPTLstop (const char *);
117 extern int GPTLstop_handle (const char *, void **);
118 extern int GPTLstamp (double *, double *, double *);
119 extern int GPTLpr_set_append (void);
120 extern int GPTLpr_query_append (void);
121 extern int GPTLpr_set_write (void);
122 extern int GPTLpr_query_write (void);
123 extern int GPTLpr (const int);
124 extern int GPTLpr_file (const char *);
125 
126 #ifdef HAVE_MPI
127 extern int GPTLpr_summary (MPI_Comm comm);
128 extern int GPTLpr_summary_file (MPI_Comm, const char *);
129 extern int GPTLbarrier (MPI_Comm comm, const char *);
130 #else
131 extern int GPTLpr_summary (int);
132 extern int GPTLpr_summary_file (int, const char *);
133 extern int GPTLbarrier (int, const char *);
134 #endif
135 
136 extern int GPTLreset (void);
137 extern int GPTLfinalize (void);
138 extern int GPTLget_memusage (int *, int *, int *, int *, int *);
139 extern int GPTLprint_memusage (const char *);
140 extern int GPTLenable (void);
141 extern int GPTLdisable (void);
142 extern int GPTLsetutr (const int);
143 extern int GPTLquery (const char *, int, int *, int *, double *, double *, double *,
144  long long *, const int);
145 extern int GPTLquerycounters (const char *, int, long long *);
146 extern int GPTLget_wallclock (const char *, int, double *);
147 extern int GPTLget_eventvalue (const char *, const char *, int, double *);
148 extern int GPTLget_nregions (int, int *);
149 extern int GPTLget_regionname (int, int, char *, int);
150 extern int GPTL_PAPIlibraryinit (void);
151 extern int GPTLevent_name_to_code (const char *, int *);
152 extern int GPTLevent_code_to_name (const int, char *);
153 
154 #ifdef __cplusplus
155 };
156 #endif
157 
158 #endif