1 | /* |
---|
2 | This is part of the OTF library. Copyright by ZIH, TU Dresden 2005-2008. |
---|
3 | Authors: Andreas Knuepfer, Holger Brunst, Ronny Brendel, Thomas Kriebitzsch |
---|
4 | */ |
---|
5 | |
---|
6 | /** |
---|
7 | * @file OTF_HandlerArray.h |
---|
8 | * |
---|
9 | * @brief Provides read access to OTF traces which consist of multiple |
---|
10 | * streams. |
---|
11 | * |
---|
12 | * \ingroup handler |
---|
13 | * \ingroup ha |
---|
14 | */ |
---|
15 | |
---|
16 | /** \defgroup handler Handler Interface |
---|
17 | * |
---|
18 | * In the following, the handler interfaces for all record types are |
---|
19 | * specified. The signature of callback handler functions is equal to the |
---|
20 | * signature of corresponding record write functions except for the first |
---|
21 | * argument. The first argument common to all callback handler functions is |
---|
22 | * \em userData -- a generic pointer to custom user data. The second common |
---|
23 | * argument to all callback hander functions is \em stream which identifies the |
---|
24 | * stream where the definition occurred. A stream parameter = 0 indicates a |
---|
25 | * global definition which is the default. |
---|
26 | */ |
---|
27 | |
---|
28 | /** |
---|
29 | * \defgroup ha Handler Array Interface |
---|
30 | * |
---|
31 | * Using this interface you can setup a handler array for reading traces. |
---|
32 | * |
---|
33 | */ |
---|
34 | |
---|
35 | |
---|
36 | #ifndef OTF_HANDLERARRAY_H |
---|
37 | #define OTF_HANDLERARRAY_H |
---|
38 | |
---|
39 | |
---|
40 | #include "OTF_Writer.h" |
---|
41 | |
---|
42 | |
---|
43 | #ifdef __cplusplus |
---|
44 | extern "C" { |
---|
45 | #endif /* __cplusplus */ |
---|
46 | |
---|
47 | /** Generic function pointer for OTF record handlers. \ingroup ha*/ |
---|
48 | typedef int (OTF_FunctionPointer) ( void *userData, ... ); |
---|
49 | |
---|
50 | |
---|
51 | /** Object structure which holds OTF record handlers. */ |
---|
52 | struct struct_OTF_HandlerArray { |
---|
53 | |
---|
54 | /** Array of function pointer. */ |
---|
55 | OTF_FunctionPointer** pointer; |
---|
56 | |
---|
57 | /** Array of first handler arguments. */ |
---|
58 | void** firsthandlerarg; |
---|
59 | }; |
---|
60 | |
---|
61 | /** Object type which holds OTF record handlers. \ingroup ha */ |
---|
62 | typedef struct struct_OTF_HandlerArray OTF_HandlerArray; |
---|
63 | |
---|
64 | |
---|
65 | /** Open a new array of handlers. \ingroup ha */ |
---|
66 | OTF_HandlerArray* OTF_HandlerArray_open( void ); |
---|
67 | |
---|
68 | /** Close and delete a OTF_HandlerArray object. \ingroup ha */ |
---|
69 | int OTF_HandlerArray_close( OTF_HandlerArray* handlers ); |
---|
70 | |
---|
71 | /** Assign the function pointer to your own handler of the given record |
---|
72 | type. \ingroup ha */ |
---|
73 | int OTF_HandlerArray_setHandler( OTF_HandlerArray* handlers, |
---|
74 | OTF_FunctionPointer* pointer, uint32_t recordtype ); |
---|
75 | |
---|
76 | /** Assign the first argument to your own handler of the given record type. |
---|
77 | \ingroup ha */ |
---|
78 | int OTF_HandlerArray_setFirstHandlerArg( OTF_HandlerArray* handlers, |
---|
79 | void* firsthandlerarg, uint32_t recordtype ); |
---|
80 | |
---|
81 | /** Provide copy handlers to every record type. \ingroup ha */ |
---|
82 | int OTF_HandlerArray_getCopyHandler( OTF_HandlerArray* handlers, |
---|
83 | OTF_Writer* writer ); |
---|
84 | |
---|
85 | |
---|
86 | /* Handlers for OTF definition records *****+++***************************** */ |
---|
87 | |
---|
88 | |
---|
89 | /** |
---|
90 | * Provides a comment record. |
---|
91 | * |
---|
92 | * @param userData Pointer to user data which can be set with |
---|
93 | * OTF_HandlerArray_setFirstHandlerArg(). |
---|
94 | * @param stream Identifies the stream to which this definition |
---|
95 | * belongs to. stream = 0 represents a global |
---|
96 | * definition. |
---|
97 | * @param comment Arbitrary comment string. |
---|
98 | * |
---|
99 | * @return OTF_RETURN_ABORT for aborting the reading process immediately |
---|
100 | * OTF_RETURN_OK for continue reading |
---|
101 | * |
---|
102 | * \ingroup handler |
---|
103 | */ |
---|
104 | int OTF_Handler_DefinitionComment( void* userData, |
---|
105 | uint32_t stream, |
---|
106 | const char* comment ); |
---|
107 | |
---|
108 | |
---|
109 | /** |
---|
110 | * Provides the timer resolution. All timed event records need to be |
---|
111 | * interpreted according to this definition. By default, a timer resolution of |
---|
112 | * 1 us i.e. 1,000,000 clock ticks is assumed. |
---|
113 | * |
---|
114 | * @param userData Pointer to user data which can be set with |
---|
115 | * OTF_HandlerArray_setFirstHandlerArg(). |
---|
116 | * @param stream Identifies the stream to which this definition |
---|
117 | * belongs to. stream = 0 represents a global |
---|
118 | * definition. |
---|
119 | * @param ticksPerSecond Clock ticks per second of the timer. |
---|
120 | * |
---|
121 | * @return OTF_RETURN_ABORT for aborting the reading process immediately |
---|
122 | * OTF_RETURN_OK for continue reading |
---|
123 | * |
---|
124 | * \ingroup handler |
---|
125 | */ |
---|
126 | int OTF_Handler_DefTimerResolution( void* userData, |
---|
127 | uint32_t stream, |
---|
128 | uint64_t ticksPerSecond ); |
---|
129 | |
---|
130 | |
---|
131 | /** |
---|
132 | * Provides a process definition. |
---|
133 | * |
---|
134 | * @param userData Pointer to user data which can be set with |
---|
135 | * OTF_HandlerArray_setFirstHandlerArg(). |
---|
136 | * @param stream Identifies the stream to which this definition |
---|
137 | * belongs to. stream = 0 represents a global |
---|
138 | * definition. |
---|
139 | * @param process Arbitrary but unique process identifier > 0. |
---|
140 | * @param name Name of the process e.g. "Process X". |
---|
141 | * @param parent Previously declared parent process identifier or 0 if |
---|
142 | * process has no parent. |
---|
143 | * |
---|
144 | * @return OTF_RETURN_ABORT for aborting the reading process immediately |
---|
145 | * OTF_RETURN_OK for continue reading |
---|
146 | * |
---|
147 | * \ingroup handler |
---|
148 | */ |
---|
149 | int OTF_Handler_DefProcess( void* userData, |
---|
150 | uint32_t stream, |
---|
151 | uint32_t process, |
---|
152 | const char* name, |
---|
153 | uint32_t parent ); |
---|
154 | |
---|
155 | |
---|
156 | /** |
---|
157 | * Provides a process group definition. |
---|
158 | * |
---|
159 | * OTF supports groups of processes. Their main objective is to classify |
---|
160 | * processes depending on arbitrary characteristics. Processes can reside |
---|
161 | * in multiple groups. This record type is optional. |
---|
162 | * |
---|
163 | * @param userData Pointer to user data which can be set with |
---|
164 | * OTF_HandlerArray_setFirstHandlerArg(). |
---|
165 | * @param stream Identifies the stream to which this definition |
---|
166 | * belongs to. stream = 0 represents a global |
---|
167 | * definition. |
---|
168 | * @param procGroup Arbitrary but unique process group identifier > 0. |
---|
169 | * @param name Name of the process group e.g. "Well Balanced". |
---|
170 | * @param numberOfProcs The number of processes in the process group. |
---|
171 | * @param procs Vector of process identifiers as provided by |
---|
172 | * OTF_Handler_DefProcess(). |
---|
173 | * |
---|
174 | * @return OTF_RETURN_ABORT for aborting the reading process immediately |
---|
175 | * OTF_RETURN_OK for continue reading |
---|
176 | * |
---|
177 | * \ingroup handler |
---|
178 | */ |
---|
179 | int OTF_Handler_DefProcessGroup( void* userData, |
---|
180 | uint32_t stream, |
---|
181 | uint32_t procGroup, |
---|
182 | const char* name, |
---|
183 | uint32_t numberOfProcs, |
---|
184 | const uint32_t* procs ); |
---|
185 | |
---|
186 | |
---|
187 | /** |
---|
188 | * Provides a function definition. |
---|
189 | * |
---|
190 | * Defines a function of the given name. Functions can optionally belong to a |
---|
191 | * certain function group provided by the |
---|
192 | * OTF_Handler_DefFunctionGroup() handler. A source code reference can |
---|
193 | * be provided aswell. |
---|
194 | * |
---|
195 | * @param userData Pointer to user data which can be set with |
---|
196 | * OTF_HandlerArray_setFirstHandlerArg(). |
---|
197 | * @param stream Identifies the stream to which this definition |
---|
198 | * belongs to. stream = 0 represents a global |
---|
199 | * definition. |
---|
200 | * @param func Arbitrary but unique function identifier > 0. |
---|
201 | * @param name Name of the function e.g. "DoSomething". |
---|
202 | * @param funcGroup A function group identifier preliminary provided by |
---|
203 | * OTF_Handler_DefFunctionGroup() or 0 for no |
---|
204 | * function group assignment. |
---|
205 | * @param source Reference to the function's source code location |
---|
206 | * preliminary provided by OTF_Handler_DefScl() or |
---|
207 | * 0 for no source code location assignment. |
---|
208 | * |
---|
209 | * @return OTF_RETURN_ABORT for aborting the reading process immediately |
---|
210 | * OTF_RETURN_OK for continue reading |
---|
211 | * |
---|
212 | * \ingroup handler |
---|
213 | */ |
---|
214 | int OTF_Handler_DefFunction( void* userData, |
---|
215 | uint32_t stream, |
---|
216 | uint32_t func, |
---|
217 | const char* name, |
---|
218 | uint32_t funcGroup, |
---|
219 | uint32_t source ); |
---|
220 | |
---|
221 | |
---|
222 | /** |
---|
223 | * Provides a function group definition. |
---|
224 | * |
---|
225 | * @param userData Pointer to user data which can be set with |
---|
226 | * OTF_HandlerArray_setFirstHandlerArg(). |
---|
227 | * @param stream Identifies the stream to which this definition |
---|
228 | * belongs to. stream = 0 represents a global |
---|
229 | * definition. |
---|
230 | * @param funcGroup An arbitrary but unique function group identifier > 0. |
---|
231 | * @param name Name of the function group e.g. "Computation". |
---|
232 | * |
---|
233 | * @return OTF_RETURN_ABORT for aborting the reading process immediately |
---|
234 | * OTF_RETURN_OK for continue reading |
---|
235 | * |
---|
236 | * \ingroup handler |
---|
237 | */ |
---|
238 | int OTF_Handler_DefFunctionGroup( void* userData, |
---|
239 | uint32_t stream, |
---|
240 | uint32_t funcGroup, |
---|
241 | const char* name ); |
---|
242 | |
---|
243 | |
---|
244 | /** |
---|
245 | * Provides a collective operation definition. |
---|
246 | * |
---|
247 | * @param userData Pointer to user data which can be set with |
---|
248 | * OTF_HandlerArray_setFirstHandlerArg(). |
---|
249 | * @param stream Identifies the stream to which this definition |
---|
250 | * belongs to. stream = 0 represents a global |
---|
251 | * definition. |
---|
252 | * @param collOp An arbitrary but unique collective op. identifier > 0. |
---|
253 | * @param name Name of the collective operation e.g. "MPI_Bcast". |
---|
254 | * @param type One of the five supported collective classes: |
---|
255 | * OTF_COLLECTIVE_TYPE_UNKNOWN (default), |
---|
256 | * OTF_COLLECTIVE_TYPE_BARRIER, |
---|
257 | * OTF_COLLECTIVE_TYPE_ONE2ALL, |
---|
258 | * OTF_COLLECTIVE_TYPE_ALL2ONE, |
---|
259 | * OTF_COLLECTIVE_TYPE_ALL2ALL. |
---|
260 | * |
---|
261 | * @return OTF_RETURN_ABORT for aborting the reading process immediately |
---|
262 | * OTF_RETURN_OK for continue reading |
---|
263 | * |
---|
264 | * \ingroup handler |
---|
265 | */ |
---|
266 | int OTF_Handler_DefCollectiveOperation( void* userData, |
---|
267 | uint32_t stream, |
---|
268 | uint32_t collOp, |
---|
269 | const char* name, |
---|
270 | uint32_t type ); |
---|
271 | |
---|
272 | |
---|
273 | /** |
---|
274 | * Provides a counter definition. |
---|
275 | * |
---|
276 | * @param userData Pointer to user data which can be set with |
---|
277 | * OTF_HandlerArray_setFirstHandlerArg(). |
---|
278 | * @param stream Identifies the stream to which this definition |
---|
279 | * belongs to. stream = 0 represents a global |
---|
280 | * definition. |
---|
281 | * @param counter An arbitrary but unique counter identifier. |
---|
282 | * @param name Name of the counter e.g. "Cache Misses". |
---|
283 | * @param properties A combination of a type, scope and vartype counter property. |
---|
284 | * OTF_COUNTER_TYPE_ACC (default) represents a counter |
---|
285 | * with monotonously increasing values e.g. a FLOP |
---|
286 | * counter. OTF_COUNTER_TYPE_ABS on the other hand |
---|
287 | * defines a counter with alternating absolute values e.g. |
---|
288 | * the memory usage of a process. The following counter |
---|
289 | * measurement scopes are supported: |
---|
290 | * OTF_COUNTER_SCOPE_START (default) always refers to the |
---|
291 | * start of the process, OTF_COUNTER_SCOPE_POINT refers |
---|
292 | * to exactly this moment in time, OTF_COUNTER_SCOPE_LAST |
---|
293 | * relates to the previous measurement, and |
---|
294 | * OTF_COUNTER_SCOPE_NEXT to the next measurement. |
---|
295 | * Examples: OTF_COUNTER_TYPE_ACC + |
---|
296 | * OTF_COUNTER_SCOPE_START should be used for most |
---|
297 | * standard hardware (PAPI) counters. |
---|
298 | * OTF_COUNTER_TYPE_ABS + OTF_COUNTER_SCOPE_POINT could |
---|
299 | * be used to record information 'spikes'. |
---|
300 | * OTF_COUNTER_TYPE_ABS + OTF_COUNTER_SCOPE_NEXT works |
---|
301 | * for memory allocation recording. |
---|
302 | * The data type can be one of the following: |
---|
303 | * COUNTER_VARTYPE_{UNSIGNED8,SIGNED8,UNSIGNED4,SIGNED4, |
---|
304 | * UNSIGNED2,SIGNED2,DOUBLE,FLOAT} |
---|
305 | * You may also use COUNTER_VARTYPE_IS{INTEGER,SIGNED, |
---|
306 | * UNSIGNED}(property) to a get a clue about the data type. |
---|
307 | * @param counterGroup A previously defined counter group identifier or 0 for |
---|
308 | * no group. |
---|
309 | * @param unit Unit of the counter e.g. "#" for "number of..." or 0 |
---|
310 | * for no unit. |
---|
311 | * |
---|
312 | * @return OTF_RETURN_ABORT for aborting the reading process immediately |
---|
313 | * OTF_RETURN_OK for continue reading |
---|
314 | * |
---|
315 | * \ingroup handler |
---|
316 | */ |
---|
317 | int OTF_Handler_DefCounter( void* userData, |
---|
318 | uint32_t stream, |
---|
319 | uint32_t counter, |
---|
320 | const char* name, |
---|
321 | uint32_t properties, |
---|
322 | uint32_t counterGroup, |
---|
323 | const char* unit ); |
---|
324 | |
---|
325 | |
---|
326 | /** |
---|
327 | * Provides a counter group definition. |
---|
328 | * |
---|
329 | * @param userData Pointer to user data which can be set with |
---|
330 | * OTF_HandlerArray_setFirstHandlerArg(). |
---|
331 | * @param stream Identifies the stream to which this definition |
---|
332 | * belongs to. stream = 0 represents a global |
---|
333 | * definition. |
---|
334 | * @param counterGroup An arbitrary but unique counter group identifier > 0. |
---|
335 | * @param name Counter group name. |
---|
336 | * |
---|
337 | * @return OTF_RETURN_ABORT for aborting the reading process immediately |
---|
338 | * OTF_RETURN_OK for continue reading |
---|
339 | * |
---|
340 | * \ingroup handler |
---|
341 | */ |
---|
342 | int OTF_Handler_DefCounterGroup( void* userData, |
---|
343 | uint32_t stream, |
---|
344 | uint32_t counterGroup, |
---|
345 | const char* name ); |
---|
346 | |
---|
347 | |
---|
348 | /** |
---|
349 | * Provides a source code location (SCL). |
---|
350 | * |
---|
351 | * @param userData Pointer to user data which can be set with |
---|
352 | * OTF_HandlerArray_setFirstHandlerArg(). |
---|
353 | * @param stream Identifies the stream to which this definition |
---|
354 | * belongs to. stream = 0 represents a global |
---|
355 | * definition. |
---|
356 | * @param source Arbitrary but unique source code location |
---|
357 | * identifier > 0. |
---|
358 | * @param sourceFile Previously defined source file identifier. See |
---|
359 | * OTW_Handler_DefSclFile(). |
---|
360 | * @param line Line number. |
---|
361 | * |
---|
362 | * @return OTF_RETURN_ABORT for aborting the reading process immediately |
---|
363 | * OTF_RETURN_OK for continue reading |
---|
364 | * |
---|
365 | * \ingroup handler |
---|
366 | */ |
---|
367 | int OTF_Handler_DefScl( void* userData, |
---|
368 | uint32_t stream, |
---|
369 | uint32_t source, |
---|
370 | uint32_t sourceFile, |
---|
371 | uint32_t line ); |
---|
372 | |
---|
373 | |
---|
374 | /** |
---|
375 | * Provides a source code location (SCL) file. |
---|
376 | * |
---|
377 | * @param userData Pointer to user data which can be set with |
---|
378 | * OTF_HandlerArray_setFirstHandlerArg(). |
---|
379 | * @param stream Identifies the stream to which this definition |
---|
380 | * belongs to. stream = 0 represents a global |
---|
381 | * definition. |
---|
382 | * @param sourceFile Arbitrary but unique source code location |
---|
383 | * identifier != 0. |
---|
384 | * @param name File name. |
---|
385 | * |
---|
386 | * @return OTF_RETURN_ABORT for aborting the reading process immediately |
---|
387 | * OTF_RETURN_OK for continue reading |
---|
388 | * |
---|
389 | * \ingroup handler |
---|
390 | */ |
---|
391 | int OTF_Handler_DefSclFile( void* userData, |
---|
392 | uint32_t stream, |
---|
393 | uint32_t sourceFile, |
---|
394 | const char* name ); |
---|
395 | |
---|
396 | |
---|
397 | /** |
---|
398 | * Provides file creator information. |
---|
399 | * |
---|
400 | * @param userData Pointer to user data which can be set with |
---|
401 | * OTF_HandlerArray_setFirstHandlerArg(). |
---|
402 | * @param stream Identifies the stream to which this definition |
---|
403 | * belongs to. stream = 0 represents a global |
---|
404 | * definition. |
---|
405 | * @param creator String which identifies the creator of the |
---|
406 | * file e.g. "TAU Version x.y.z". |
---|
407 | * |
---|
408 | * @return OTF_RETURN_ABORT for aborting the reading process immediately |
---|
409 | * OTF_RETURN_OK for continue reading |
---|
410 | * |
---|
411 | * \ingroup handler |
---|
412 | */ |
---|
413 | int OTF_Handler_DefCreator( void* userData, |
---|
414 | uint32_t stream, |
---|
415 | const char* creator ); |
---|
416 | |
---|
417 | |
---|
418 | /** |
---|
419 | * Provides information on the traceÂŽs otf-version. This record can only be read |
---|
420 | * and not be written. |
---|
421 | * |
---|
422 | * @param userData Pointer to user data which can be set with |
---|
423 | * OTF_HandlerArray_setFirstHandlerArg(). |
---|
424 | * @param stream Identifies the stream to which this definition |
---|
425 | * belongs to. stream = 0 represents a global |
---|
426 | * definition. |
---|
427 | * @param major major version number |
---|
428 | * @param minor minor version number |
---|
429 | * @param sub sub version number |
---|
430 | * @param string string identifing the version |
---|
431 | * |
---|
432 | * @return OTF_RETURN_ABORT for aborting the reading process immediately |
---|
433 | * OTF_RETURN_OK for continue reading |
---|
434 | * |
---|
435 | * \ingroup handler |
---|
436 | */ |
---|
437 | int OTF_Handler_DefVersion( void* userData, |
---|
438 | uint32_t stream, |
---|
439 | uint8_t major, |
---|
440 | uint8_t minor, |
---|
441 | uint8_t sub, |
---|
442 | const char* string ); |
---|
443 | |
---|
444 | |
---|
445 | /** |
---|
446 | * Provides a file definition |
---|
447 | * NOTE: this is experimental |
---|
448 | * |
---|
449 | * @param userData Pointer to user data which can be set with |
---|
450 | * OTF_HandlerArray_setFirstHandlerArg(). |
---|
451 | * @param stream Identifies the stream to which this definition |
---|
452 | * belongs to. stream = 0 represents a global |
---|
453 | * definition. |
---|
454 | * |
---|
455 | * @param token Arbitrary, unique identifier of the file. |
---|
456 | * Has to be > 0. |
---|
457 | * |
---|
458 | * @param name name of the file |
---|
459 | * |
---|
460 | * @param group A previously defined file group identifier or 0 for |
---|
461 | * no group. |
---|
462 | * |
---|
463 | * \ingroup handler |
---|
464 | */ |
---|
465 | int OTF_Handler_DefFile( void* userData, |
---|
466 | uint32_t stream, |
---|
467 | uint32_t token, |
---|
468 | const char *name, |
---|
469 | uint32_t group ); |
---|
470 | |
---|
471 | |
---|
472 | /** |
---|
473 | * Provides a file group definition |
---|
474 | * NOTE: this is experimental |
---|
475 | * |
---|
476 | * @param userData Pointer to user data which can be set with |
---|
477 | * OTF_HandlerArray_setFirstHandlerArg(). |
---|
478 | * @param stream Identifies the stream to which this definition |
---|
479 | * belongs to. stream = 0 represents a global |
---|
480 | * definition. |
---|
481 | * |
---|
482 | * @param token Arbitrary, unique identifier of the file group |
---|
483 | * Has to be > 0. |
---|
484 | * |
---|
485 | * @param name Name of the file group |
---|
486 | * |
---|
487 | * \ingroup handler |
---|
488 | */ |
---|
489 | int OTF_Handler_DefFileGroup( void* userData, |
---|
490 | uint32_t stream, |
---|
491 | uint32_t token, |
---|
492 | const char *name ); |
---|
493 | |
---|
494 | /* Handlers for OTF event records ****************************************** */ |
---|
495 | |
---|
496 | |
---|
497 | /** |
---|
498 | * Provides a function entry event. |
---|
499 | * |
---|
500 | * @param userData Pointer to user data which can be set with |
---|
501 | * OTF_HandlerArray_setFirstHandlerArg(). |
---|
502 | * @param time The time when the function entry took place. |
---|
503 | * @param function Function which has been entered as defined with |
---|
504 | * OTF_Writer_defFunction. |
---|
505 | * @param process Process where action took place. |
---|
506 | * @param source Explicit source code location identifier > 0 or 0 if |
---|
507 | * no source information available. |
---|
508 | * |
---|
509 | * @return OTF_RETURN_ABORT for aborting the reading process immediately |
---|
510 | * OTF_RETURN_OK for continue reading |
---|
511 | * |
---|
512 | * \ingroup handler |
---|
513 | */ |
---|
514 | int OTF_Handler_Enter( void* userData, |
---|
515 | uint64_t time, |
---|
516 | uint32_t function, |
---|
517 | uint32_t process, |
---|
518 | uint32_t source ); |
---|
519 | |
---|
520 | |
---|
521 | /** |
---|
522 | * Provides a function leave event. |
---|
523 | * |
---|
524 | * @param userData Pointer to user data which can be set with |
---|
525 | * OTF_HandlerArray_setFirstHandlerArg(). |
---|
526 | * @param time The time when the function leave took place. |
---|
527 | * @param function Function which was left or 0 if stack integrety checking |
---|
528 | * is not available. |
---|
529 | * @param process Process where action took place. |
---|
530 | * @param source Explicit source code location identifier > 0 or 0 if |
---|
531 | * no source information available. |
---|
532 | * |
---|
533 | * @return OTF_RETURN_ABORT for aborting the reading process immediately |
---|
534 | * OTF_RETURN_OK for continue reading |
---|
535 | * |
---|
536 | * \ingroup handler |
---|
537 | */ |
---|
538 | int OTF_Handler_Leave( void* userData, |
---|
539 | uint64_t time, |
---|
540 | uint32_t function, |
---|
541 | uint32_t process, |
---|
542 | uint32_t source ); |
---|
543 | |
---|
544 | |
---|
545 | /** |
---|
546 | * Provides a message send event. |
---|
547 | * |
---|
548 | * @param userData Pointer to user data which can be set with |
---|
549 | * OTF_HandlerArray_setFirstHandlerArg(). |
---|
550 | * @param time The time when the message was send. |
---|
551 | * @param sender Sender of the message. |
---|
552 | * @param receiver Receiver of the message. |
---|
553 | * @param group Process-group to which sender and receiver belong to or |
---|
554 | * 0 for no group assignment. |
---|
555 | * @param type Message type information > 0 or 0 for no information. |
---|
556 | * @param length Optional message length information. |
---|
557 | * @param source Explicit source code location identifier > 0 or 0 if |
---|
558 | * no source information available. |
---|
559 | * |
---|
560 | * @return OTF_RETURN_ABORT for aborting the reading process immediately |
---|
561 | * OTF_RETURN_OK for continue reading |
---|
562 | * |
---|
563 | * \ingroup handler |
---|
564 | */ |
---|
565 | int OTF_Handler_SendMsg( void* userData, |
---|
566 | uint64_t time, |
---|
567 | uint32_t sender, |
---|
568 | uint32_t receiver, |
---|
569 | uint32_t group, |
---|
570 | uint32_t type, |
---|
571 | uint32_t length, |
---|
572 | uint32_t source ); |
---|
573 | |
---|
574 | |
---|
575 | /** |
---|
576 | * Provides a message retrieval event. |
---|
577 | * |
---|
578 | * @param userData Pointer to user data which can be set with |
---|
579 | * OTF_HandlerArray_setFirstHandlerArg(). |
---|
580 | * @param time The time when the message was received. |
---|
581 | * @param recvProc Identifier of receiving process. |
---|
582 | * @param sendProc Identifier of sending process. |
---|
583 | * @param group Process-group to which sender and receiver belong to or |
---|
584 | * 0 for no group assignment. |
---|
585 | * @param type Message type information > 0 or 0 for no information. |
---|
586 | * @param length Optional message length information. |
---|
587 | * @param source Explicit source code location identifier > 0 or 0 if |
---|
588 | * no source information available. |
---|
589 | * |
---|
590 | * @return OTF_RETURN_ABORT for aborting the reading process immediately |
---|
591 | * OTF_RETURN_OK for continue reading |
---|
592 | * |
---|
593 | * \ingroup handler |
---|
594 | */ |
---|
595 | int OTF_Handler_RecvMsg( void* userData, |
---|
596 | uint64_t time, |
---|
597 | uint32_t recvProc, |
---|
598 | uint32_t sendProc, |
---|
599 | uint32_t group, |
---|
600 | uint32_t type, |
---|
601 | uint32_t length, |
---|
602 | uint32_t source ); |
---|
603 | |
---|
604 | |
---|
605 | /** |
---|
606 | * Provides a counter measurement. |
---|
607 | * |
---|
608 | * @param userData Pointer to user data which can be set with |
---|
609 | * OTF_HandlerArray_setFirstHandlerArg(). |
---|
610 | * @param time Time when counter was measured. |
---|
611 | * @param process Process where counter measurment took place. |
---|
612 | * @param counter Counter which was measured. |
---|
613 | * @param value Counter value. |
---|
614 | * |
---|
615 | * @return OTF_RETURN_ABORT for aborting the reading process immediately |
---|
616 | * OTF_RETURN_OK for continue reading |
---|
617 | * |
---|
618 | * \ingroup handler |
---|
619 | */ |
---|
620 | int OTF_Handler_Counter( void* userData, |
---|
621 | uint64_t time, |
---|
622 | uint32_t process, |
---|
623 | uint32_t counter, |
---|
624 | uint64_t value ); |
---|
625 | |
---|
626 | |
---|
627 | /** |
---|
628 | * Provides a collective operation member event. |
---|
629 | * |
---|
630 | * @param userData Pointer to user data which can be set with |
---|
631 | * OTF_HandlerArray_setFirstHandlerArg(). |
---|
632 | * @param time Time when collective operation was entered by member. |
---|
633 | * @param process Process identifier i.e. collective member. |
---|
634 | * @param collective Collective identifier as defined with |
---|
635 | * OTF_Handler_DefCollectiveOperation(). |
---|
636 | * @param procGroup Group of processes participating in this collective. |
---|
637 | * @param rootProc Root process if != 0. |
---|
638 | * @param sent Data volume sent by member or 0. |
---|
639 | * @param received Data volume received by member or 0. |
---|
640 | * @param duration Time spent in collective operation. |
---|
641 | * @param source Explicit source code location or 0. |
---|
642 | * |
---|
643 | * @return OTF_RETURN_ABORT for aborting the reading process immediately |
---|
644 | * OTF_RETURN_OK for continue reading |
---|
645 | * |
---|
646 | * \ingroup handler |
---|
647 | */ |
---|
648 | int OTF_Handler_CollectiveOperation( void* userData, |
---|
649 | uint64_t time, |
---|
650 | uint32_t process, |
---|
651 | uint32_t collective, |
---|
652 | uint32_t procGroup, |
---|
653 | uint32_t rootProc, |
---|
654 | uint32_t sent, |
---|
655 | uint32_t received, |
---|
656 | uint64_t duration, |
---|
657 | uint32_t source ); |
---|
658 | |
---|
659 | |
---|
660 | /** |
---|
661 | * Provide a comment record. |
---|
662 | * |
---|
663 | * @param userData Pointer to user data which can be set with |
---|
664 | * OTF_HandlerArray_setFirstHandlerArg(). |
---|
665 | * @param time Comments need a timestamp for a proper positioning in the |
---|
666 | * trace. |
---|
667 | * @param process Comments also need a process identifier for a proper |
---|
668 | * positioning in the trace. |
---|
669 | * @param comment Arbitrary comment string. |
---|
670 | * |
---|
671 | * @return OTF_RETURN_ABORT for aborting the reading process immediately |
---|
672 | * OTF_RETURN_OK for continue reading |
---|
673 | * |
---|
674 | * \ingroup handler |
---|
675 | */ |
---|
676 | int OTF_Handler_EventComment( void* userData, |
---|
677 | uint64_t time, |
---|
678 | uint32_t process, |
---|
679 | const char* comment ); |
---|
680 | |
---|
681 | |
---|
682 | /** |
---|
683 | * Provides a process creation event. |
---|
684 | * |
---|
685 | * Marks the explicit begin of a process. This event precedes the very first |
---|
686 | * event of the respective process and should carry the same time stamp. This |
---|
687 | * is especially useful with on-line analysis. It tells whether there will be |
---|
688 | * additional records for the given process or not. Without this record type, |
---|
689 | * it could only be guessed that there might not follow more events after a |
---|
690 | * process has reached the bottom of the call stack. |
---|
691 | * |
---|
692 | * @param userData Pointer to user data which can be set with |
---|
693 | * OTF_HandlerArray_setFirstHandlerArg(). |
---|
694 | * @param time Time when process was referenced for the first time. |
---|
695 | * @param process Process identifier > 0. |
---|
696 | * |
---|
697 | * @return OTF_RETURN_ABORT for aborting the reading process immediately |
---|
698 | * OTF_RETURN_OK for continue reading |
---|
699 | * |
---|
700 | * \ingroup handler |
---|
701 | */ |
---|
702 | int OTF_Handler_BeginProcess( void* userData, |
---|
703 | uint64_t time, |
---|
704 | uint32_t process ); |
---|
705 | |
---|
706 | |
---|
707 | /** |
---|
708 | * Provides a process destruction event. |
---|
709 | * |
---|
710 | * @param userData Pointer to user data which can be set with |
---|
711 | * OTF_HandlerArray_setFirstHandlerArg(). |
---|
712 | * @param time Time when process is referenced for the last time. |
---|
713 | * Process identifiers must not be recycled! |
---|
714 | * @param process Process identifier > 0. |
---|
715 | * |
---|
716 | * @return OTF_RETURN_ABORT for aborting the reading process immediately |
---|
717 | * OTF_RETURN_OK for continue reading |
---|
718 | * |
---|
719 | * \ingroup handler |
---|
720 | */ |
---|
721 | int OTF_Handler_EndProcess( void* userData, |
---|
722 | uint64_t time, |
---|
723 | uint32_t process ); |
---|
724 | |
---|
725 | |
---|
726 | /** |
---|
727 | * Provides a file operation event |
---|
728 | * NOTE: this is experimental |
---|
729 | * |
---|
730 | * @param userData Pointer to user data which can be set with |
---|
731 | * OTF_HandlerArray_setFirstHandlerArg(). |
---|
732 | * @param time Time when process is referenced for the last time. |
---|
733 | * Process identifiers must not be recycled! |
---|
734 | * @param process Process identifier > 0. |
---|
735 | * |
---|
736 | * @param handleid Unique identifier. This parameter is important |
---|
737 | * for files that are opened multiple times at the same time, |
---|
738 | * to match the close to the correct open. |
---|
739 | * This number has to be unique for every opened file ( |
---|
740 | * Files with the same id must have different handleid !!! ). |
---|
741 | * Recommendation: use the timestamp of the openfile record, |
---|
742 | * or an increasing(with every fileopen record) variable for |
---|
743 | * this. |
---|
744 | * |
---|
745 | * @param operation kind of operation done on the file. |
---|
746 | * has to be OTF_FILEOP_{OPEN,CLOSE,READ,WRITE,SEEK} |
---|
747 | * |
---|
748 | * @param bytes Should be 0 for open and close. |
---|
749 | * Number of read/written bytes for read/write operations. |
---|
750 | * New position in the file after a seek operation. |
---|
751 | * |
---|
752 | * @param duration Time spent in the file operation. |
---|
753 | * |
---|
754 | * @param source Explicit source code location or 0. |
---|
755 | * |
---|
756 | * \ingroup handler |
---|
757 | */ |
---|
758 | int OTF_Handler_FileOperation( void* userData, |
---|
759 | uint64_t time, |
---|
760 | uint32_t fileid, |
---|
761 | uint32_t process, |
---|
762 | uint64_t handleid, |
---|
763 | uint32_t operation, |
---|
764 | uint64_t bytes, |
---|
765 | uint64_t duration, |
---|
766 | uint32_t source ); |
---|
767 | |
---|
768 | |
---|
769 | /* Handlers for OTF snapshot records *************************************** */ |
---|
770 | |
---|
771 | |
---|
772 | /** |
---|
773 | * Provides a snapshot comment. |
---|
774 | * |
---|
775 | * @param userData Pointer to user data which can be set with |
---|
776 | * OTF_HandlerArray_setFirstHandlerArg(). |
---|
777 | * @param time Comments need a timestamp for a proper positioning in the |
---|
778 | * trace. |
---|
779 | * @param process Comments also need a process identifier for a proper |
---|
780 | * positioning in the trace. |
---|
781 | * @param comment Arbitrary comment string. |
---|
782 | * |
---|
783 | * @return OTF_RETURN_ABORT for aborting the reading process immediately |
---|
784 | * OTF_RETURN_OK for continue reading |
---|
785 | * |
---|
786 | * \ingroup handler |
---|
787 | */ |
---|
788 | |
---|
789 | int OTF_Handler_SnapshotComment( void* userData, |
---|
790 | uint64_t time, |
---|
791 | uint32_t process, |
---|
792 | const char* comment ); |
---|
793 | |
---|
794 | |
---|
795 | /** provides information about a past function call at the time 'originaltime'. |
---|
796 | Parameters 'time', 'function', 'process' ,'source' and the return value have the |
---|
797 | same meaning as in OTF_Handler_Enter(). |
---|
798 | \ingroup handler */ |
---|
799 | int OTF_Handler_EnterSnapshot( void *userData, |
---|
800 | uint64_t time, |
---|
801 | uint64_t originaltime, |
---|
802 | uint32_t function, |
---|
803 | uint32_t process, |
---|
804 | uint32_t source ); |
---|
805 | |
---|
806 | |
---|
807 | /** provides information about a past message send operation at the time |
---|
808 | 'originaltime'. Parameters 'time', 'sender', 'receiver', 'procGroup', 'tag', |
---|
809 | 'source' and the return value have the same meaning as in OTF_Handler_SendMsg(). |
---|
810 | \ingroup handler */ |
---|
811 | int OTF_Handler_SendSnapshot( void *userData, |
---|
812 | uint64_t time, |
---|
813 | uint64_t originaltime, |
---|
814 | uint32_t sender, |
---|
815 | uint32_t receiver, |
---|
816 | uint32_t procGroup, |
---|
817 | uint32_t tag, |
---|
818 | uint32_t source ); |
---|
819 | |
---|
820 | |
---|
821 | /** |
---|
822 | * Provides a snapshot record for opened(and not yet closed) files |
---|
823 | * |
---|
824 | * @param userData Pointer to user data which can be set with |
---|
825 | * OTF_HandlerArray_setFirstHandlerArg(). |
---|
826 | * @param time Current timestamp. |
---|
827 | * @param originaltime Timestamp when the file has been opened. |
---|
828 | * @param process Process identifier. |
---|
829 | * @param handleid Unique file open identifier. @see OTF_Handler_FileOperation() |
---|
830 | * @param source Optional reference to source code. |
---|
831 | * |
---|
832 | * \ingroup handler |
---|
833 | */ |
---|
834 | int OTF_Handler_OpenFileSnapshot( void* userData, |
---|
835 | uint64_t time, |
---|
836 | uint64_t originaltime, |
---|
837 | uint32_t fileid, |
---|
838 | uint32_t process, |
---|
839 | uint64_t handleid, |
---|
840 | uint32_t source ); |
---|
841 | |
---|
842 | |
---|
843 | /* Handlers for OTF summary records **************************************** */ |
---|
844 | |
---|
845 | |
---|
846 | /** Provides a summary comment. |
---|
847 | * |
---|
848 | * @param userData Pointer to user data which can be set with |
---|
849 | * OTF_HandlerArray_setFirstHandlerArg(). |
---|
850 | * @param time Comments need a timestamp for a proper positioning in the |
---|
851 | * trace. |
---|
852 | * @param process Comments also need a process identifier for a proper |
---|
853 | * positioning in the trace. |
---|
854 | * @param comment Arbitrary comment string. |
---|
855 | * |
---|
856 | * @return OTF_RETURN_ABORT for aborting the reading process immediately |
---|
857 | * OTF_RETURN_OK for continue reading |
---|
858 | * |
---|
859 | * \ingroup handler |
---|
860 | */ |
---|
861 | |
---|
862 | int OTF_Handler_SummaryComment( void * userData, |
---|
863 | uint64_t time, |
---|
864 | uint32_t process, |
---|
865 | const char* comment ); |
---|
866 | |
---|
867 | |
---|
868 | /** |
---|
869 | * Provides summarized information for a given function. |
---|
870 | * |
---|
871 | * @param userData Pointer to user data which can be set with |
---|
872 | * OTF_HandlerArray_setFirstHandlerArg(). |
---|
873 | * @param time Time when summary was computed. |
---|
874 | * @param function Function as defined with |
---|
875 | * OTF_Handler_DefFunction. |
---|
876 | * @param process Process of the given function. |
---|
877 | * @param invocations Number of invocations. |
---|
878 | * @param exclTime Time spent exclusively in the given function. |
---|
879 | * @param inclTime Time spent in the given function including all |
---|
880 | * sub-routine calls. |
---|
881 | * |
---|
882 | * @return OTF_RETURN_ABORT for aborting the reading process immediately |
---|
883 | * OTF_RETURN_OK for continue reading |
---|
884 | * |
---|
885 | * \ingroup handler |
---|
886 | */ |
---|
887 | int OTF_Handler_FunctionSummary( void* userData, |
---|
888 | uint64_t time, |
---|
889 | uint32_t function, |
---|
890 | uint32_t process, |
---|
891 | uint64_t invocations, |
---|
892 | uint64_t exclTime, |
---|
893 | uint64_t inclTime ); |
---|
894 | |
---|
895 | |
---|
896 | /** |
---|
897 | * Provides summarized information for a given group of functiongroups. |
---|
898 | * |
---|
899 | * @param userData Pointer to user data which can be set with |
---|
900 | * OTF_HandlerArray_setFirstHandlerArg(). |
---|
901 | * @param time Time when summary was computed. |
---|
902 | * @param funcGroup Function group as defined with |
---|
903 | * OTF_Handler_DefFunctionGroup. |
---|
904 | * @param process Process of the given function group. |
---|
905 | * @param invocations Number of invocations. |
---|
906 | * @param exclTime Time spent exclusively in the given function group. |
---|
907 | * @param inclTime Time spent in the given function group including all |
---|
908 | * sub-routine calls. |
---|
909 | * |
---|
910 | * @return OTF_RETURN_ABORT for aborting the reading process immediately |
---|
911 | * OTF_RETURN_OK for continue reading |
---|
912 | * |
---|
913 | * \ingroup handler |
---|
914 | */ |
---|
915 | int OTF_Handler_FunctionGroupSummary( void* userData, |
---|
916 | uint64_t time, |
---|
917 | uint32_t funcGroup, |
---|
918 | uint32_t process, |
---|
919 | uint64_t invocations, |
---|
920 | uint64_t exclTime, |
---|
921 | uint64_t inclTime ); |
---|
922 | |
---|
923 | |
---|
924 | /** |
---|
925 | * Provides summarized information for a given message type. |
---|
926 | * |
---|
927 | * @param userData Pointer to user data which can be set with |
---|
928 | * OTF_HandlerArray_setFirstHandlerArg(). |
---|
929 | * @param time Time when summary was computed. |
---|
930 | * @param process Process where messages originated. |
---|
931 | * @param peer Process where the message is sent to |
---|
932 | * @param comm Communicator of message summary |
---|
933 | * @param type Message type/tag. |
---|
934 | * @param sentNumber The number of messages sent. |
---|
935 | * @param receivedNumber The number of messages received. |
---|
936 | * @param sentBytes The number of bytes sent via messages of the given |
---|
937 | * type. |
---|
938 | * @param receivedBytes The number of bytes received through messages of the |
---|
939 | * given type. |
---|
940 | * |
---|
941 | * @return OTF_RETURN_ABORT for aborting the reading process immediately |
---|
942 | * OTF_RETURN_OK for continue reading |
---|
943 | * |
---|
944 | * \ingroup handler |
---|
945 | */ |
---|
946 | int OTF_Handler_MessageSummary( void* userData, |
---|
947 | uint64_t time, |
---|
948 | uint32_t process, |
---|
949 | uint32_t peer, |
---|
950 | uint32_t comm, |
---|
951 | uint32_t type, |
---|
952 | uint64_t sentNumber, |
---|
953 | uint64_t receivedNumber, |
---|
954 | uint64_t sentBytes, |
---|
955 | uint64_t receivedBytes ); |
---|
956 | |
---|
957 | |
---|
958 | /** |
---|
959 | * Provides summarized information about file operations. |
---|
960 | * |
---|
961 | * @param userData Pointer to user data which can be set with |
---|
962 | * OTF_HandlerArray_setFirstHandlerArg(). |
---|
963 | * @param time Time when summary was computed. |
---|
964 | * @param fileid File identifier or 0 for all files. |
---|
965 | * @param process Process where file operations occured. |
---|
966 | * @param nopen Number of open events. |
---|
967 | * @param nclose Number of close events. |
---|
968 | * @param nread Number of read events. |
---|
969 | * @param nwrite Number of write events. |
---|
970 | * @param nseek Number of seek events. |
---|
971 | * @param bytesread Number of bytes read. |
---|
972 | * @param byteswrite Number of bytes written. |
---|
973 | * |
---|
974 | * \ingroup handler |
---|
975 | */ |
---|
976 | int OTF_Handler_FileOperationSummary( void* userData, |
---|
977 | uint64_t time, |
---|
978 | uint32_t fileid, |
---|
979 | uint32_t process, |
---|
980 | uint64_t nopen, |
---|
981 | uint64_t nclose, |
---|
982 | uint64_t nread, |
---|
983 | uint64_t nwrite, |
---|
984 | uint64_t nseek, |
---|
985 | uint64_t bytesread, |
---|
986 | uint64_t byteswrite ); |
---|
987 | |
---|
988 | |
---|
989 | /** |
---|
990 | * Provides summarized information about file operations in a file group. |
---|
991 | * |
---|
992 | * @param userData Pointer to user data which can be set with |
---|
993 | * OTF_HandlerArray_setFirstHandlerArg(). |
---|
994 | * @param time Time when summary was computed. |
---|
995 | * @param groupid Group identifier or 0 for all files. |
---|
996 | * @param process Process where file operations occured. |
---|
997 | * @param nopen Number of open events. |
---|
998 | * @param nclose Number of close events. |
---|
999 | * @param nread Number of read events. |
---|
1000 | * @param nwrite Number of write events. |
---|
1001 | * @param nseek Number of seek events. |
---|
1002 | * @param bytesread Number of bytes read. |
---|
1003 | * @param byteswrite Number of bytes written. |
---|
1004 | * |
---|
1005 | * \ingroup handler |
---|
1006 | */ |
---|
1007 | int OTF_Handler_FileGroupOperationSummary( void* userData, |
---|
1008 | uint64_t time, |
---|
1009 | uint32_t groupid, |
---|
1010 | uint32_t process, |
---|
1011 | uint64_t nopen, |
---|
1012 | uint64_t nclose, |
---|
1013 | uint64_t nread, |
---|
1014 | uint64_t nwrite, |
---|
1015 | uint64_t nseek, |
---|
1016 | uint64_t bytesread, |
---|
1017 | uint64_t byteswrite ); |
---|
1018 | |
---|
1019 | |
---|
1020 | /** |
---|
1021 | * Can be used to handle records which cannot be read. |
---|
1022 | * |
---|
1023 | * @param userData Pointer to user data which can be set with |
---|
1024 | * OTF_HandlerArray_setFirstHandlerArg(). |
---|
1025 | * @param time Time when summary was computed. |
---|
1026 | * @param process If 'time' equals (uin64_t) -1, the unknown record |
---|
1027 | * is a definiton record and 'process' |
---|
1028 | * represents the streamid of the record. |
---|
1029 | * If 'time' has a valid value ( not (uint64)-1 ) the |
---|
1030 | * unknown record is an event-, statistics- or |
---|
1031 | * snapshotrecord and 'process' represents |
---|
1032 | * the processid of the record. |
---|
1033 | * @param record string which contains the record. |
---|
1034 | * |
---|
1035 | * @return OTF_RETURN_ABORT for aborting the reading process immediately |
---|
1036 | * OTF_RETURN_OK for continue reading |
---|
1037 | * |
---|
1038 | * \ingroup handler |
---|
1039 | */ |
---|
1040 | int OTF_Handler_UnknownRecord( void *userData, |
---|
1041 | uint64_t time, |
---|
1042 | uint32_t process, |
---|
1043 | const char *record ); |
---|
1044 | |
---|
1045 | |
---|
1046 | /* |
---|
1047 | * Provides summarized information about a counter. |
---|
1048 | * |
---|
1049 | * @param userData Pointer to user data which can be set with |
---|
1050 | * OTF_HandlerArray_setFirstHandlerArg(). |
---|
1051 | * @param time Time when summary was computed. |
---|
1052 | * @param process Process where messages originated. |
---|
1053 | * @param peer Token of counter. |
---|
1054 | * @param value Counter Value at current time. |
---|
1055 | * |
---|
1056 | * \ingroup handler |
---|
1057 | */ |
---|
1058 | /*int OTF_Handler_CounterSummary( void* userData, |
---|
1059 | uint64_t time, |
---|
1060 | uint32_t process, |
---|
1061 | uint32_t counterid, |
---|
1062 | uint64_t value ); |
---|
1063 | */ |
---|
1064 | |
---|
1065 | #ifdef __cplusplus |
---|
1066 | } |
---|
1067 | #endif /* __cplusplus */ |
---|
1068 | |
---|
1069 | #endif /* OTF_HANDLERARRAY_H */ |
---|
1070 | |
---|