OpenMPI  0.1.1
handler.h
1 /*
2  This is part of the OTF library. Copyright by ZIH, TU Dresden 2005-2012.
3  Authors: Johannes Spazier
4 */
5 
6 #ifndef HANDLER_H
7 #define HANDLER_H
8 
9 #ifdef HAVE_CONFIG_H
10 # include "config.h"
11 #endif
12 
13 #include <stdlib.h>
14 #include <stdio.h>
15 
16 #if defined(HAVE_SYS_SELECT_H) && HAVE_SYS_SELECT_H
17 # include <sys/select.h>
18 #else /* HAVE_SYS_SELECT_H */
19 # include <sys/time.h>
20 # include <sys/types.h>
21 # include <unistd.h>
22 #endif /* HAVE_SYS_SELECT_H */
23 
24 #ifdef OTFMERGE_MPI
25 # include "mpi.h"
26 # if defined(INSIDE_OPENMPI) || (defined(HAVE_MPI_GET_ADDRESS) && HAVE_MPI_GET_ADDRESS)
27 # define MPI_Address MPI_Get_address
28 # endif /* HAVE_MPI_GET_ADDRESS */
29 # if defined(INSIDE_OPENMPI) || defined(HAVE_MPI_TYPE_CREATE_STRUCT) && HAVE_MPI_TYPE_CREATE_STRUCT
30 # define MPI_Type_struct MPI_Type_create_struct
31 # endif /* HAVE_MPI_TYPE_CREATE_STRUCT */
32 #endif /* OTFMERGE_MPI */
33 
34 #include "otf.h"
35 
36 
37 /* data structures */
38 
39 typedef struct {
40  int id;
41  int num_cpus;
42  int *cpus;
43 } OutStream;
44 
45 typedef struct {
46  int num_ostreams;
47  OutStream *ostreams;
48 } RankData;
49 
50 typedef struct {
51  double progress;
52  uint8_t is_alive;
53 } ProgressBuf;
54 
55 typedef struct {
56 #ifdef OTFMERGE_MPI
58 #endif /* OTFMERGE_MPI */
59  ProgressBuf value;
60  ProgressBuf buf;
61  int num_cpus;
62  double percent;
63 } ProgressInfo;
64 
65 typedef struct {
66  int my_rank;
67  int num_ranks;
68  int ranks_alive;
69  double tmp_progress;
70 #ifdef OTFMERGE_MPI
71  MPI_Datatype buftype;
72 #endif /* OTFMERGE_MPI */
73 } GlobalData;
74 
75 
76 /* function declarations */
77 
78 double update_progress( ProgressInfo* info, GlobalData* data, int cur_ostream,
79  int num_ostreams );
80 
81 int finish_everything( char *infile, char* outfile, ProgressInfo* info,
82  RankData* rank_data, int ret );
83 
84 void setDefinitionHandlerArray( OTF_HandlerArray* handlers,
85  OTF_WStream* wstream);
86 
87 void setEventHandlerArray( OTF_HandlerArray* handlers, OTF_WStream* wstream );
88 
89 
90 /* handlers */
91 
92 int handleDefinitionComment( void *userData, uint32_t stream,
93  const char *comment, OTF_KeyValueList *list );
94 
95 int handleDefTimerResolution( void *userData, uint32_t stream,
96  uint64_t ticksPerSecond, OTF_KeyValueList *list );
97 
98 int handleDefProcess( void *userData, uint32_t stream, uint32_t process,
99  const char *name, uint32_t parent, OTF_KeyValueList *list );
100 
101 int handleDefProcessGroup( void *userData, uint32_t stream, uint32_t procGroup,
102  const char *name, uint32_t numberOfProcs, const uint32_t *procs,
103  OTF_KeyValueList *list );
104 
105 int handleDefAttributeList( void *userData, uint32_t stream,
106  uint32_t attr_token, uint32_t num, OTF_ATTR_TYPE *array,
107  OTF_KeyValueList *list );
108 
109 int handleDefProcessOrGroupAttributes( void *userData, uint32_t stream,
110  uint32_t proc_token, uint32_t attr_token, OTF_KeyValueList *list);
111 
112 int handleDefFunction( void *userData, uint32_t stream, uint32_t func,
113  const char *name, uint32_t funcGroup, uint32_t source,
114  OTF_KeyValueList *list );
115 
116 int handleDefFunctionGroup( void *userData, uint32_t stream, uint32_t funcGroup,
117  const char *name, OTF_KeyValueList *list );
118 
119 int handleDefCollectiveOperation(void *userData, uint32_t stream,
120  uint32_t collOp, const char *name, uint32_t type,
121  OTF_KeyValueList *list );
122 
123 int handleDefCounter( void *userData, uint32_t stream, uint32_t counter,
124  const char *name, uint32_t properties, uint32_t counterGroup,
125  const char *unit, OTF_KeyValueList *list );
126 
127 int handleDefCounterGroup( void *userData, uint32_t stream,
128  uint32_t counterGroup, const char *name, OTF_KeyValueList *list );
129 
130 int handleDefScl( void *userData, uint32_t stream, uint32_t source,
131  uint32_t sourceFile, uint32_t line, OTF_KeyValueList *list );
132 
133 int handleDefSclFile( void *userData, uint32_t stream, uint32_t sourceFile,
134  const char *name, OTF_KeyValueList *list );
135 
136 int handleDefCreator( void *userData, uint32_t stream, const char *creator,
137  OTF_KeyValueList *list );
138 
139 int handleDefVersion( void *userData, uint32_t stream, uint8_t major,
140  uint8_t minor, uint8_t sub, const char *string );
141 
142 int handleDefFile( void *userData, uint32_t stream, uint32_t token,
143  const char *name, uint32_t group, OTF_KeyValueList *list );
144 
145 int handleDefFileGroup( void *userData, uint32_t stream, uint32_t token,
146  const char *name, OTF_KeyValueList *list );
147 
148 int handleDefKeyValue( void *userData, uint32_t stream, uint32_t token,
149  OTF_Type type, const char *name, const char *desc,
150  OTF_KeyValueList *list );
151 
152 int handleDefTimeRange( void* userData, uint32_t stream, uint64_t minTime,
153  uint64_t maxTime, OTF_KeyValueList *list );
154 
155 int handleDefCounterAssignments( void* userData, uint32_t stream,
156  uint32_t counter_token, uint32_t number_of_members,
157  const uint32_t* procs_or_groups, OTF_KeyValueList *list );
158 
159 int handleDefProcessSubstitutes( void* userData, uint32_t stream,
160  uint32_t representative, uint32_t numberOfProcs, const uint32_t* procs,
161  OTF_KeyValueList *list );
162 
163 int handleDefMarker( void *userData, uint32_t stream, uint32_t token,
164  const char *name, uint32_t type, OTF_KeyValueList *list );
165 
166 int handleUnknownRecord( void *userData, uint64_t time, uint32_t process,
167  const char *record );
168 
169 #endif /* HANDLER_H */
Definition: handler.h:55
Definition: ompi_datatype.h:68
Main include file for applications using OTF.
Definition: handler.h:65
Definition: handler.h:39
Object structure which holds OTF record handlers.
Definition: OTF_HandlerArray.h:52
enum OTF_ATTR_TYPE_enum OTF_ATTR_TYPE
An enum which holds all values that are possible to set with datatype OTF_ATTR_TYPE().
enum OTF_Type_enum OTF_Type
An enum which holds all OTF datatypes that are relevant for OTF_KeyValueList.
Definition: OTF_WStream.h:95
Definition: evdns.c:158
struct OTF_KeyValueList_struct OTF_KeyValueList
Object type which holds a key-value list.
Definition: OTF_KeyValue.h:242
Definition: handler.h:50
Main top-level request struct definition.
Definition: request.h:100
Definition: handler.h:45