OpenMPI 0.1.1

- Main Page
- Related Pages
- Modules
- Data Structures
- Files

- File List
- Globals

pyOTF_Wrapper.h
1 /*
2 This is part of the OTF library. Copyright by ZIH, TU Dresden 2005-2012.
3 Authors: Andreas Knuepfer, Holger Brunst, Ronny Brendel, Thomas Kriebitzsch
4 */
5
6 #ifndef PYOTF_WRAPPER_H
7 #define PYOTF_WRAPPER_H
8
9 /* first handler arg replacement. Containing the Python-function pointer and
10 the fha specified by the user */
11 typedef struct {
12
13 PyObject* func;
14 PyObject* realfha;
15
16 } pyOTF_FirstHandlerArgument;
17
18
19 /* *** PROTOTYPES *********************************************************** */
20 /* ************************************************************************** */
21 int pyOTF_COUNTER_VARTYPE_ISINTEGER( uint64_t x );
22
23 int pyOTF_COUNTER_VARTYPE_ISSIGNED( uint64_t x );
24
25 int pyOTF_COUNTER_VARTYPE_ISUNSIGNED( uint64_t x );
26
27
28 int pyOTF_MasterControl_appendList( OTF_MasterControl* mc, uint32_t argument,
29 uint32_t l, PyObject* values );
30
31
32 void pyOTF_HandlerArray_close( OTF_HandlerArray* handlers );
33
34 int pyOTF_HandlerArray_setHandler( OTF_HandlerArray* handlers, PyObject* function, uint32_t recordtype );
35
36 int pyOTF_HandlerArray_setFirstHandlerArg( OTF_HandlerArray* handlers, PyObject* fha, uint32_t recordtype );
37
38
39 /* functions concerning OTF_KeyValueList */
40 uint8_t pyOTF_KeyValueList_appendByteArray( OTF_KeyValueList* kvlist, uint32_t key, PyObject* values, uint32_t len);
41
42 PyObject* pyOTF_KeyValueList_getByteArray( OTF_KeyValueList* kvlist, uint32_t key);
43
44
45 /* *** writer declarations ***************************************************** */
46
47 int pyOTF_Writer_writeDefProcessGroupKV( OTF_Writer* writer, uint32_t stream,
48 uint32_t procGroup, const char* name, uint32_t numberOfProcs,
49 PyObject* procs, OTF_KeyValueList* list);
50
51 int pyOTF_Writer_writeDefProcessGroup( OTF_Writer* writer, uint32_t stream,
52 uint32_t procGroup, const char* name, uint32_t numberOfProcs,
53 PyObject* procs);
54
55 int pyOTF_Writer_writeDefAttributeListKV( OTF_Writer* writer, uint32_t stream,
56 uint32_t attr_token, uint32_t num, PyObject* array,
57 OTF_KeyValueList* list);
58
59 int pyOTF_Writer_writeDefAttributeList( OTF_Writer* writer, uint32_t stream,
60 uint32_t attr_token, uint32_t num, PyObject* array);
61
62
63
64 /* *** handler declarations **************************************************** */
65
66 int pyOTF_Handler_DefinitionComment( void* userData, uint32_t stream,
67 const char* comment, OTF_KeyValueList *list );
68
69
70 int pyOTF_Handler_DefTimerResolution( void* userData, uint32_t stream,
71 uint64_t ticksPerSecond, OTF_KeyValueList *list );
72
73
74 int pyOTF_Handler_DefProcess( void* userData, uint32_t stream,
75 uint32_t process, const char* name, uint32_t parent,
76 OTF_KeyValueList *list );
77
78
79 int pyOTF_Handler_DefProcessGroup( void* userData, uint32_t stream,
80 uint32_t procGroup, const char* name, uint32_t numberOfProcs,
81 const uint32_t* procs, OTF_KeyValueList *list );
82
83
84 int pyOTF_Handler_DefAttributeList( void* userData, uint32_t stream,
85 uint32_t attr_token, uint32_t num, OTF_ATTR_TYPE* array,
86 OTF_KeyValueList *list );
87
88
89 int pyOTF_Handler_DefProcessOrGroupAttributes( void* userData, uint32_t stream,
90 uint32_t proc_token, uint32_t attr_token, OTF_KeyValueList *list );
91
92
93 int pyOTF_Handler_DefFunction( void* userData, uint32_t stream,
94 uint32_t func, const char* name, uint32_t funcGroup,
95 uint32_t source, OTF_KeyValueList *list );
96
97
98 int pyOTF_Handler_DefFunctionGroup( void* userData, uint32_t stream,
99 uint32_t funcGroup, const char* name, OTF_KeyValueList *list );
100
101
102 int pyOTF_Handler_DefCollectiveOperation( void* userData, uint32_t stream,
103 uint32_t collOp, const char* name, uint32_t type,
104 OTF_KeyValueList *list );
105
106
107 int pyOTF_Handler_DefCounter( void* userData, uint32_t stream,
108 uint32_t counter, const char* name, uint32_t properties,
109 uint32_t counterGroup, const char* unit, OTF_KeyValueList *list );
110
111
112 int pyOTF_Handler_DefCounterGroup( void* userData, uint32_t stream,
113 uint32_t counterGroup, const char* name, OTF_KeyValueList *list );
114
115
116 int pyOTF_Handler_DefScl( void* userData, uint32_t stream,
117 uint32_t source, uint32_t sourceFile, uint32_t line,
118 OTF_KeyValueList *list );
119
120
121 int pyOTF_Handler_DefSclFile( void* userData, uint32_t stream,
122 uint32_t sourceFile, const char* name, OTF_KeyValueList *list );
123
124
125 int pyOTF_Handler_DefCreator( void* userData, uint32_t stream,
126 const char* creator, OTF_KeyValueList *list );
127
128
129 int pyOTF_Handler_DefVersion( void* userData, uint32_t stream,
130 uint8_t major, uint8_t minor, uint8_t sub,
131 const char* string, OTF_KeyValueList *list );
132
133
134 int pyOTF_Handler_DefFile( void* userData, uint32_t stream,
135 uint32_t token, const char *name, uint32_t group,
136 OTF_KeyValueList *list );
137
138
139 int pyOTF_Handler_DefFileGroup( void* userData, uint32_t stream,
140 uint32_t token, const char *name, OTF_KeyValueList *list );
141
142
143 int pyOTF_Handler_DefKeyValue( void* userData, uint32_t stream,
144 uint32_t key, OTF_Type type, const char *name,
145 const char *description, OTF_KeyValueList *list );
146
147
148 int pyOTF_Handler_NoOp( void* userData, uint64_t time,
149 uint32_t process, OTF_KeyValueList *list );
150
151
152 int pyOTF_Handler_Enter( void* userData, uint64_t time,
153 uint32_t function, uint32_t process, uint32_t source,
154 OTF_KeyValueList *list );
155
156
157 int pyOTF_Handler_Leave( void* userData, uint64_t time,
158 uint32_t function, uint32_t process, uint32_t source,
159 OTF_KeyValueList *list );
160
161
162 int pyOTF_Handler_SendMsg( void* userData, uint64_t time,
163 uint32_t sender, uint32_t receiver, uint32_t group,
164 uint32_t type, uint32_t length, uint32_t source,
165 OTF_KeyValueList *list );
166
167
168 int pyOTF_Handler_RecvMsg( void* userData, uint64_t time,
169 uint32_t recvProc, uint32_t sendProc, uint32_t group,
170 uint32_t type, uint32_t length, uint32_t source,
171 OTF_KeyValueList *list );
172
173
174 int pyOTF_Handler_Counter( void* userData, uint64_t time,
175 uint32_t process, uint32_t counter, uint64_t value,
176 OTF_KeyValueList *list );
177
178
179 int pyOTF_Handler_CollectiveOperation( void* userData, uint64_t time,
180 uint32_t process, uint32_t collective, uint32_t procGroup,
181 uint32_t rootProc, uint32_t sent, uint32_t received,
182 uint64_t duration, uint32_t source, OTF_KeyValueList *list );
183
184
185 int pyOTF_Handler_BeginCollectiveOperation( void* userData, uint64_t time,
186 uint32_t process, uint32_t collOp, uint64_t matchingId,
187 uint32_t procGroup, uint32_t rootProc, uint64_t sent,
188 uint64_t received, uint32_t scltoken, OTF_KeyValueList *list );
189
190
191 int pyOTF_Handler_EndCollectiveOperation( void* userData, uint64_t time,
192 uint32_t process, uint64_t matchingId, OTF_KeyValueList *list );
193
194
195 int pyOTF_Handler_EventComment( void* userData, uint64_t time,
196 uint32_t process, const char* comment, OTF_KeyValueList *list );
197
198
199 int pyOTF_Handler_BeginProcess( void* userData, uint64_t time,
200 uint32_t process, OTF_KeyValueList *list );
201
202
203 int pyOTF_Handler_EndProcess( void* userData, uint64_t time,
204 uint32_t process, OTF_KeyValueList *list );
205
206
207 int pyOTF_Handler_FileOperation( void* userData, uint64_t time,
208 uint32_t fileid, uint32_t process, uint64_t handleid,
209 uint32_t operation, uint64_t bytes, uint64_t duration,
210 uint32_t source, OTF_KeyValueList *list );
211
212
213 int pyOTF_Handler_BeginFileOperation( void* userData, uint64_t time,
214 uint32_t process, uint64_t matchingId, uint32_t scltoken,
215 OTF_KeyValueList *list );
216
217
218 int pyOTF_Handler_EndFileOperation( void* userData, uint64_t time,
219 uint32_t process, uint32_t fileid, uint64_t matchingId,
220 uint64_t handleId, uint32_t operation, uint64_t bytes,
221 uint32_t scltoken, OTF_KeyValueList *list );
222
223
224 int pyOTF_Handler_RMAPut( void* userData, uint64_t time,
225 uint32_t process, uint32_t origin, uint32_t target,
226 uint32_t communicator, uint32_t tag, uint64_t bytes,
227 uint32_t source, OTF_KeyValueList *list );
228
229
230 int pyOTF_Handler_RMAPutRemoteEnd( void* userData, uint64_t time,
231 uint32_t process, uint32_t origin, uint32_t target,
232 uint32_t communicator, uint32_t tag, uint64_t bytes,
233 uint32_t source, OTF_KeyValueList *list );
234
235
236 int pyOTF_Handler_RMAGet( void* userData, uint64_t time,
237 uint32_t process, uint32_t origin, uint32_t target,
238 uint32_t communicator, uint32_t tag, uint64_t bytes,
239 uint32_t source, OTF_KeyValueList *list );
240
241
242 int pyOTF_Handler_RMAEnd( void* userData, uint64_t time,
243 uint32_t process, uint32_t remote, uint32_t communicator,
244 uint32_t tag, uint32_t source, OTF_KeyValueList *list );
245
246
247 int pyOTF_Handler_SnapshotComment( void* userData, uint64_t time,
248 uint32_t process, const char* comment, OTF_KeyValueList *list );
249
250
251 int pyOTF_Handler_EnterSnapshot( void *userData, uint64_t time,
252 uint64_t originaltime, uint32_t function, uint32_t process,
253 uint32_t source, OTF_KeyValueList *list );
254
255
256 int pyOTF_Handler_SendSnapshot( void *userData, uint64_t time,
257 uint64_t originaltime, uint32_t sender, uint32_t receiver,
258 uint32_t procGroup, uint32_t tag, uint32_t length,
259 uint32_t source, OTF_KeyValueList *list );
260
261
262 int pyOTF_Handler_OpenFileSnapshot( void* userData, uint64_t time,
263 uint64_t originaltime, uint32_t fileid, uint32_t process,
264 uint64_t handleid, uint32_t source, OTF_KeyValueList *list );
265
266
267 int pyOTF_Handler_BeginCollopSnapshot( void* userData, uint64_t time,
268 uint64_t originaltime, uint32_t process, uint32_t collOp,
269 uint64_t matchingId, uint32_t procGroup, uint32_t rootProc,
270 uint64_t sent, uint64_t received, uint32_t scltoken,
271 OTF_KeyValueList *list );
272
273
274 int pyOTF_Handler_BeginFileOpSnapshot( void* userData, uint64_t time,
275 uint64_t originaltime, uint32_t process, uint64_t matchingId,
276 uint32_t scltoken, OTF_KeyValueList *list );
277
278
279 int pyOTF_Handler_SummaryComment( void* userData, uint64_t time,
280 uint32_t process, const char* comment, OTF_KeyValueList *list );
281
282
283 int pyOTF_Handler_FunctionSummary( void* userData, uint64_t time,
284 uint32_t function, uint32_t process, uint64_t invocations,
285 uint64_t exclTime, uint64_t inclTime, OTF_KeyValueList *list );
286
287
288 int pyOTF_Handler_FunctionGroupSummary( void* userData, uint64_t time,
289 uint32_t funcGroup, uint32_t process, uint64_t invocations,
290 uint64_t exclTime, uint64_t inclTime, OTF_KeyValueList *list );
291
292
293 int pyOTF_Handler_MessageSummary( void* userData, uint64_t time,
294 uint32_t process, uint32_t peer, uint32_t comm,
295 uint32_t type, uint64_t sentNumber, uint64_t receivedNumber,
296 uint64_t sentBytes, uint64_t receivedBytes, OTF_KeyValueList *list );
297
298
299 int pyOTF_Handler_CollopSummary( void *userData, uint64_t time,
300 uint32_t process, uint32_t comm, uint32_t collective,
301 uint64_t sentNumber, uint64_t receivedNumber, uint64_t sentBytes,
302 uint64_t receivedBytes, OTF_KeyValueList *list );
303
304
305 int pyOTF_Handler_FileOperationSummary( void* userData, uint64_t time,
306 uint32_t fileid, uint32_t process, uint64_t nopen,
307 uint64_t nclose, uint64_t nread, uint64_t nwrite,
308 uint64_t nseek, uint64_t bytesread, uint64_t byteswrite,
309 OTF_KeyValueList *list );
310
311
312 int pyOTF_Handler_FileGroupOperationSummary( void* userData, uint64_t time,
313 uint32_t groupid, uint32_t process, uint64_t nopen,
314 uint64_t nclose, uint64_t nread, uint64_t nwrite,
315 uint64_t nseek, uint64_t bytesread, uint64_t byteswrite,
316 OTF_KeyValueList *list );
317
318
319 int pyOTF_Handler_UnknownRecord( void *userData, uint64_t time,
320 uint32_t process, const char *record );
321
322
323 int pyOTF_Handler_DefMarker( void *userData, uint32_t stream,
324 uint32_t token, const char* name, uint32_t type,
325 OTF_KeyValueList *list );
326
327
328 int pyOTF_Handler_Marker( void *userData, uint64_t time,
329 uint32_t process, uint32_t token, const char* text,
330 OTF_KeyValueList *list );
331
332
333
334
335 /* *** DEFINITIONS ********************************************************** */
336 /* ************************************************************************** */
337 int pyOTF_COUNTER_VARTYPE_ISINTEGER( uint64_t x ) {
338 return OTF_COUNTER_VARTYPE_ISINTEGER(x);
339 }
340
341 int pyOTF_COUNTER_VARTYPE_ISSIGNED( uint64_t x ) {
342 return OTF_COUNTER_VARTYPE_ISSIGNED(x);
343 }
344
345 int pyOTF_COUNTER_VARTYPE_ISUNSIGNED( uint64_t x ) {
346 return OTF_COUNTER_VARTYPE_ISUNSIGNED(x);
347 }
348
349 /* *** MASTERCONTROL ******************************************************** */
350 /* ************************************************************************** */
351
352 int pyOTF_MasterControl_appendList( OTF_MasterControl* mc, uint32_t argument,
353 uint32_t l, PyObject* values ) {
354
355
356 int ret;
357 uint32_t* vals= createInt32ArrayFromSequence( values );
358
359
360 ret= OTF_MasterControl_appendList( mc, argument, l, vals );
361
362
363 free( vals );
364
365 return ret;
366
367 }
368
369 /* *** OTF_KEYVALUE ********************************************************* */
370 /* ************************************************************************** */
371
372 uint8_t pyOTF_KeyValueList_appendByteArray( OTF_KeyValueList* kvlist, uint32_t key, PyObject* values, uint32_t len) {
373
374 uint8_t *array;
375 uint8_t ret;
376
377 /* convert a python sequence into a C array */
378 array = createInt8ArrayFromSequence( values );
379
380 ret = OTF_KeyValueList_appendByteArray( kvlist, key, array, len );
381
382 free(array);
383
384
385 return ret;
386 }
387
388 /* this function returns a python sequence of (int, int, list) */
389 PyObject* pyOTF_KeyValueList_getByteArray( OTF_KeyValueList* kvlist, uint32_t key) {
390
391 uint32_t len;
392 uint8_t ret;
393 uint8_t array[OTF_KEYVALUE_MAX_ARRAY_LEN];
394 PyObject* pyarray;
395
396 ret = OTF_KeyValueList_getByteArray( kvlist, key, array, &len);
397
398 pyarray = PyInt_FromLong(ret);
399
400 if( ret != 0 ) {
401 len = 0;
402 }
403
404 /* make a squence by appending an object */
405 pyarray = SWIG_Python_AppendOutput(pyarray, PyInt_FromLong(len) );
406
407 /* expand the sequence by appending an list object, that is created from a C array */
408 pyarray = SWIG_Python_AppendOutput(pyarray, createSequenceFromInt8Array( array, len) );
409
410 return pyarray;
411 }
412
413 /* *** WRITER *************************************************************** */
414 /* ************************************************************************** */
415
416 int pyOTF_Writer_writeDefProcessGroupKV( OTF_Writer* writer, uint32_t stream,
417 uint32_t procGroup, const char* name, uint32_t numberOfProcs,
418 PyObject* procs, OTF_KeyValueList* list) {
419
420
421 int ret;
422 uint32_t* pyprocs= createInt32ArrayFromSequence( procs );
423
424
425 ret= OTF_Writer_writeDefProcessGroupKV( writer, stream,
426 procGroup, name, numberOfProcs,
427 pyprocs, list);
428
429 free( pyprocs );
430
431 return ret;
432 }
433
434 int pyOTF_Writer_writeDefProcessGroup( OTF_Writer* writer, uint32_t stream,
435 uint32_t procGroup, const char* name, uint32_t numberOfProcs,
436 PyObject* procs) {
437
438
439 int ret;
440 uint32_t* pyprocs= createInt32ArrayFromSequence( procs );
441
442
443 ret= OTF_Writer_writeDefProcessGroup( writer, stream,
444 procGroup, name, numberOfProcs,
445 pyprocs);
446
447 free( pyprocs );
448
449 return ret;
450 }
451
452 int pyOTF_Writer_writeDefAttributeListKV( OTF_Writer* writer, uint32_t stream,
453 uint32_t attr_token, uint32_t num, PyObject* array,
454 OTF_KeyValueList* list) {
455
456
457 int ret;
458 OTF_ATTR_TYPE* pyarray= createInt32ArrayFromSequence( array );
459
460
461 ret= OTF_Writer_writeDefAttributeListKV( writer, stream,
462 attr_token, num, pyarray,
463 list);
464
465 free( pyarray );
466
467 return ret;
468 }
469
470 int pyOTF_Writer_writeDefAttributeList( OTF_Writer* writer, uint32_t stream,
471 uint32_t attr_token, uint32_t num, PyObject* array) {
472
473
474 int ret;
475 OTF_ATTR_TYPE* pyarray= createInt32ArrayFromSequence( array );
476
477
478 ret= OTF_Writer_writeDefAttributeList( writer, stream,
479 attr_token, num, pyarray);
480
481 free( pyarray );
482
483 return ret;
484 }
485
486
487
488 /* *** HANDLER ARRAY ******************************************************** */
489 /* ************************************************************************** */
490
491 /* *** handler **************************************************** */
492
493 /* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
494 H= unsigned int
495 K= unsigned long long (if long long exists (its #ifdefd in python sources) )
496 (python 2.5)
497
498 When using l for long int and i for int programs crashed (SEGFAULT) inside
499 Py_BuildValue() in pyOTF_Handler_EventComment()
500
501 H and K are not documented, thus its not "save" to use them, because future and
502 past versions of python may differ
503
504 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */
505
506 int pyOTF_Handler_DefinitionComment( void* userData, uint32_t stream,
507 const char* comment, OTF_KeyValueList *list ) {
508
509
510 pyOTF_FirstHandlerArgument* fha= (pyOTF_FirstHandlerArgument*) userData;
511 PyObject *result;
512 PyObject* arglist;
513 int ret;
514 PyObject* pylist;
515
516 /** creates a new python object of type "OTF_KeyValueList" from a C pointer */
517 pylist = SWIG_NewPointerObj(SWIG_as_voidptr(list), SWIGTYPE_p_OTF_KeyValueList_struct, 0 );
518
519 arglist= Py_BuildValue("OHsO", fha->realfha, stream,
520 comment, pylist );
521
522 result= PyEval_CallObject(fha->func, arglist);
523
524 Py_DECREF(pylist);
525
526 Py_DECREF(arglist);
527
528 ret= (int) PyInt_AsLong( result );
529
530 if( NULL == PyErr_Occurred() ){
531
532 return ret;
533
534 } else {
535
536 PyErr_Print();
537 return OTF_RETURN_ABORT;
538
539 }
540 }
541
542 int pyOTF_Handler_DefTimerResolution( void* userData, uint32_t stream,
543 uint64_t ticksPerSecond, OTF_KeyValueList *list ) {
544
545
546 pyOTF_FirstHandlerArgument* fha= (pyOTF_FirstHandlerArgument*) userData;
547 PyObject *result;
548 PyObject* arglist;
549 int ret;
550 PyObject* pylist;
551
552 /** creates a new python object of type "OTF_KeyValueList" from a C pointer */
553 pylist = SWIG_NewPointerObj(SWIG_as_voidptr(list), SWIGTYPE_p_OTF_KeyValueList_struct, 0 );
554
555 arglist= Py_BuildValue("OHKO", fha->realfha, stream,
556 ticksPerSecond, pylist );
557
558 result= PyEval_CallObject(fha->func, arglist);
559
560 Py_DECREF(pylist);
561
562 Py_DECREF(arglist);
563
564 ret= (int) PyInt_AsLong( result );
565
566 if( NULL == PyErr_Occurred() ){
567
568 return ret;
569
570 } else {
571
572 PyErr_Print();
573 return OTF_RETURN_ABORT;
574
575 }
576 }
577
578 int pyOTF_Handler_DefProcess( void* userData, uint32_t stream,
579 uint32_t process, const char* name, uint32_t parent,
580 OTF_KeyValueList *list ) {
581
582
583 pyOTF_FirstHandlerArgument* fha= (pyOTF_FirstHandlerArgument*) userData;
584 PyObject *result;
585 PyObject* arglist;
586 int ret;
587 PyObject* pylist;
588
589 /** creates a new python object of type "OTF_KeyValueList" from a C pointer */
590 pylist = SWIG_NewPointerObj(SWIG_as_voidptr(list), SWIGTYPE_p_OTF_KeyValueList_struct, 0 );
591
592 arglist= Py_BuildValue("OHHsHO", fha->realfha, stream,
593 process, name, parent,
594 pylist );
595
596 result= PyEval_CallObject(fha->func, arglist);
597
598 Py_DECREF(pylist);
599
600 Py_DECREF(arglist);
601
602 ret= (int) PyInt_AsLong( result );
603
604 if( NULL == PyErr_Occurred() ){
605
606 return ret;
607
608 } else {
609
610 PyErr_Print();
611 return OTF_RETURN_ABORT;
612
613 }
614 }
615
616 int pyOTF_Handler_DefProcessGroup( void* userData, uint32_t stream,
617 uint32_t procGroup, const char* name, uint32_t numberOfProcs,
618 const uint32_t* procs, OTF_KeyValueList *list ) {
619
620
621 pyOTF_FirstHandlerArgument* fha= (pyOTF_FirstHandlerArgument*) userData;
622 PyObject *result;
623 PyObject* arglist;
624 int ret;
625
626 PyObject* pyprocs;
627 uint32_t i;
628 PyObject* pylist;
629
630
631 pyprocs= PyList_New( numberOfProcs );
632 for( i= 0; i < numberOfProcs; ++i ) {
633
634 PyList_SetItem( pyprocs, i, PyInt_FromLong((long) procs[i]) );
635
636 }
637
638 /** creates a new python object of type "OTF_KeyValueList" from a C pointer */
639 pylist = SWIG_NewPointerObj(SWIG_as_voidptr(list), SWIGTYPE_p_OTF_KeyValueList_struct, 0 );
640
641 arglist= Py_BuildValue("OHHsHOO", fha->realfha, stream,
642 procGroup, name, numberOfProcs,
643 pyprocs, pylist );
644
645 result= PyEval_CallObject(fha->func, arglist);
646
647 Py_DECREF(pylist);
648
649 Py_DECREF(arglist);
650
651 ret= (int) PyInt_AsLong( result );
652
653 if( NULL == PyErr_Occurred() ){
654
655 return ret;
656
657 } else {
658
659 PyErr_Print();
660 return OTF_RETURN_ABORT;
661
662 }
663 }
664
665 int pyOTF_Handler_DefAttributeList( void* userData, uint32_t stream,
666 uint32_t attr_token, uint32_t num, OTF_ATTR_TYPE* array,
667 OTF_KeyValueList *list ) {
668
669
670 pyOTF_FirstHandlerArgument* fha= (pyOTF_FirstHandlerArgument*) userData;
671 PyObject *result;
672 PyObject* arglist;
673 int ret;
674
675 PyObject* pyarray;
676 uint32_t i;
677 PyObject* pylist;
678
679
680 pyarray= PyList_New( num );
681 for( i= 0; i < num; ++i ) {
682
683 PyList_SetItem( pyarray, i, PyInt_FromLong((long) array[i]) );
684
685 }
686
687 /** creates a new python object of type "OTF_KeyValueList" from a C pointer */
688 pylist = SWIG_NewPointerObj(SWIG_as_voidptr(list), SWIGTYPE_p_OTF_KeyValueList_struct, 0 );
689
690 arglist= Py_BuildValue("OHHHOO", fha->realfha, stream,
691 attr_token, num, pyarray,
692 pylist );
693
694 result= PyEval_CallObject(fha->func, arglist);
695
696 Py_DECREF(pylist);
697
698 Py_DECREF(arglist);
699
700 ret= (int) PyInt_AsLong( result );
701
702 if( NULL == PyErr_Occurred() ){
703
704 return ret;
705
706 } else {
707
708 PyErr_Print();
709 return OTF_RETURN_ABORT;
710
711 }
712 }
713
714 int pyOTF_Handler_DefProcessOrGroupAttributes( void* userData, uint32_t stream,
715 uint32_t proc_token, uint32_t attr_token, OTF_KeyValueList *list ) {
716
717
718 pyOTF_FirstHandlerArgument* fha= (pyOTF_FirstHandlerArgument*) userData;
719 PyObject *result;
720 PyObject* arglist;
721 int ret;
722 PyObject* pylist;
723
724 /** creates a new python object of type "OTF_KeyValueList" from a C pointer */
725 pylist = SWIG_NewPointerObj(SWIG_as_voidptr(list), SWIGTYPE_p_OTF_KeyValueList_struct, 0 );
726
727 arglist= Py_BuildValue("OHHHO", fha->realfha, stream,
728 proc_token, attr_token, pylist );
729
730 result= PyEval_CallObject(fha->func, arglist);
731
732 Py_DECREF(pylist);
733
734 Py_DECREF(arglist);
735
736 ret= (int) PyInt_AsLong( result );
737
738 if( NULL == PyErr_Occurred() ){
739
740 return ret;
741
742 } else {
743
744 PyErr_Print();
745 return OTF_RETURN_ABORT;
746
747 }
748 }
749
750 int pyOTF_Handler_DefFunction( void* userData, uint32_t stream,
751 uint32_t func, const char* name, uint32_t funcGroup,
752 uint32_t source, OTF_KeyValueList *list ) {
753
754
755 pyOTF_FirstHandlerArgument* fha= (pyOTF_FirstHandlerArgument*) userData;
756 PyObject *result;
757 PyObject* arglist;
758 int ret;
759 PyObject* pylist;
760
761 /** creates a new python object of type "OTF_KeyValueList" from a C pointer */
762 pylist = SWIG_NewPointerObj(SWIG_as_voidptr(list), SWIGTYPE_p_OTF_KeyValueList_struct, 0 );
763
764 arglist= Py_BuildValue("OHHsHHO", fha->realfha, stream,
765 func, name, funcGroup,
766 source, pylist );
767
768 result= PyEval_CallObject(fha->func, arglist);
769
770 Py_DECREF(pylist);
771
772 Py_DECREF(arglist);
773
774 ret= (int) PyInt_AsLong( result );
775
776 if( NULL == PyErr_Occurred() ){
777
778 return ret;
779
780 } else {
781
782 PyErr_Print();
783 return OTF_RETURN_ABORT;
784
785 }
786 }
787
788 int pyOTF_Handler_DefFunctionGroup( void* userData, uint32_t stream,
789 uint32_t funcGroup, const char* name, OTF_KeyValueList *list ) {
790
791
792 pyOTF_FirstHandlerArgument* fha= (pyOTF_FirstHandlerArgument*) userData;
793 PyObject *result;
794 PyObject* arglist;
795 int ret;
796 PyObject* pylist;
797
798 /** creates a new python object of type "OTF_KeyValueList" from a C pointer */
799 pylist = SWIG_NewPointerObj(SWIG_as_voidptr(list), SWIGTYPE_p_OTF_KeyValueList_struct, 0 );
800
801 arglist= Py_BuildValue("OHHsO", fha->realfha, stream,
802 funcGroup, name, pylist );
803
804 result= PyEval_CallObject(fha->func, arglist);
805
806 Py_DECREF(pylist);
807
808 Py_DECREF(arglist);
809
810 ret= (int) PyInt_AsLong( result );
811
812 if( NULL == PyErr_Occurred() ){
813
814 return ret;
815
816 } else {
817
818 PyErr_Print();
819 return OTF_RETURN_ABORT;
820
821 }
822 }
823
824 int pyOTF_Handler_DefCollectiveOperation( void* userData, uint32_t stream,
825 uint32_t collOp, const char* name, uint32_t type,
826 OTF_KeyValueList *list ) {
827
828
829 pyOTF_FirstHandlerArgument* fha= (pyOTF_FirstHandlerArgument*) userData;
830 PyObject *result;
831 PyObject* arglist;
832 int ret;
833 PyObject* pylist;
834
835 /** creates a new python object of type "OTF_KeyValueList" from a C pointer */
836 pylist = SWIG_NewPointerObj(SWIG_as_voidptr(list), SWIGTYPE_p_OTF_KeyValueList_struct, 0 );
837
838 arglist= Py_BuildValue("OHHsHO", fha->realfha, stream,
839 collOp, name, type,
840 pylist );
841
842 result= PyEval_CallObject(fha->func, arglist);
843
844 Py_DECREF(pylist);
845
846 Py_DECREF(arglist);
847
848 ret= (int) PyInt_AsLong( result );
849
850 if( NULL == PyErr_Occurred() ){
851
852 return ret;
853
854 } else {
855
856 PyErr_Print();
857 return OTF_RETURN_ABORT;
858
859 }
860 }
861
862 int pyOTF_Handler_DefCounter( void* userData, uint32_t stream,
863 uint32_t counter, const char* name, uint32_t properties,
864 uint32_t counterGroup, const char* unit, OTF_KeyValueList *list ) {
865
866
867 pyOTF_FirstHandlerArgument* fha= (pyOTF_FirstHandlerArgument*) userData;
868 PyObject *result;
869 PyObject* arglist;
870 int ret;
871 PyObject* pylist;
872
873 /** creates a new python object of type "OTF_KeyValueList" from a C pointer */
874 pylist = SWIG_NewPointerObj(SWIG_as_voidptr(list), SWIGTYPE_p_OTF_KeyValueList_struct, 0 );
875
876 arglist= Py_BuildValue("OHHsHHsO", fha->realfha, stream,
877 counter, name, properties,
878 counterGroup, unit, pylist );
879
880 result= PyEval_CallObject(fha->func, arglist);
881
882 Py_DECREF(pylist);
883
884 Py_DECREF(arglist);
885
886 ret= (int) PyInt_AsLong( result );
887
888 if( NULL == PyErr_Occurred() ){
889
890 return ret;
891
892 } else {
893
894 PyErr_Print();
895 return OTF_RETURN_ABORT;
896
897 }
898 }
899
900 int pyOTF_Handler_DefCounterGroup( void* userData, uint32_t stream,
901 uint32_t counterGroup, const char* name, OTF_KeyValueList *list ) {
902
903
904 pyOTF_FirstHandlerArgument* fha= (pyOTF_FirstHandlerArgument*) userData;
905 PyObject *result;
906 PyObject* arglist;
907 int ret;
908 PyObject* pylist;
909
910 /** creates a new python object of type "OTF_KeyValueList" from a C pointer */
911 pylist = SWIG_NewPointerObj(SWIG_as_voidptr(list), SWIGTYPE_p_OTF_KeyValueList_struct, 0 );
912
913 arglist= Py_BuildValue("OHHsO", fha->realfha, stream,
914 counterGroup, name, pylist );
915
916 result= PyEval_CallObject(fha->func, arglist);
917
918 Py_DECREF(pylist);
919
920 Py_DECREF(arglist);
921
922 ret= (int) PyInt_AsLong( result );
923
924 if( NULL == PyErr_Occurred() ){
925
926 return ret;
927
928 } else {
929
930 PyErr_Print();
931 return OTF_RETURN_ABORT;
932
933 }
934 }
935
936 int pyOTF_Handler_DefScl( void* userData, uint32_t stream,
937 uint32_t source, uint32_t sourceFile, uint32_t line,
938 OTF_KeyValueList *list ) {
939
940
941 pyOTF_FirstHandlerArgument* fha= (pyOTF_FirstHandlerArgument*) userData;
942 PyObject *result;
943 PyObject* arglist;
944 int ret;
945 PyObject* pylist;
946
947 /** creates a new python object of type "OTF_KeyValueList" from a C pointer */
948 pylist = SWIG_NewPointerObj(SWIG_as_voidptr(list), SWIGTYPE_p_OTF_KeyValueList_struct, 0 );
949
950 arglist= Py_BuildValue("OHHHHO", fha->realfha, stream,
951 source, sourceFile, line,
952 pylist );
953
954 result= PyEval_CallObject(fha->func, arglist);
955
956 Py_DECREF(pylist);
957
958 Py_DECREF(arglist);
959
960 ret= (int) PyInt_AsLong( result );
961
962 if( NULL == PyErr_Occurred() ){
963
964 return ret;
965
966 } else {
967
968 PyErr_Print();
969 return OTF_RETURN_ABORT;
970
971 }
972 }
973
974 int pyOTF_Handler_DefSclFile( void* userData, uint32_t stream,
975 uint32_t sourceFile, const char* name, OTF_KeyValueList *list ) {
976
977
978 pyOTF_FirstHandlerArgument* fha= (pyOTF_FirstHandlerArgument*) userData;
979 PyObject *result;
980 PyObject* arglist;
981 int ret;
982 PyObject* pylist;
983
984 /** creates a new python object of type "OTF_KeyValueList" from a C pointer */
985 pylist = SWIG_NewPointerObj(SWIG_as_voidptr(list), SWIGTYPE_p_OTF_KeyValueList_struct, 0 );
986
987 arglist= Py_BuildValue("OHHsO", fha->realfha, stream,
988 sourceFile, name, pylist );
989
990 result= PyEval_CallObject(fha->func, arglist);
991
992 Py_DECREF(pylist);
993
994 Py_DECREF(arglist);
995
996 ret= (int) PyInt_AsLong( result );
997
998 if( NULL == PyErr_Occurred() ){
999
1000 return ret;
1001
1002 } else {
1003
1004 PyErr_Print();
1005 return OTF_RETURN_ABORT;
1006
1007 }
1008 }
1009
1010 int pyOTF_Handler_DefCreator( void* userData, uint32_t stream,
1011 const char* creator, OTF_KeyValueList *list ) {
1012
1013
1014 pyOTF_FirstHandlerArgument* fha= (pyOTF_FirstHandlerArgument*) userData;
1015 PyObject *result;
1016 PyObject* arglist;
1017 int ret;
1018 PyObject* pylist;
1019
1020 /** creates a new python object of type "OTF_KeyValueList" from a C pointer */
1021 pylist = SWIG_NewPointerObj(SWIG_as_voidptr(list), SWIGTYPE_p_OTF_KeyValueList_struct, 0 );
1022
1023 arglist= Py_BuildValue("OHsO", fha->realfha, stream,
1024 creator, pylist );
1025
1026 result= PyEval_CallObject(fha->func, arglist);
1027
1028 Py_DECREF(pylist);
1029
1030 Py_DECREF(arglist);
1031
1032 ret= (int) PyInt_AsLong( result );
1033
1034 if( NULL == PyErr_Occurred() ){
1035
1036 return ret;
1037
1038 } else {
1039
1040 PyErr_Print();
1041 return OTF_RETURN_ABORT;
1042
1043 }
1044 }
1045
1046 int pyOTF_Handler_DefVersion( void* userData, uint32_t stream,
1047 uint8_t major, uint8_t minor, uint8_t sub,
1048 const char* string, OTF_KeyValueList *list ) {
1049
1050
1051 pyOTF_FirstHandlerArgument* fha= (pyOTF_FirstHandlerArgument*) userData;
1052 PyObject *result;
1053 PyObject* arglist;
1054 int ret;
1055 PyObject* pylist;
1056
1057 /** creates a new python object of type "OTF_KeyValueList" from a C pointer */
1058 pylist = SWIG_NewPointerObj(SWIG_as_voidptr(list), SWIGTYPE_p_OTF_KeyValueList_struct, 0 );
1059
1060 arglist= Py_BuildValue("OHHHHsO", fha->realfha, stream,
1061 major, minor, sub,
1062 string, pylist );
1063
1064 result= PyEval_CallObject(fha->func, arglist);
1065
1066 Py_DECREF(pylist);
1067
1068 Py_DECREF(arglist);
1069
1070 ret= (int) PyInt_AsLong( result );
1071
1072 if( NULL == PyErr_Occurred() ){
1073
1074 return ret;
1075
1076 } else {
1077
1078 PyErr_Print();
1079 return OTF_RETURN_ABORT;
1080
1081 }
1082 }
1083
1084 int pyOTF_Handler_DefFile( void* userData, uint32_t stream,
1085 uint32_t token, const char *name, uint32_t group,
1086 OTF_KeyValueList *list ) {
1087
1088
1089 pyOTF_FirstHandlerArgument* fha= (pyOTF_FirstHandlerArgument*) userData;
1090 PyObject *result;
1091 PyObject* arglist;
1092 int ret;
1093 PyObject* pylist;
1094
1095 /** creates a new python object of type "OTF_KeyValueList" from a C pointer */
1096 pylist = SWIG_NewPointerObj(SWIG_as_voidptr(list), SWIGTYPE_p_OTF_KeyValueList_struct, 0 );
1097
1098 arglist= Py_BuildValue("OHHsHO", fha->realfha, stream,
1099 token, name, group,
1100 pylist );
1101
1102 result= PyEval_CallObject(fha->func, arglist);
1103
1104 Py_DECREF(pylist);
1105
1106 Py_DECREF(arglist);
1107
1108 ret= (int) PyInt_AsLong( result );
1109
1110 if( NULL == PyErr_Occurred() ){
1111
1112 return ret;
1113
1114 } else {
1115
1116 PyErr_Print();
1117 return OTF_RETURN_ABORT;
1118
1119 }
1120 }
1121
1122 int pyOTF_Handler_DefFileGroup( void* userData, uint32_t stream,
1123 uint32_t token, const char *name, OTF_KeyValueList *list ) {
1124
1125
1126 pyOTF_FirstHandlerArgument* fha= (pyOTF_FirstHandlerArgument*) userData;
1127 PyObject *result;
1128 PyObject* arglist;
1129 int ret;
1130 PyObject* pylist;
1131
1132 /** creates a new python object of type "OTF_KeyValueList" from a C pointer */
1133 pylist = SWIG_NewPointerObj(SWIG_as_voidptr(list), SWIGTYPE_p_OTF_KeyValueList_struct, 0 );
1134
1135 arglist= Py_BuildValue("OHHsO", fha->realfha, stream,
1136 token, name, pylist );
1137
1138 result= PyEval_CallObject(fha->func, arglist);
1139
1140 Py_DECREF(pylist);
1141
1142 Py_DECREF(arglist);
1143
1144 ret= (int) PyInt_AsLong( result );
1145
1146 if( NULL == PyErr_Occurred() ){
1147
1148 return ret;
1149
1150 } else {
1151
1152 PyErr_Print();
1153 return OTF_RETURN_ABORT;
1154
1155 }
1156 }
1157
1158 int pyOTF_Handler_DefKeyValue( void* userData, uint32_t stream,
1159 uint32_t key, OTF_Type type, const char *name,
1160 const char *description, OTF_KeyValueList *list ) {
1161
1162
1163 pyOTF_FirstHandlerArgument* fha= (pyOTF_FirstHandlerArgument*) userData;
1164 PyObject *result;
1165 PyObject* arglist;
1166 int ret;
1167 PyObject* pylist;
1168
1169 /** creates a new python object of type "OTF_KeyValueList" from a C pointer */
1170 pylist = SWIG_NewPointerObj(SWIG_as_voidptr(list), SWIGTYPE_p_OTF_KeyValueList_struct, 0 );
1171
1172 arglist= Py_BuildValue("OHHHssO", fha->realfha, stream,
1173 key, type, name,
1174 description, pylist );
1175
1176 result= PyEval_CallObject(fha->func, arglist);
1177
1178 Py_DECREF(pylist);
1179
1180 Py_DECREF(arglist);
1181
1182 ret= (int) PyInt_AsLong( result );
1183
1184 if( NULL == PyErr_Occurred() ){
1185
1186 return ret;
1187
1188 } else {
1189
1190 PyErr_Print();
1191 return OTF_RETURN_ABORT;
1192
1193 }
1194 }
1195
1196 int pyOTF_Handler_NoOp( void* userData, uint64_t time,
1197 uint32_t process, OTF_KeyValueList *list ) {
1198
1199
1200 pyOTF_FirstHandlerArgument* fha= (pyOTF_FirstHandlerArgument*) userData;
1201 PyObject *result;
1202 PyObject* arglist;
1203 int ret;
1204 PyObject* pylist;
1205
1206 /** creates a new python object of type "OTF_KeyValueList" from a C pointer */
1207 pylist = SWIG_NewPointerObj(SWIG_as_voidptr(list), SWIGTYPE_p_OTF_KeyValueList_struct, 0 );
1208
1209 arglist= Py_BuildValue("OKHO", fha->realfha, time,
1210 process, pylist );
1211
1212 result= PyEval_CallObject(fha->func, arglist);
1213
1214 Py_DECREF(pylist);
1215
1216 Py_DECREF(arglist);
1217
1218 ret= (int) PyInt_AsLong( result );
1219
1220 if( NULL == PyErr_Occurred() ){
1221
1222 return ret;
1223
1224 } else {
1225
1226 PyErr_Print();
1227 return OTF_RETURN_ABORT;
1228
1229 }
1230 }
1231
1232 int pyOTF_Handler_Enter( void* userData, uint64_t time,
1233 uint32_t function, uint32_t process, uint32_t source,
1234 OTF_KeyValueList *list ) {
1235
1236
1237 pyOTF_FirstHandlerArgument* fha= (pyOTF_FirstHandlerArgument*) userData;
1238 PyObject *result;
1239 PyObject* arglist;
1240 int ret;
1241 PyObject* pylist;
1242
1243 /** creates a new python object of type "OTF_KeyValueList" from a C pointer */
1244 pylist = SWIG_NewPointerObj(SWIG_as_voidptr(list), SWIGTYPE_p_OTF_KeyValueList_struct, 0 );
1245
1246 arglist= Py_BuildValue("OKHHHO", fha->realfha, time,
1247 function, process, source,
1248 pylist );
1249
1250 result= PyEval_CallObject(fha->func, arglist);
1251
1252 Py_DECREF(pylist);
1253
1254 Py_DECREF(arglist);
1255
1256 ret= (int) PyInt_AsLong( result );
1257
1258 if( NULL == PyErr_Occurred() ){
1259
1260 return ret;
1261
1262 } else {
1263
1264 PyErr_Print();
1265 return OTF_RETURN_ABORT;
1266
1267 }
1268 }
1269
1270 int pyOTF_Handler_Leave( void* userData, uint64_t time,
1271 uint32_t function, uint32_t process, uint32_t source,
1272 OTF_KeyValueList *list ) {
1273
1274
1275 pyOTF_FirstHandlerArgument* fha= (pyOTF_FirstHandlerArgument*) userData;
1276 PyObject *result;
1277 PyObject* arglist;
1278 int ret;
1279 PyObject* pylist;
1280
1281 /** creates a new python object of type "OTF_KeyValueList" from a C pointer */
1282 pylist = SWIG_NewPointerObj(SWIG_as_voidptr(list), SWIGTYPE_p_OTF_KeyValueList_struct, 0 );
1283
1284 arglist= Py_BuildValue("OKHHHO", fha->realfha, time,
1285 function, process, source,
1286 pylist );
1287
1288 result= PyEval_CallObject(fha->func, arglist);
1289
1290 Py_DECREF(pylist);
1291
1292 Py_DECREF(arglist);
1293
1294 ret= (int) PyInt_AsLong( result );
1295
1296 if( NULL == PyErr_Occurred() ){
1297
1298 return ret;
1299
1300 } else {
1301
1302 PyErr_Print();
1303 return OTF_RETURN_ABORT;
1304
1305 }
1306 }
1307
1308 int pyOTF_Handler_SendMsg( void* userData, uint64_t time,
1309 uint32_t sender, uint32_t receiver, uint32_t group,
1310 uint32_t type, uint32_t length, uint32_t source,
1311 OTF_KeyValueList *list ) {
1312
1313
1314 pyOTF_FirstHandlerArgument* fha= (pyOTF_FirstHandlerArgument*) userData;
1315 PyObject *result;
1316 PyObject* arglist;
1317 int ret;
1318 PyObject* pylist;
1319
1320 /** creates a new python object of type "OTF_KeyValueList" from a C pointer */
1321 pylist = SWIG_NewPointerObj(SWIG_as_voidptr(list), SWIGTYPE_p_OTF_KeyValueList_struct, 0 );
1322
1323 arglist= Py_BuildValue("OKHHHHHHO", fha->realfha, time,
1324 sender, receiver, group,
1325 type, length, source,
1326 pylist );
1327
1328 result= PyEval_CallObject(fha->func, arglist);
1329
1330 Py_DECREF(pylist);
1331
1332 Py_DECREF(arglist);
1333
1334 ret= (int) PyInt_AsLong( result );
1335
1336 if( NULL == PyErr_Occurred() ){
1337
1338 return ret;
1339
1340 } else {
1341
1342 PyErr_Print();
1343 return OTF_RETURN_ABORT;
1344
1345 }
1346 }
1347
1348 int pyOTF_Handler_RecvMsg( void* userData, uint64_t time,
1349 uint32_t recvProc, uint32_t sendProc, uint32_t group,
1350 uint32_t type, uint32_t length, uint32_t source,
1351 OTF_KeyValueList *list ) {
1352
1353
1354 pyOTF_FirstHandlerArgument* fha= (pyOTF_FirstHandlerArgument*) userData;
1355 PyObject *result;
1356 PyObject* arglist;
1357 int ret;
1358 PyObject* pylist;
1359
1360 /** creates a new python object of type "OTF_KeyValueList" from a C pointer */
1361 pylist = SWIG_NewPointerObj(SWIG_as_voidptr(list), SWIGTYPE_p_OTF_KeyValueList_struct, 0 );
1362
1363 arglist= Py_BuildValue("OKHHHHHHO", fha->realfha, time,
1364 recvProc, sendProc, group,
1365 type, length, source,
1366 pylist );
1367
1368 result= PyEval_CallObject(fha->func, arglist);
1369
1370 Py_DECREF(pylist);
1371
1372 Py_DECREF(arglist);
1373
1374 ret= (int) PyInt_AsLong( result );
1375
1376 if( NULL == PyErr_Occurred() ){
1377
1378 return ret;
1379
1380 } else {
1381
1382 PyErr_Print();
1383 return OTF_RETURN_ABORT;
1384
1385 }
1386 }
1387
1388 int pyOTF_Handler_Counter( void* userData, uint64_t time,
1389 uint32_t process, uint32_t counter, uint64_t value,
1390 OTF_KeyValueList *list ) {
1391
1392
1393 pyOTF_FirstHandlerArgument* fha= (pyOTF_FirstHandlerArgument*) userData;
1394 PyObject *result;
1395 PyObject* arglist;
1396 int ret;
1397 PyObject* pylist;
1398
1399 /** creates a new python object of type "OTF_KeyValueList" from a C pointer */
1400 pylist = SWIG_NewPointerObj(SWIG_as_voidptr(list), SWIGTYPE_p_OTF_KeyValueList_struct, 0 );
1401
1402 arglist= Py_BuildValue("OKHHKO", fha->realfha, time,
1403 process, counter, value,
1404 pylist );
1405
1406 result= PyEval_CallObject(fha->func, arglist);
1407
1408 Py_DECREF(pylist);
1409
1410 Py_DECREF(arglist);
1411
1412 ret= (int) PyInt_AsLong( result );
1413
1414 if( NULL == PyErr_Occurred() ){
1415
1416 return ret;
1417
1418 } else {
1419
1420 PyErr_Print();
1421 return OTF_RETURN_ABORT;
1422
1423 }
1424 }
1425
1426 int pyOTF_Handler_CollectiveOperation( void* userData, uint64_t time,
1427 uint32_t process, uint32_t collective, uint32_t procGroup,
1428 uint32_t rootProc, uint32_t sent, uint32_t received,
1429 uint64_t duration, uint32_t source, OTF_KeyValueList *list ) {
1430
1431
1432 pyOTF_FirstHandlerArgument* fha= (pyOTF_FirstHandlerArgument*) userData;
1433 PyObject *result;
1434 PyObject* arglist;
1435 int ret;
1436 PyObject* pylist;
1437
1438 /** creates a new python object of type "OTF_KeyValueList" from a C pointer */
1439 pylist = SWIG_NewPointerObj(SWIG_as_voidptr(list), SWIGTYPE_p_OTF_KeyValueList_struct, 0 );
1440
1441 arglist= Py_BuildValue("OKHHHHHHKHO", fha->realfha, time,
1442 process, collective, procGroup,
1443 rootProc, sent, received,
1444 duration, source, pylist );
1445
1446 result= PyEval_CallObject(fha->func, arglist);
1447
1448 Py_DECREF(pylist);
1449
1450 Py_DECREF(arglist);
1451
1452 ret= (int) PyInt_AsLong( result );
1453
1454 if( NULL == PyErr_Occurred() ){
1455
1456 return ret;
1457
1458 } else {
1459
1460 PyErr_Print();
1461 return OTF_RETURN_ABORT;
1462
1463 }
1464 }
1465
1466 int pyOTF_Handler_BeginCollectiveOperation( void* userData, uint64_t time,
1467 uint32_t process, uint32_t collOp, uint64_t matchingId,
1468 uint32_t procGroup, uint32_t rootProc, uint64_t sent,
1469 uint64_t received, uint32_t scltoken, OTF_KeyValueList *list ) {
1470
1471
1472 pyOTF_FirstHandlerArgument* fha= (pyOTF_FirstHandlerArgument*) userData;
1473 PyObject *result;
1474 PyObject* arglist;
1475 int ret;
1476 PyObject* pylist;
1477
1478 /** creates a new python object of type "OTF_KeyValueList" from a C pointer */
1479 pylist = SWIG_NewPointerObj(SWIG_as_voidptr(list), SWIGTYPE_p_OTF_KeyValueList_struct, 0 );
1480
1481 arglist= Py_BuildValue("OKHHKHHKKHO", fha->realfha, time,
1482 process, collOp, matchingId,
1483 procGroup, rootProc, sent,
1484 received, scltoken, pylist );
1485
1486 result= PyEval_CallObject(fha->func, arglist);
1487
1488 Py_DECREF(pylist);
1489
1490 Py_DECREF(arglist);
1491
1492 ret= (int) PyInt_AsLong( result );
1493
1494 if( NULL == PyErr_Occurred() ){
1495
1496 return ret;
1497
1498 } else {
1499
1500 PyErr_Print();
1501 return OTF_RETURN_ABORT;
1502
1503 }
1504 }
1505
1506 int pyOTF_Handler_EndCollectiveOperation( void* userData, uint64_t time,
1507 uint32_t process, uint64_t matchingId, OTF_KeyValueList *list ) {
1508
1509
1510 pyOTF_FirstHandlerArgument* fha= (pyOTF_FirstHandlerArgument*) userData;
1511 PyObject *result;
1512 PyObject* arglist;
1513 int ret;
1514 PyObject* pylist;
1515
1516 /** creates a new python object of type "OTF_KeyValueList" from a C pointer */
1517 pylist = SWIG_NewPointerObj(SWIG_as_voidptr(list), SWIGTYPE_p_OTF_KeyValueList_struct, 0 );
1518
1519 arglist= Py_BuildValue("OKHKO", fha->realfha, time,
1520 process, matchingId, pylist );
1521
1522 result= PyEval_CallObject(fha->func, arglist);
1523
1524 Py_DECREF(pylist);
1525
1526 Py_DECREF(arglist);
1527
1528 ret= (int) PyInt_AsLong( result );
1529
1530 if( NULL == PyErr_Occurred() ){
1531
1532 return ret;
1533
1534 } else {
1535
1536 PyErr_Print();
1537 return OTF_RETURN_ABORT;
1538
1539 }
1540 }
1541
1542 int pyOTF_Handler_EventComment( void* userData, uint64_t time,
1543 uint32_t process, const char* comment, OTF_KeyValueList *list ) {
1544
1545
1546 pyOTF_FirstHandlerArgument* fha= (pyOTF_FirstHandlerArgument*) userData;
1547 PyObject *result;
1548 PyObject* arglist;
1549 int ret;
1550 PyObject* pylist;
1551
1552 /** creates a new python object of type "OTF_KeyValueList" from a C pointer */
1553 pylist = SWIG_NewPointerObj(SWIG_as_voidptr(list), SWIGTYPE_p_OTF_KeyValueList_struct, 0 );
1554
1555 arglist= Py_BuildValue("OKHsO", fha->realfha, time,
1556 process, comment, pylist );
1557
1558 result= PyEval_CallObject(fha->func, arglist);
1559
1560 Py_DECREF(pylist);
1561
1562 Py_DECREF(arglist);
1563
1564 ret= (int) PyInt_AsLong( result );
1565
1566 if( NULL == PyErr_Occurred() ){
1567
1568 return ret;
1569
1570 } else {
1571
1572 PyErr_Print();
1573 return OTF_RETURN_ABORT;
1574
1575 }
1576 }
1577
1578 int pyOTF_Handler_BeginProcess( void* userData, uint64_t time,
1579 uint32_t process, OTF_KeyValueList *list ) {
1580
1581
1582 pyOTF_FirstHandlerArgument* fha= (pyOTF_FirstHandlerArgument*) userData;
1583 PyObject *result;
1584 PyObject* arglist;
1585 int ret;
1586 PyObject* pylist;
1587
1588 /** creates a new python object of type "OTF_KeyValueList" from a C pointer */
1589 pylist = SWIG_NewPointerObj(SWIG_as_voidptr(list), SWIGTYPE_p_OTF_KeyValueList_struct, 0 );
1590
1591 arglist= Py_BuildValue("OKHO", fha->realfha, time,
1592 process, pylist );
1593
1594 result= PyEval_CallObject(fha->func, arglist);
1595
1596 Py_DECREF(pylist);
1597
1598 Py_DECREF(arglist);
1599
1600 ret= (int) PyInt_AsLong( result );
1601
1602 if( NULL == PyErr_Occurred() ){
1603
1604 return ret;
1605
1606 } else {
1607
1608 PyErr_Print();
1609 return OTF_RETURN_ABORT;
1610
1611 }
1612 }
1613
1614 int pyOTF_Handler_EndProcess( void* userData, uint64_t time,
1615 uint32_t process, OTF_KeyValueList *list ) {
1616
1617
1618 pyOTF_FirstHandlerArgument* fha= (pyOTF_FirstHandlerArgument*) userData;
1619 PyObject *result;
1620 PyObject* arglist;
1621 int ret;
1622 PyObject* pylist;
1623
1624 /** creates a new python object of type "OTF_KeyValueList" from a C pointer */
1625 pylist = SWIG_NewPointerObj(SWIG_as_voidptr(list), SWIGTYPE_p_OTF_KeyValueList_struct, 0 );
1626
1627 arglist= Py_BuildValue("OKHO", fha->realfha, time,
1628 process, pylist );
1629
1630 result= PyEval_CallObject(fha->func, arglist);
1631
1632 Py_DECREF(pylist);
1633
1634 Py_DECREF(arglist);
1635
1636 ret= (int) PyInt_AsLong( result );
1637
1638 if( NULL == PyErr_Occurred() ){
1639
1640 return ret;
1641
1642 } else {
1643
1644 PyErr_Print();
1645 return OTF_RETURN_ABORT;
1646
1647 }
1648 }
1649
1650 int pyOTF_Handler_FileOperation( void* userData, uint64_t time,
1651 uint32_t fileid, uint32_t process, uint64_t handleid,
1652 uint32_t operation, uint64_t bytes, uint64_t duration,
1653 uint32_t source, OTF_KeyValueList *list ) {
1654
1655
1656 pyOTF_FirstHandlerArgument* fha= (pyOTF_FirstHandlerArgument*) userData;
1657 PyObject *result;
1658 PyObject* arglist;
1659 int ret;
1660 PyObject* pylist;
1661
1662 /** creates a new python object of type "OTF_KeyValueList" from a C pointer */
1663 pylist = SWIG_NewPointerObj(SWIG_as_voidptr(list), SWIGTYPE_p_OTF_KeyValueList_struct, 0 );
1664
1665 arglist= Py_BuildValue("OKHHKHKKHO", fha->realfha, time,
1666 fileid, process, handleid,
1667 operation, bytes, duration,
1668 source, pylist );
1669
1670 result= PyEval_CallObject(fha->func, arglist);
1671
1672 Py_DECREF(pylist);
1673
1674 Py_DECREF(arglist);
1675
1676 ret= (int) PyInt_AsLong( result );
1677
1678 if( NULL == PyErr_Occurred() ){
1679
1680 return ret;
1681
1682 } else {
1683
1684 PyErr_Print();
1685 return OTF_RETURN_ABORT;
1686
1687 }
1688 }
1689
1690 int pyOTF_Handler_BeginFileOperation( void* userData, uint64_t time,
1691 uint32_t process, uint64_t matchingId, uint32_t scltoken,
1692 OTF_KeyValueList *list ) {
1693
1694
1695 pyOTF_FirstHandlerArgument* fha= (pyOTF_FirstHandlerArgument*) userData;
1696 PyObject *result;
1697 PyObject* arglist;
1698 int ret;
1699 PyObject* pylist;
1700
1701 /** creates a new python object of type "OTF_KeyValueList" from a C pointer */
1702 pylist = SWIG_NewPointerObj(SWIG_as_voidptr(list), SWIGTYPE_p_OTF_KeyValueList_struct, 0 );
1703
1704 arglist= Py_BuildValue("OKHKHO", fha->realfha, time,
1705 process, matchingId, scltoken,
1706 pylist );
1707
1708 result= PyEval_CallObject(fha->func, arglist);
1709
1710 Py_DECREF(pylist);
1711
1712 Py_DECREF(arglist);
1713
1714 ret= (int) PyInt_AsLong( result );
1715
1716 if( NULL == PyErr_Occurred() ){
1717
1718 return ret;
1719
1720 } else {
1721
1722 PyErr_Print();
1723 return OTF_RETURN_ABORT;
1724
1725 }
1726 }
1727
1728 int pyOTF_Handler_EndFileOperation( void* userData, uint64_t time,
1729 uint32_t process, uint32_t fileid, uint64_t matchingId,
1730 uint64_t handleId, uint32_t operation, uint64_t bytes,
1731 uint32_t scltoken, OTF_KeyValueList *list ) {
1732
1733
1734 pyOTF_FirstHandlerArgument* fha= (pyOTF_FirstHandlerArgument*) userData;
1735 PyObject *result;
1736 PyObject* arglist;
1737 int ret;
1738 PyObject* pylist;
1739
1740 /** creates a new python object of type "OTF_KeyValueList" from a C pointer */
1741 pylist = SWIG_NewPointerObj(SWIG_as_voidptr(list), SWIGTYPE_p_OTF_KeyValueList_struct, 0 );
1742
1743 arglist= Py_BuildValue("OKHHKKHKHO", fha->realfha, time,
1744 process, fileid, matchingId,
1745 handleId, operation, bytes,
1746 scltoken, pylist );
1747
1748 result= PyEval_CallObject(fha->func, arglist);
1749
1750 Py_DECREF(pylist);
1751
1752 Py_DECREF(arglist);
1753
1754 ret= (int) PyInt_AsLong( result );
1755
1756 if( NULL == PyErr_Occurred() ){
1757
1758 return ret;
1759
1760 } else {
1761
1762 PyErr_Print();
1763 return OTF_RETURN_ABORT;
1764
1765 }
1766 }
1767
1768 int pyOTF_Handler_RMAPut( void* userData, uint64_t time,
1769 uint32_t process, uint32_t origin, uint32_t target,
1770 uint32_t communicator, uint32_t tag, uint64_t bytes,
1771 uint32_t source, OTF_KeyValueList *list ) {
1772
1773
1774 pyOTF_FirstHandlerArgument* fha= (pyOTF_FirstHandlerArgument*) userData;
1775 PyObject *result;
1776 PyObject* arglist;
1777 int ret;
1778 PyObject* pylist;
1779
1780 /** creates a new python object of type "OTF_KeyValueList" from a C pointer */
1781 pylist = SWIG_NewPointerObj(SWIG_as_voidptr(list), SWIGTYPE_p_OTF_KeyValueList_struct, 0 );
1782
1783 arglist= Py_BuildValue("OKHHHHHKHO", fha->realfha, time,
1784 process, origin, target,
1785 communicator, tag, bytes,
1786 source, pylist );
1787
1788 result= PyEval_CallObject(fha->func, arglist);
1789
1790 Py_DECREF(pylist);
1791
1792 Py_DECREF(arglist);
1793
1794 ret= (int) PyInt_AsLong( result );
1795
1796 if( NULL == PyErr_Occurred() ){
1797
1798 return ret;
1799
1800 } else {
1801
1802 PyErr_Print();
1803 return OTF_RETURN_ABORT;
1804
1805 }
1806 }
1807
1808 int pyOTF_Handler_RMAPutRemoteEnd( void* userData, uint64_t time,
1809 uint32_t process, uint32_t origin, uint32_t target,
1810 uint32_t communicator, uint32_t tag, uint64_t bytes,
1811 uint32_t source, OTF_KeyValueList *list ) {
1812
1813
1814 pyOTF_FirstHandlerArgument* fha= (pyOTF_FirstHandlerArgument*) userData;
1815 PyObject *result;
1816 PyObject* arglist;
1817 int ret;
1818 PyObject* pylist;
1819
1820 /** creates a new python object of type "OTF_KeyValueList" from a C pointer */
1821 pylist = SWIG_NewPointerObj(SWIG_as_voidptr(list), SWIGTYPE_p_OTF_KeyValueList_struct, 0 );
1822
1823 arglist= Py_BuildValue("OKHHHHHKHO", fha->realfha, time,
1824 process, origin, target,
1825 communicator, tag, bytes,
1826 source, pylist );
1827
1828 result= PyEval_CallObject(fha->func, arglist);
1829
1830 Py_DECREF(pylist);
1831
1832 Py_DECREF(arglist);
1833
1834 ret= (int) PyInt_AsLong( result );
1835
1836 if( NULL == PyErr_Occurred() ){
1837
1838 return ret;
1839
1840 } else {
1841
1842 PyErr_Print();
1843 return OTF_RETURN_ABORT;
1844
1845 }
1846 }
1847
1848 int pyOTF_Handler_RMAGet( void* userData, uint64_t time,
1849 uint32_t process, uint32_t origin, uint32_t target,
1850 uint32_t communicator, uint32_t tag, uint64_t bytes,
1851 uint32_t source, OTF_KeyValueList *list ) {
1852
1853
1854 pyOTF_FirstHandlerArgument* fha= (pyOTF_FirstHandlerArgument*) userData;
1855 PyObject *result;
1856 PyObject* arglist;
1857 int ret;
1858 PyObject* pylist;
1859
1860 /** creates a new python object of type "OTF_KeyValueList" from a C pointer */
1861 pylist = SWIG_NewPointerObj(SWIG_as_voidptr(list), SWIGTYPE_p_OTF_KeyValueList_struct, 0 );
1862
1863 arglist= Py_BuildValue("OKHHHHHKHO", fha->realfha, time,
1864 process, origin, target,
1865 communicator, tag, bytes,
1866 source, pylist );
1867
1868 result= PyEval_CallObject(fha->func, arglist);
1869
1870 Py_DECREF(pylist);
1871
1872 Py_DECREF(arglist);
1873
1874 ret= (int) PyInt_AsLong( result );
1875
1876 if( NULL == PyErr_Occurred() ){
1877
1878 return ret;
1879
1880 } else {
1881
1882 PyErr_Print();
1883 return OTF_RETURN_ABORT;
1884
1885 }
1886 }
1887
1888 int pyOTF_Handler_RMAEnd( void* userData, uint64_t time,
1889 uint32_t process, uint32_t remote, uint32_t communicator,
1890 uint32_t tag, uint32_t source, OTF_KeyValueList *list ) {
1891
1892
1893 pyOTF_FirstHandlerArgument* fha= (pyOTF_FirstHandlerArgument*) userData;
1894 PyObject *result;
1895 PyObject* arglist;
1896 int ret;
1897 PyObject* pylist;
1898
1899 /** creates a new python object of type "OTF_KeyValueList" from a C pointer */
1900 pylist = SWIG_NewPointerObj(SWIG_as_voidptr(list), SWIGTYPE_p_OTF_KeyValueList_struct, 0 );
1901
1902 arglist= Py_BuildValue("OKHHHHHO", fha->realfha, time,
1903 process, remote, communicator,
1904 tag, source, pylist );
1905
1906 result= PyEval_CallObject(fha->func, arglist);
1907
1908 Py_DECREF(pylist);
1909
1910 Py_DECREF(arglist);
1911
1912 ret= (int) PyInt_AsLong( result );
1913
1914 if( NULL == PyErr_Occurred() ){
1915
1916 return ret;
1917
1918 } else {
1919
1920 PyErr_Print();
1921 return OTF_RETURN_ABORT;
1922
1923 }
1924 }
1925
1926 int pyOTF_Handler_SnapshotComment( void* userData, uint64_t time,
1927 uint32_t process, const char* comment, OTF_KeyValueList *list ) {
1928
1929
1930 pyOTF_FirstHandlerArgument* fha= (pyOTF_FirstHandlerArgument*) userData;
1931 PyObject *result;
1932 PyObject* arglist;
1933 int ret;
1934 PyObject* pylist;
1935
1936 /** creates a new python object of type "OTF_KeyValueList" from a C pointer */
1937 pylist = SWIG_NewPointerObj(SWIG_as_voidptr(list), SWIGTYPE_p_OTF_KeyValueList_struct, 0 );
1938
1939 arglist= Py_BuildValue("OKHsO", fha->realfha, time,
1940 process, comment, pylist );
1941
1942 result= PyEval_CallObject(fha->func, arglist);
1943
1944 Py_DECREF(pylist);
1945
1946 Py_DECREF(arglist);
1947
1948 ret= (int) PyInt_AsLong( result );
1949
1950 if( NULL == PyErr_Occurred() ){
1951
1952 return ret;
1953
1954 } else {
1955
1956 PyErr_Print();
1957 return OTF_RETURN_ABORT;
1958
1959 }
1960 }
1961
1962 int pyOTF_Handler_EnterSnapshot( void *userData, uint64_t time,
1963 uint64_t originaltime, uint32_t function, uint32_t process,
1964 uint32_t source, OTF_KeyValueList *list ) {
1965
1966
1967 pyOTF_FirstHandlerArgument* fha= (pyOTF_FirstHandlerArgument*) userData;
1968 PyObject *result;
1969 PyObject* arglist;
1970 int ret;
1971 PyObject* pylist;
1972
1973 /** creates a new python object of type "OTF_KeyValueList" from a C pointer */
1974 pylist = SWIG_NewPointerObj(SWIG_as_voidptr(list), SWIGTYPE_p_OTF_KeyValueList_struct, 0 );
1975
1976 arglist= Py_BuildValue("OKKHHHO", fha->realfha, time,
1977 originaltime, function, process,
1978 source, pylist );
1979
1980 result= PyEval_CallObject(fha->func, arglist);
1981
1982 Py_DECREF(pylist);
1983
1984 Py_DECREF(arglist);
1985
1986 ret= (int) PyInt_AsLong( result );
1987
1988 if( NULL == PyErr_Occurred() ){
1989
1990 return ret;
1991
1992 } else {
1993
1994 PyErr_Print();
1995 return OTF_RETURN_ABORT;
1996
1997 }
1998 }
1999
2000 int pyOTF_Handler_SendSnapshot( void *userData, uint64_t time,
2001 uint64_t originaltime, uint32_t sender, uint32_t receiver,
2002 uint32_t procGroup, uint32_t tag, uint32_t length,
2003 uint32_t source, OTF_KeyValueList *list ) {
2004
2005
2006 pyOTF_FirstHandlerArgument* fha= (pyOTF_FirstHandlerArgument*) userData;
2007 PyObject *result;
2008 PyObject* arglist;
2009 int ret;
2010 PyObject* pylist;
2011
2012 /** creates a new python object of type "OTF_KeyValueList" from a C pointer */
2013 pylist = SWIG_NewPointerObj(SWIG_as_voidptr(list), SWIGTYPE_p_OTF_KeyValueList_struct, 0 );
2014
2015 arglist= Py_BuildValue("OKKHHHHHHO", fha->realfha, time,
2016 originaltime, sender, receiver,
2017 procGroup, tag, length,
2018 source, pylist );
2019
2020 result= PyEval_CallObject(fha->func, arglist);
2021
2022 Py_DECREF(pylist);
2023
2024 Py_DECREF(arglist);
2025
2026 ret= (int) PyInt_AsLong( result );
2027
2028 if( NULL == PyErr_Occurred() ){
2029
2030 return ret;
2031
2032 } else {
2033
2034 PyErr_Print();
2035 return OTF_RETURN_ABORT;
2036
2037 }
2038 }
2039
2040 int pyOTF_Handler_OpenFileSnapshot( void* userData, uint64_t time,
2041 uint64_t originaltime, uint32_t fileid, uint32_t process,
2042 uint64_t handleid, uint32_t source, OTF_KeyValueList *list ) {
2043
2044
2045 pyOTF_FirstHandlerArgument* fha= (pyOTF_FirstHandlerArgument*) userData;
2046 PyObject *result;
2047 PyObject* arglist;
2048 int ret;
2049 PyObject* pylist;
2050
2051 /** creates a new python object of type "OTF_KeyValueList" from a C pointer */
2052 pylist = SWIG_NewPointerObj(SWIG_as_voidptr(list), SWIGTYPE_p_OTF_KeyValueList_struct, 0 );
2053
2054 arglist= Py_BuildValue("OKKHHKHO", fha->realfha, time,
2055 originaltime, fileid, process,
2056 handleid, source, pylist );
2057
2058 result= PyEval_CallObject(fha->func, arglist);
2059
2060 Py_DECREF(pylist);
2061
2062 Py_DECREF(arglist);
2063
2064 ret= (int) PyInt_AsLong( result );
2065
2066 if( NULL == PyErr_Occurred() ){
2067
2068 return ret;
2069
2070 } else {
2071
2072 PyErr_Print();
2073 return OTF_RETURN_ABORT;
2074
2075 }
2076 }
2077
2078 int pyOTF_Handler_BeginCollopSnapshot( void* userData, uint64_t time,
2079 uint64_t originaltime, uint32_t process, uint32_t collOp,
2080 uint64_t matchingId, uint32_t procGroup, uint32_t rootProc,
2081 uint64_t sent, uint64_t received, uint32_t scltoken,
2082 OTF_KeyValueList *list ) {
2083
2084
2085 pyOTF_FirstHandlerArgument* fha= (pyOTF_FirstHandlerArgument*) userData;
2086 PyObject *result;
2087 PyObject* arglist;
2088 int ret;
2089 PyObject* pylist;
2090
2091 /** creates a new python object of type "OTF_KeyValueList" from a C pointer */
2092 pylist = SWIG_NewPointerObj(SWIG_as_voidptr(list), SWIGTYPE_p_OTF_KeyValueList_struct, 0 );
2093
2094 arglist= Py_BuildValue("OKKHHKHHKKHO", fha->realfha, time,
2095 originaltime, process, collOp,
2096 matchingId, procGroup, rootProc,
2097 sent, received, scltoken,
2098 pylist );
2099
2100 result= PyEval_CallObject(fha->func, arglist);
2101
2102 Py_DECREF(pylist);
2103
2104 Py_DECREF(arglist);
2105
2106 ret= (int) PyInt_AsLong( result );
2107
2108 if( NULL == PyErr_Occurred() ){
2109
2110 return ret;
2111
2112 } else {
2113
2114 PyErr_Print();
2115 return OTF_RETURN_ABORT;
2116
2117 }
2118 }
2119
2120 int pyOTF_Handler_BeginFileOpSnapshot( void* userData, uint64_t time,
2121 uint64_t originaltime, uint32_t process, uint64_t matchingId,
2122 uint32_t scltoken, OTF_KeyValueList *list ) {
2123
2124
2125 pyOTF_FirstHandlerArgument* fha= (pyOTF_FirstHandlerArgument*) userData;
2126 PyObject *result;
2127 PyObject* arglist;
2128 int ret;
2129 PyObject* pylist;
2130
2131 /** creates a new python object of type "OTF_KeyValueList" from a C pointer */
2132 pylist = SWIG_NewPointerObj(SWIG_as_voidptr(list), SWIGTYPE_p_OTF_KeyValueList_struct, 0 );
2133
2134 arglist= Py_BuildValue("OKKHKHO", fha->realfha, time,
2135 originaltime, process, matchingId,
2136 scltoken, pylist );
2137
2138 result= PyEval_CallObject(fha->func, arglist);
2139
2140 Py_DECREF(pylist);
2141
2142 Py_DECREF(arglist);
2143
2144 ret= (int) PyInt_AsLong( result );
2145
2146 if( NULL == PyErr_Occurred() ){
2147
2148 return ret;
2149
2150 } else {
2151
2152 PyErr_Print();
2153 return OTF_RETURN_ABORT;
2154
2155 }
2156 }
2157
2158 int pyOTF_Handler_SummaryComment( void* userData, uint64_t time,
2159 uint32_t process, const char* comment, OTF_KeyValueList *list ) {
2160
2161
2162 pyOTF_FirstHandlerArgument* fha= (pyOTF_FirstHandlerArgument*) userData;
2163 PyObject *result;
2164 PyObject* arglist;
2165 int ret;
2166 PyObject* pylist;
2167
2168 /** creates a new python object of type "OTF_KeyValueList" from a C pointer */
2169 pylist = SWIG_NewPointerObj(SWIG_as_voidptr(list), SWIGTYPE_p_OTF_KeyValueList_struct, 0 );
2170
2171 arglist= Py_BuildValue("OKHsO", fha->realfha, time,
2172 process, comment, pylist );
2173
2174 result= PyEval_CallObject(fha->func, arglist);
2175
2176 Py_DECREF(pylist);
2177
2178 Py_DECREF(arglist);
2179
2180 ret= (int) PyInt_AsLong( result );
2181
2182 if( NULL == PyErr_Occurred() ){
2183
2184 return ret;
2185
2186 } else {
2187
2188 PyErr_Print();
2189 return OTF_RETURN_ABORT;
2190
2191 }
2192 }
2193
2194 int pyOTF_Handler_FunctionSummary( void* userData, uint64_t time,
2195 uint32_t function, uint32_t process, uint64_t invocations,
2196 uint64_t exclTime, uint64_t inclTime, OTF_KeyValueList *list ) {
2197
2198
2199 pyOTF_FirstHandlerArgument* fha= (pyOTF_FirstHandlerArgument*) userData;
2200 PyObject *result;
2201 PyObject* arglist;
2202 int ret;
2203 PyObject* pylist;
2204
2205 /** creates a new python object of type "OTF_KeyValueList" from a C pointer */
2206 pylist = SWIG_NewPointerObj(SWIG_as_voidptr(list), SWIGTYPE_p_OTF_KeyValueList_struct, 0 );
2207
2208 arglist= Py_BuildValue("OKHHKKKO", fha->realfha, time,
2209 function, process, invocations,
2210 exclTime, inclTime, pylist );
2211
2212 result= PyEval_CallObject(fha->func, arglist);
2213
2214 Py_DECREF(pylist);
2215
2216 Py_DECREF(arglist);
2217
2218 ret= (int) PyInt_AsLong( result );
2219
2220 if( NULL == PyErr_Occurred() ){
2221
2222 return ret;
2223
2224 } else {
2225
2226 PyErr_Print();
2227 return OTF_RETURN_ABORT;
2228
2229 }
2230 }
2231
2232 int pyOTF_Handler_FunctionGroupSummary( void* userData, uint64_t time,
2233 uint32_t funcGroup, uint32_t process, uint64_t invocations,
2234 uint64_t exclTime, uint64_t inclTime, OTF_KeyValueList *list ) {
2235
2236
2237 pyOTF_FirstHandlerArgument* fha= (pyOTF_FirstHandlerArgument*) userData;
2238 PyObject *result;
2239 PyObject* arglist;
2240 int ret;
2241 PyObject* pylist;
2242
2243 /** creates a new python object of type "OTF_KeyValueList" from a C pointer */
2244 pylist = SWIG_NewPointerObj(SWIG_as_voidptr(list), SWIGTYPE_p_OTF_KeyValueList_struct, 0 );
2245
2246 arglist= Py_BuildValue("OKHHKKKO", fha->realfha, time,
2247 funcGroup, process, invocations,
2248 exclTime, inclTime, pylist );
2249
2250 result= PyEval_CallObject(fha->func, arglist);
2251
2252 Py_DECREF(pylist);
2253
2254 Py_DECREF(arglist);
2255
2256 ret= (int) PyInt_AsLong( result );
2257
2258 if( NULL == PyErr_Occurred() ){
2259
2260 return ret;
2261
2262 } else {
2263
2264 PyErr_Print();
2265 return OTF_RETURN_ABORT;
2266
2267 }
2268 }
2269
2270 int pyOTF_Handler_MessageSummary( void* userData, uint64_t time,
2271 uint32_t process, uint32_t peer, uint32_t comm,
2272 uint32_t type, uint64_t sentNumber, uint64_t receivedNumber,
2273 uint64_t sentBytes, uint64_t receivedBytes, OTF_KeyValueList *list ) {
2274
2275
2276 pyOTF_FirstHandlerArgument* fha= (pyOTF_FirstHandlerArgument*) userData;
2277 PyObject *result;
2278 PyObject* arglist;
2279 int ret;
2280 PyObject* pylist;
2281
2282 /** creates a new python object of type "OTF_KeyValueList" from a C pointer */
2283 pylist = SWIG_NewPointerObj(SWIG_as_voidptr(list), SWIGTYPE_p_OTF_KeyValueList_struct, 0 );
2284
2285 arglist= Py_BuildValue("OKHHHHKKKKO", fha->realfha, time,
2286 process, peer, comm,
2287 type, sentNumber, receivedNumber,
2288 sentBytes, receivedBytes, pylist );
2289
2290 result= PyEval_CallObject(fha->func, arglist);
2291
2292 Py_DECREF(pylist);
2293
2294 Py_DECREF(arglist);
2295
2296 ret= (int) PyInt_AsLong( result );
2297
2298 if( NULL == PyErr_Occurred() ){
2299
2300 return ret;
2301
2302 } else {
2303
2304 PyErr_Print();
2305 return OTF_RETURN_ABORT;
2306
2307 }
2308 }
2309
2310 int pyOTF_Handler_CollopSummary( void *userData, uint64_t time,
2311 uint32_t process, uint32_t comm, uint32_t collective,
2312 uint64_t sentNumber, uint64_t receivedNumber, uint64_t sentBytes,
2313 uint64_t receivedBytes, OTF_KeyValueList *list ) {
2314
2315
2316 pyOTF_FirstHandlerArgument* fha= (pyOTF_FirstHandlerArgument*) userData;
2317 PyObject *result;
2318 PyObject* arglist;
2319 int ret;
2320 PyObject* pylist;
2321
2322 /** creates a new python object of type "OTF_KeyValueList" from a C pointer */
2323 pylist = SWIG_NewPointerObj(SWIG_as_voidptr(list), SWIGTYPE_p_OTF_KeyValueList_struct, 0 );
2324
2325 arglist= Py_BuildValue("OKHHHKKKKO", fha->realfha, time,
2326 process, comm, collective,
2327 sentNumber, receivedNumber, sentBytes,
2328 receivedBytes, pylist );
2329
2330 result= PyEval_CallObject(fha->func, arglist);
2331
2332 Py_DECREF(pylist);
2333
2334 Py_DECREF(arglist);
2335
2336 ret= (int) PyInt_AsLong( result );
2337
2338 if( NULL == PyErr_Occurred() ){
2339
2340 return ret;
2341
2342 } else {
2343
2344 PyErr_Print();
2345 return OTF_RETURN_ABORT;
2346
2347 }
2348 }
2349
2350 int pyOTF_Handler_FileOperationSummary( void* userData, uint64_t time,
2351 uint32_t fileid, uint32_t process, uint64_t nopen,
2352 uint64_t nclose, uint64_t nread, uint64_t nwrite,
2353 uint64_t nseek, uint64_t bytesread, uint64_t byteswrite,
2354 OTF_KeyValueList *list ) {
2355
2356
2357 pyOTF_FirstHandlerArgument* fha= (pyOTF_FirstHandlerArgument*) userData;
2358 PyObject *result;
2359 PyObject* arglist;
2360 int ret;
2361 PyObject* pylist;
2362
2363 /** creates a new python object of type "OTF_KeyValueList" from a C pointer */
2364 pylist = SWIG_NewPointerObj(SWIG_as_voidptr(list), SWIGTYPE_p_OTF_KeyValueList_struct, 0 );
2365
2366 arglist= Py_BuildValue("OKHHKKKKKKKO", fha->realfha, time,
2367 fileid, process, nopen,
2368 nclose, nread, nwrite,
2369 nseek, bytesread, byteswrite,
2370 pylist );
2371
2372 result= PyEval_CallObject(fha->func, arglist);
2373
2374 Py_DECREF(pylist);
2375
2376 Py_DECREF(arglist);
2377
2378 ret= (int) PyInt_AsLong( result );
2379
2380 if( NULL == PyErr_Occurred() ){
2381
2382 return ret;
2383
2384 } else {
2385
2386 PyErr_Print();
2387 return OTF_RETURN_ABORT;
2388
2389 }
2390 }
2391
2392 int pyOTF_Handler_FileGroupOperationSummary( void* userData, uint64_t time,
2393 uint32_t groupid, uint32_t process, uint64_t nopen,
2394 uint64_t nclose, uint64_t nread, uint64_t nwrite,
2395 uint64_t nseek, uint64_t bytesread, uint64_t byteswrite,
2396 OTF_KeyValueList *list ) {
2397
2398
2399 pyOTF_FirstHandlerArgument* fha= (pyOTF_FirstHandlerArgument*) userData;
2400 PyObject *result;
2401 PyObject* arglist;
2402 int ret;
2403 PyObject* pylist;
2404
2405 /** creates a new python object of type "OTF_KeyValueList" from a C pointer */
2406 pylist = SWIG_NewPointerObj(SWIG_as_voidptr(list), SWIGTYPE_p_OTF_KeyValueList_struct, 0 );
2407
2408 arglist= Py_BuildValue("OKHHKKKKKKKO", fha->realfha, time,
2409 groupid, process, nopen,
2410 nclose, nread, nwrite,
2411 nseek, bytesread, byteswrite,
2412 pylist );
2413
2414 result= PyEval_CallObject(fha->func, arglist);
2415
2416 Py_DECREF(pylist);
2417
2418 Py_DECREF(arglist);
2419
2420 ret= (int) PyInt_AsLong( result );
2421
2422 if( NULL == PyErr_Occurred() ){
2423
2424 return ret;
2425
2426 } else {
2427
2428 PyErr_Print();
2429 return OTF_RETURN_ABORT;
2430
2431 }
2432 }
2433
2434 int pyOTF_Handler_UnknownRecord( void *userData, uint64_t time,
2435 uint32_t process, const char *record ) {
2436
2437
2438 pyOTF_FirstHandlerArgument* fha= (pyOTF_FirstHandlerArgument*) userData;
2439 PyObject *result;
2440 PyObject* arglist;
2441 int ret;
2442
2443
2444 arglist= Py_BuildValue("OKHs", fha->realfha, time,
2445 process, record );
2446
2447 result= PyEval_CallObject(fha->func, arglist);
2448
2449 Py_DECREF(arglist);
2450
2451 ret= (int) PyInt_AsLong( result );
2452
2453 if( NULL == PyErr_Occurred() ){
2454
2455 return ret;
2456
2457 } else {
2458
2459 PyErr_Print();
2460 return OTF_RETURN_ABORT;
2461
2462 }
2463 }
2464
2465 int pyOTF_Handler_DefMarker( void *userData, uint32_t stream,
2466 uint32_t token, const char* name, uint32_t type,
2467 OTF_KeyValueList *list ) {
2468
2469
2470 pyOTF_FirstHandlerArgument* fha= (pyOTF_FirstHandlerArgument*) userData;
2471 PyObject *result;
2472 PyObject* arglist;
2473 int ret;
2474 PyObject* pylist;
2475
2476 /** creates a new python object of type "OTF_KeyValueList" from a C pointer */
2477 pylist = SWIG_NewPointerObj(SWIG_as_voidptr(list), SWIGTYPE_p_OTF_KeyValueList_struct, 0 );
2478
2479 arglist= Py_BuildValue("OHHsHO", fha->realfha, stream,
2480 token, name, type,
2481 pylist );
2482
2483 result= PyEval_CallObject(fha->func, arglist);
2484
2485 Py_DECREF(pylist);
2486
2487 Py_DECREF(arglist);
2488
2489 ret= (int) PyInt_AsLong( result );
2490
2491 if( NULL == PyErr_Occurred() ){
2492
2493 return ret;
2494
2495 } else {
2496
2497 PyErr_Print();
2498 return OTF_RETURN_ABORT;
2499
2500 }
2501 }
2502
2503 int pyOTF_Handler_Marker( void *userData, uint64_t time,
2504 uint32_t process, uint32_t token, const char* text,
2505 OTF_KeyValueList *list ) {
2506
2507
2508 pyOTF_FirstHandlerArgument* fha= (pyOTF_FirstHandlerArgument*) userData;
2509 PyObject *result;
2510 PyObject* arglist;
2511 int ret;
2512 PyObject* pylist;
2513
2514 /** creates a new python object of type "OTF_KeyValueList" from a C pointer */
2515 pylist = SWIG_NewPointerObj(SWIG_as_voidptr(list), SWIGTYPE_p_OTF_KeyValueList_struct, 0 );
2516
2517 arglist= Py_BuildValue("OKHHsO", fha->realfha, time,
2518 process, token, text,
2519 pylist );
2520
2521 result= PyEval_CallObject(fha->func, arglist);
2522
2523 Py_DECREF(pylist);
2524
2525 Py_DECREF(arglist);
2526
2527 ret= (int) PyInt_AsLong( result );
2528
2529 if( NULL == PyErr_Occurred() ){
2530
2531 return ret;
2532
2533 } else {
2534
2535 PyErr_Print();
2536 return OTF_RETURN_ABORT;
2537
2538 }
2539 }
2540
2541
2542
2543 /* *** other HandlerArray functions ***************************************** */
2544
2545 void pyOTF_HandlerArray_close( OTF_HandlerArray* handlers ) {
2546
2547 uint32_t i;
2548
2549 for( i= 0; i < OTF_NRECORDS; ++i ) {
2550
2551 /* delete old fhb, because we allocated it in "pyOTF_HandlerArray_setHandler()" */
2552 if( NULL != handlers->firsthandlerarg[i] ) {
2553
2554 Py_XDECREF( ((pyOTF_FirstHandlerArgument*)handlers->firsthandlerarg[i])->func );
2555 Py_XDECREF( ((pyOTF_FirstHandlerArgument*)handlers->firsthandlerarg[i])->realfha );
2556
2557 free( handlers->firsthandlerarg[i] );
2558 handlers->firsthandlerarg[i]= NULL;
2559 }
2560
2561 }
2562
2563 OTF_HandlerArray_close( handlers );
2564 }
2565
2566
2567 /* returns OTF_RETURN_ABORT or OTF_RETURN_OK */
2568 int pyOTF_HandlerArray_setHandler( OTF_HandlerArray* handlers, PyObject* function, uint32_t recordtype ) {
2569
2570
2571 pyOTF_FirstHandlerArgument* fhb;
2572
2573
2574 /* assertion stuff */
2575 if ( recordtype > OTF_NRECORDS ) {
2576 #ifdef OTF_VERBOSE
2577 PyErr_SetString(PyExc_TypeError,"Unexpected record type");
2578 #endif /* OTF_VERBOSE */
2579 return OTF_RETURN_ABORT;
2580 } else if ( NULL == function || 0 == PyCallable_Check(function) ) {
2581 #ifdef OTF_VERBOSE
2582 PyErr_SetString(PyExc_TypeError,"Expecting a function object");
2583 #endif /* OTF_VERBOSE */
2584 return OTF_RETURN_ABORT;
2585 }
2586
2587 /* if no artificial fha has been set */
2588 if ( NULL == handlers->firsthandlerarg[recordtype] ) {
2589
2590 /* add a new one for this record type */
2591 fhb= malloc( sizeof( pyOTF_FirstHandlerArgument ) );
2592 if( NULL == fhb ) {
2593 #ifdef OTF_VERBOSE
2594 PyErr_SetString(PyExc_TypeError,"No Memory left");
2595 #endif /* OTF_VERBOSE */
2596 return OTF_RETURN_ABORT;
2597 }
2598
2599 Py_INCREF(Py_None);
2600 Py_INCREF(Py_None);
2601 fhb->func= Py_None;
2602 fhb->realfha= Py_None;
2603
2604 OTF_HandlerArray_setFirstHandlerArg( handlers, fhb, recordtype );
2605
2606 }
2607
2608
2609 /* decrease reference counter of the older callback */
2610 Py_XDECREF( ((pyOTF_FirstHandlerArgument*)handlers->firsthandlerarg[recordtype])->func );
2611
2612 /* increase the reference count of the function object */
2613 Py_XINCREF(function);
2614
2615 /* assign the new callback */
2616 ((pyOTF_FirstHandlerArgument*)handlers->firsthandlerarg[recordtype])->func= function;
2617
2618
2619
2620 switch( recordtype ) {
2621
2622 case OTF_DEFINITIONCOMMENT_RECORD :
2623
2624 OTF_HandlerArray_setHandler( handlers,
2625 (OTF_FunctionPointer*) pyOTF_Handler_DefinitionComment, recordtype );
2626
2627 break;
2628
2629 case OTF_DEFTIMERRESOLUTION_RECORD :
2630
2631 OTF_HandlerArray_setHandler( handlers,
2632 (OTF_FunctionPointer*) pyOTF_Handler_DefTimerResolution, recordtype );
2633
2634 break;
2635
2636 case OTF_DEFPROCESS_RECORD :
2637
2638 OTF_HandlerArray_setHandler( handlers,
2639 (OTF_FunctionPointer*) pyOTF_Handler_DefProcess, recordtype );
2640
2641 break;
2642
2643 case OTF_DEFPROCESSGROUP_RECORD :
2644
2645 OTF_HandlerArray_setHandler( handlers,
2646 (OTF_FunctionPointer*) pyOTF_Handler_DefProcessGroup, recordtype );
2647
2648 break;
2649
2650 case OTF_DEFATTRLIST_RECORD :
2651
2652 OTF_HandlerArray_setHandler( handlers,
2653 (OTF_FunctionPointer*) pyOTF_Handler_DefAttributeList, recordtype );
2654
2655 break;
2656
2657 case OTF_DEFPROCESSORGROUPATTR_RECORD :
2658
2659 OTF_HandlerArray_setHandler( handlers,
2660 (OTF_FunctionPointer*) pyOTF_Handler_DefProcessOrGroupAttributes, recordtype );
2661
2662 break;
2663
2664 case OTF_DEFFUNCTION_RECORD :
2665
2666 OTF_HandlerArray_setHandler( handlers,
2667 (OTF_FunctionPointer*) pyOTF_Handler_DefFunction, recordtype );
2668
2669 break;
2670
2671 case OTF_DEFFUNCTIONGROUP_RECORD :
2672
2673 OTF_HandlerArray_setHandler( handlers,
2674 (OTF_FunctionPointer*) pyOTF_Handler_DefFunctionGroup, recordtype );
2675
2676 break;
2677
2678 case OTF_DEFCOLLOP_RECORD :
2679
2680 OTF_HandlerArray_setHandler( handlers,
2681 (OTF_FunctionPointer*) pyOTF_Handler_DefCollectiveOperation, recordtype );
2682
2683 break;
2684
2685 case OTF_DEFCOUNTER_RECORD :
2686
2687 OTF_HandlerArray_setHandler( handlers,
2688 (OTF_FunctionPointer*) pyOTF_Handler_DefCounter, recordtype );
2689
2690 break;
2691
2692 case OTF_DEFCOUNTERGROUP_RECORD :
2693
2694 OTF_HandlerArray_setHandler( handlers,
2695 (OTF_FunctionPointer*) pyOTF_Handler_DefCounterGroup, recordtype );
2696
2697 break;
2698
2699 case OTF_DEFSCL_RECORD :
2700
2701 OTF_HandlerArray_setHandler( handlers,
2702 (OTF_FunctionPointer*) pyOTF_Handler_DefScl, recordtype );
2703
2704 break;
2705
2706 case OTF_DEFSCLFILE_RECORD :
2707
2708 OTF_HandlerArray_setHandler( handlers,
2709 (OTF_FunctionPointer*) pyOTF_Handler_DefSclFile, recordtype );
2710
2711 break;
2712
2713 case OTF_DEFCREATOR_RECORD :
2714
2715 OTF_HandlerArray_setHandler( handlers,
2716 (OTF_FunctionPointer*) pyOTF_Handler_DefCreator, recordtype );
2717
2718 break;
2719
2720 case OTF_DEFVERSION_RECORD :
2721
2722 OTF_HandlerArray_setHandler( handlers,
2723 (OTF_FunctionPointer*) pyOTF_Handler_DefVersion, recordtype );
2724
2725 break;
2726
2727 case OTF_DEFFILE_RECORD :
2728
2729 OTF_HandlerArray_setHandler( handlers,
2730 (OTF_FunctionPointer*) pyOTF_Handler_DefFile, recordtype );
2731
2732 break;
2733
2734 case OTF_DEFFILEGROUP_RECORD :
2735
2736 OTF_HandlerArray_setHandler( handlers,
2737 (OTF_FunctionPointer*) pyOTF_Handler_DefFileGroup, recordtype );
2738
2739 break;
2740
2741 case OTF_DEFKEYVALUE_RECORD :
2742
2743 OTF_HandlerArray_setHandler( handlers,
2744 (OTF_FunctionPointer*) pyOTF_Handler_DefKeyValue, recordtype );
2745
2746 break;
2747
2748 case OTF_NOOP_RECORD :
2749
2750 OTF_HandlerArray_setHandler( handlers,
2751 (OTF_FunctionPointer*) pyOTF_Handler_NoOp, recordtype );
2752
2753 break;
2754
2755 case OTF_ENTER_RECORD :
2756
2757 OTF_HandlerArray_setHandler( handlers,
2758 (OTF_FunctionPointer*) pyOTF_Handler_Enter, recordtype );
2759
2760 break;
2761
2762 case OTF_LEAVE_RECORD :
2763
2764 OTF_HandlerArray_setHandler( handlers,
2765 (OTF_FunctionPointer*) pyOTF_Handler_Leave, recordtype );
2766
2767 break;
2768
2769 case OTF_SEND_RECORD :
2770
2771 OTF_HandlerArray_setHandler( handlers,
2772 (OTF_FunctionPointer*) pyOTF_Handler_SendMsg, recordtype );
2773
2774 break;
2775
2776 case OTF_RECEIVE_RECORD :
2777
2778 OTF_HandlerArray_setHandler( handlers,
2779 (OTF_FunctionPointer*) pyOTF_Handler_RecvMsg, recordtype );
2780
2781 break;
2782
2783 case OTF_COUNTER_RECORD :
2784
2785 OTF_HandlerArray_setHandler( handlers,
2786 (OTF_FunctionPointer*) pyOTF_Handler_Counter, recordtype );
2787
2788 break;
2789
2790 case OTF_COLLOP_RECORD :
2791
2792 OTF_HandlerArray_setHandler( handlers,
2793 (OTF_FunctionPointer*) pyOTF_Handler_CollectiveOperation, recordtype );
2794
2795 break;
2796
2797 case OTF_BEGINCOLLOP_RECORD :
2798
2799 OTF_HandlerArray_setHandler( handlers,
2800 (OTF_FunctionPointer*) pyOTF_Handler_BeginCollectiveOperation, recordtype );
2801
2802 break;
2803
2804 case OTF_ENDCOLLOP_RECORD :
2805
2806 OTF_HandlerArray_setHandler( handlers,
2807 (OTF_FunctionPointer*) pyOTF_Handler_EndCollectiveOperation, recordtype );
2808
2809 break;
2810
2811 case OTF_EVENTCOMMENT_RECORD :
2812
2813 OTF_HandlerArray_setHandler( handlers,
2814 (OTF_FunctionPointer*) pyOTF_Handler_EventComment, recordtype );
2815
2816 break;
2817
2818 case OTF_BEGINPROCESS_RECORD :
2819
2820 OTF_HandlerArray_setHandler( handlers,
2821 (OTF_FunctionPointer*) pyOTF_Handler_BeginProcess, recordtype );
2822
2823 break;
2824
2825 case OTF_ENDPROCESS_RECORD :
2826
2827 OTF_HandlerArray_setHandler( handlers,
2828 (OTF_FunctionPointer*) pyOTF_Handler_EndProcess, recordtype );
2829
2830 break;
2831
2832 case OTF_FILEOPERATION_RECORD :
2833
2834 OTF_HandlerArray_setHandler( handlers,
2835 (OTF_FunctionPointer*) pyOTF_Handler_FileOperation, recordtype );
2836
2837 break;
2838
2839 case OTF_BEGINFILEOP_RECORD :
2840
2841 OTF_HandlerArray_setHandler( handlers,
2842 (OTF_FunctionPointer*) pyOTF_Handler_BeginFileOperation, recordtype );
2843
2844 break;
2845
2846 case OTF_ENDFILEOP_RECORD :
2847
2848 OTF_HandlerArray_setHandler( handlers,
2849 (OTF_FunctionPointer*) pyOTF_Handler_EndFileOperation, recordtype );
2850
2851 break;
2852
2853 case OTF_RMAPUT_RECORD :
2854
2855 OTF_HandlerArray_setHandler( handlers,
2856 (OTF_FunctionPointer*) pyOTF_Handler_RMAPut, recordtype );
2857
2858 break;
2859
2860 case OTF_RMAPUTRE_RECORD :
2861
2862 OTF_HandlerArray_setHandler( handlers,
2863 (OTF_FunctionPointer*) pyOTF_Handler_RMAPutRemoteEnd, recordtype );
2864
2865 break;
2866
2867 case OTF_RMAGET_RECORD :
2868
2869 OTF_HandlerArray_setHandler( handlers,
2870 (OTF_FunctionPointer*) pyOTF_Handler_RMAGet, recordtype );
2871
2872 break;
2873
2874 case OTF_RMAEND_RECORD :
2875
2876 OTF_HandlerArray_setHandler( handlers,
2877 (OTF_FunctionPointer*) pyOTF_Handler_RMAEnd, recordtype );
2878
2879 break;
2880
2881 case OTF_SNAPSHOTCOMMENT_RECORD :
2882
2883 OTF_HandlerArray_setHandler( handlers,
2884 (OTF_FunctionPointer*) pyOTF_Handler_SnapshotComment, recordtype );
2885
2886 break;
2887
2888 case OTF_ENTERSNAPSHOT_RECORD :
2889
2890 OTF_HandlerArray_setHandler( handlers,
2891 (OTF_FunctionPointer*) pyOTF_Handler_EnterSnapshot, recordtype );
2892
2893 break;
2894
2895 case OTF_SENDSNAPSHOT_RECORD :
2896
2897 OTF_HandlerArray_setHandler( handlers,
2898 (OTF_FunctionPointer*) pyOTF_Handler_SendSnapshot, recordtype );
2899
2900 break;
2901
2902 case OTF_OPENFILESNAPSHOT_RECORD :
2903
2904 OTF_HandlerArray_setHandler( handlers,
2905 (OTF_FunctionPointer*) pyOTF_Handler_OpenFileSnapshot, recordtype );
2906
2907 break;
2908
2909 case OTF_BEGINCOLLOPSNAPSHOT_RECORD :
2910
2911 OTF_HandlerArray_setHandler( handlers,
2912 (OTF_FunctionPointer*) pyOTF_Handler_BeginCollopSnapshot, recordtype );
2913
2914 break;
2915
2916 case OTF_BEGINFILEOPSNAPSHOT_RECORD :
2917
2918 OTF_HandlerArray_setHandler( handlers,
2919 (OTF_FunctionPointer*) pyOTF_Handler_BeginFileOpSnapshot, recordtype );
2920
2921 break;
2922
2923 case OTF_SUMMARYCOMMENT_RECORD :
2924
2925 OTF_HandlerArray_setHandler( handlers,
2926 (OTF_FunctionPointer*) pyOTF_Handler_SummaryComment, recordtype );
2927
2928 break;
2929
2930 case OTF_FUNCTIONSUMMARY_RECORD :
2931
2932 OTF_HandlerArray_setHandler( handlers,
2933 (OTF_FunctionPointer*) pyOTF_Handler_FunctionSummary, recordtype );
2934
2935 break;
2936
2937 case OTF_FUNCTIONGROUPSUMMARY_RECORD :
2938
2939 OTF_HandlerArray_setHandler( handlers,
2940 (OTF_FunctionPointer*) pyOTF_Handler_FunctionGroupSummary, recordtype );
2941
2942 break;
2943
2944 case OTF_MESSAGESUMMARY_RECORD :
2945
2946 OTF_HandlerArray_setHandler( handlers,
2947 (OTF_FunctionPointer*) pyOTF_Handler_MessageSummary, recordtype );
2948
2949 break;
2950
2951 case OTF_COLLOPSUMMARY_RECORD :
2952
2953 OTF_HandlerArray_setHandler( handlers,
2954 (OTF_FunctionPointer*) pyOTF_Handler_CollopSummary, recordtype );
2955
2956 break;
2957
2958 case OTF_FILEOPERATIONSUMMARY_RECORD :
2959
2960 OTF_HandlerArray_setHandler( handlers,
2961 (OTF_FunctionPointer*) pyOTF_Handler_FileOperationSummary, recordtype );
2962
2963 break;
2964
2965 case OTF_FILEGROUPOPERATIONSUMMARY_RECORD :
2966
2967 OTF_HandlerArray_setHandler( handlers,
2968 (OTF_FunctionPointer*) pyOTF_Handler_FileGroupOperationSummary, recordtype );
2969
2970 break;
2971
2972 case OTF_UNKNOWN_RECORD :
2973
2974 OTF_HandlerArray_setHandler( handlers,
2975 (OTF_FunctionPointer*) pyOTF_Handler_UnknownRecord, recordtype );
2976
2977 break;
2978
2979 case OTF_DEFMARKER_RECORD :
2980
2981 OTF_HandlerArray_setHandler( handlers,
2982 (OTF_FunctionPointer*) pyOTF_Handler_DefMarker, recordtype );
2983
2984 break;
2985
2986 case OTF_MARKER_RECORD :
2987
2988 OTF_HandlerArray_setHandler( handlers,
2989 (OTF_FunctionPointer*) pyOTF_Handler_Marker, recordtype );
2990
2991 break;
2992
2993
2994
2995 }
2996
2997
2998 return OTF_RETURN_OK;
2999 }
3000
3001
3002 int pyOTF_HandlerArray_setFirstHandlerArg( OTF_HandlerArray* handlers, PyObject* fha, uint32_t recordtype ) {
3003
3004
3005 pyOTF_FirstHandlerArgument* fhb;
3006
3007
3008 /* assertion stuff */
3009 if ( recordtype > OTF_NRECORDS ) {
3010
3011 #ifdef OTF_VERBOSE
3012 PyErr_SetString(PyExc_TypeError,"Unexpected record type");
3013 #endif /* OTF_VERBOSE */
3014 return OTF_RETURN_ABORT;
3015 }
3016
3017
3018 /* if no fha or handler was set before for this record type */
3019 if ( NULL == handlers->firsthandlerarg[recordtype] ) {
3020
3021 /* create an artificial first handler arg */
3022 fhb= malloc( sizeof( pyOTF_FirstHandlerArgument ) );
3023 if( NULL == fhb ) {
3024 #ifdef OTF_VERBOSE
3025 PyErr_SetString(PyExc_TypeError,"No Memory left");
3026 #endif /* OTF_VERBOSE */
3027 return OTF_RETURN_ABORT;
3028 }
3029
3030
3031 Py_INCREF(Py_None);
3032 Py_INCREF(Py_None);
3033 fhb->func= Py_None;
3034 fhb->realfha= Py_None;
3035
3036 OTF_HandlerArray_setFirstHandlerArg( handlers, fhb, recordtype );
3037 }
3038
3039
3040 /* decrease reference counter of the older fha */
3041 Py_XDECREF( ((pyOTF_FirstHandlerArgument*)handlers->firsthandlerarg[recordtype])->realfha );
3042
3043 /* increase reference count of fha */
3044 Py_XINCREF(fha);
3045
3046 /* add the python first handler arg */
3047 ((pyOTF_FirstHandlerArgument*)handlers->firsthandlerarg[recordtype])->realfha= fha;
3048
3049
3050 return OTF_RETURN_OK;
3051 }
3052
3053
3054 #endif /* PYOTF_WRAPPER_H */
OTF_Writer_writeDefAttributeList
int OTF_Writer_writeDefAttributeList(OTF_Writer *writer, uint32_t streamid, uint32_t attr_token, uint32_t num, OTF_ATTR_TYPE *array)
Write an attribute list definition record.
Definition: OTF_Writer.c:715
OTF_MasterControl_appendList
int OTF_MasterControl_appendList(OTF_MasterControl *mc, uint32_t argument, uint32_t l, uint32_t *values)
Append the mapping argument -> ( list of l values ) to the master control structure.
Definition: OTF_MasterControl.c:573
OTF_KeyValueList_getByteArray
uint8_t OTF_KeyValueList_getByteArray(OTF_KeyValueList *list, uint32_t key, uint8_t *value, uint32_t *len)
Read a byte array from the given OTF_KeyValueList instance.
Definition: OTF_KeyValue.c:620
struct_OTF_MasterControl
Data structure that collects the information about which stream contains which parts of a multi-file ...
Definition: OTF_MasterControl.h:166
struct_OTF_HandlerArray::firsthandlerarg
void ** firsthandlerarg
Array of first handler arguments.
Definition: OTF_HandlerArray.h:58
OTF_HandlerArray_setHandler
int OTF_HandlerArray_setHandler(OTF_HandlerArray *handlers, OTF_FunctionPointer *pointer, uint32_t recordtype)
Assign the function pointer to your own handler of the given record type.
Definition: OTF_HandlerArray.c:129
OTF_FunctionPointer
int( OTF_FunctionPointer)(void *userData)
Generic function pointer for OTF record handlers.
Definition: OTF_HandlerArray.h:48
OTF_RETURN_ABORT
#define OTF_RETURN_ABORT
Definition: OTF_Definitions.h:270
struct_OTF_HandlerArray
Object structure which holds OTF record handlers.
Definition: OTF_HandlerArray.h:52
OTF_ATTR_TYPE
enum OTF_ATTR_TYPE_enum OTF_ATTR_TYPE
An enum which holds all values that are possible to set with datatype OTF_ATTR_TYPE().
OTF_Type
enum OTF_Type_enum OTF_Type
An enum which holds all OTF datatypes that are relevant for OTF_KeyValueList.
pyOTF_FirstHandlerArgument
Definition: pyOTF_Wrapper.h:11
OTF_Writer_writeDefAttributeListKV
int OTF_Writer_writeDefAttributeListKV(OTF_Writer *writer, uint32_t streamid, uint32_t attr_token, uint32_t num, OTF_ATTR_TYPE *array, OTF_KeyValueList *list)
Write an attribute list definition record including an OTF_KeyValueList.
Definition: OTF_Writer.c:730
OTF_Writer_writeDefProcessGroup
int OTF_Writer_writeDefProcessGroup(OTF_Writer *writer, uint32_t streamid, uint32_t deftoken, const char *name, uint32_t n, const uint32_t *array)
Write a process group definition record.
Definition: OTF_Writer.c:680
OTF_RETURN_OK
#define OTF_RETURN_OK
When writing an own handler, use these macros to tell OTF, what to do.
Definition: OTF_Definitions.h:266
OTF_HandlerArray_close
int OTF_HandlerArray_close(OTF_HandlerArray *handlers)
Close and delete a OTF_HandlerArray object.
Definition: OTF_HandlerArray.c:108
OTF_HandlerArray_setFirstHandlerArg
int OTF_HandlerArray_setFirstHandlerArg(OTF_HandlerArray *handlers, void *firsthandlerarg, uint32_t recordtype)
Assign the first argument to your own handler of the given record type.
Definition: OTF_HandlerArray.c:147
OTF_KeyValueList
struct OTF_KeyValueList_struct OTF_KeyValueList
Object type which holds a key-value list.
Definition: OTF_KeyValue.h:242
struct_OTF_Writer
Holds the data objects needed for global trace creation.
Definition: OTF_Writer.c:21
OTF_Writer_writeDefProcessGroupKV
int OTF_Writer_writeDefProcessGroupKV(OTF_Writer *writer, uint32_t streamid, uint32_t deftoken, const char *name, uint32_t n, const uint32_t *array, OTF_KeyValueList *list)
Write a process group definition record including an OTF_KeyValueList.
Definition: OTF_Writer.c:697
OTF_KeyValueList_appendByteArray
uint8_t OTF_KeyValueList_appendByteArray(OTF_KeyValueList *list, uint32_t key, uint8_t *value, uint32_t len)
Append a byte array to a given OTF_KeyValueList instance.
Definition: OTF_KeyValue.c:361