-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathevent_processor.cpp
1416 lines (967 loc) · 49.8 KB
/
event_processor.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#include "event_processor.h"
#include <iomanip>
extern "C" {
static OTF2_CallbackCode
GlobalEvtReaderCallback_Enter([[maybe_unused]] OTF2_LocationRef locationID,
OTF2_TimeStamp time, void *userData,
OTF2_AttributeList *attributeList,
OTF2_RegionRef region) {
EventProcessor *reader{static_cast<EventProcessor *>(userData)};
reader->handleEvtEnter(time, attributeList, region);
return OTF2_CALLBACK_SUCCESS;
}
static OTF2_CallbackCode
GlobalEvtReaderCallback_Leave([[maybe_unused]] OTF2_LocationRef locationID,
OTF2_TimeStamp time, void *userData,
OTF2_AttributeList *attributeList,
OTF2_RegionRef region) {
EventProcessor *reader{static_cast<EventProcessor *>(userData)};
reader->handleEvtLeave(time, attributeList, region);
return OTF2_CALLBACK_SUCCESS;
}
static OTF2_CallbackCode
GlobalEvtReaderCallback_MpiSend([[maybe_unused]] OTF2_LocationRef locationID,
OTF2_TimeStamp time, void *userData,
OTF2_AttributeList *attributeList,
uint32_t receiver, OTF2_CommRef communicator,
uint32_t msgTag, uint64_t msgLength) {
EventProcessor *reader{static_cast<EventProcessor *>(userData)};
reader->handleMPISend(attributeList, time, receiver, communicator, msgTag,
msgLength);
return OTF2_CALLBACK_SUCCESS;
}
static OTF2_CallbackCode
GlobalEvtReaderCallback_MpiRecv([[maybe_unused]] OTF2_LocationRef locationID,
OTF2_TimeStamp time, void *userData,
OTF2_AttributeList *attributeList,
uint32_t sender, OTF2_CommRef communicator,
uint32_t msgTag, uint64_t msgLength) {
EventProcessor *reader{static_cast<EventProcessor *>(userData)};
reader->handleMPIRecv(attributeList, time, sender, communicator, msgTag,
msgLength);
return OTF2_CALLBACK_SUCCESS;
}
static OTF2_CallbackCode
GlobalEvtReaderCallback_MpiIsend([[maybe_unused]] OTF2_LocationRef locationID,
OTF2_TimeStamp time, void *userData,
OTF2_AttributeList *attributeList,
uint32_t receiver, OTF2_CommRef communicator,
uint32_t msgTag, uint64_t msgLength,
uint64_t requestID) {
EventProcessor *reader{static_cast<EventProcessor *>(userData)};
reader->handleMPIISend(attributeList, time, receiver, communicator, msgTag,
msgLength, requestID);
return OTF2_CALLBACK_SUCCESS;
}
static OTF2_CallbackCode
GlobalEvtReaderCallback_MpiIrecv([[maybe_unused]] OTF2_LocationRef locationID,
OTF2_TimeStamp time, void *userData,
OTF2_AttributeList *attributeList,
uint32_t sender, OTF2_CommRef communicator,
uint32_t msgTag, uint64_t msgLength,
uint64_t requestID) {
EventProcessor *reader{static_cast<EventProcessor *>(userData)};
reader->handleMPIIRecv(attributeList, time, sender, communicator, msgTag,
msgLength, requestID);
return OTF2_CALLBACK_SUCCESS;
}
static OTF2_CallbackCode
GlobalEvtReaderCallback_MpiIsendComplete(
[[maybe_unused]] OTF2_LocationRef locationID, OTF2_TimeStamp time,
void *userData, OTF2_AttributeList *attributeList, uint64_t requestID) {
EventProcessor *reader{static_cast<EventProcessor *>(userData)};
reader->handleMPIISendComplete(attributeList, time, requestID);
return OTF2_CALLBACK_SUCCESS;
}
static OTF2_CallbackCode
GlobalEvtReaderCallback_MpiIrecvRequest(
[[maybe_unused]] OTF2_LocationRef locationID, OTF2_TimeStamp time,
void *userData, OTF2_AttributeList *attributeList, uint64_t requestID) {
EventProcessor *reader{static_cast<EventProcessor *>(userData)};
reader->handleMPIIRecvRequest(attributeList, time, requestID);
return OTF2_CALLBACK_SUCCESS;
}
static OTF2_CallbackCode
GlobalEvtReaderCallback_MpiRequestTest(
[[maybe_unused]] OTF2_LocationRef locationID, OTF2_TimeStamp time,
void *userData, OTF2_AttributeList *attributeList, uint64_t requestID) {
EventProcessor *reader{static_cast<EventProcessor *>(userData)};
reader->handleMPIRequestTest(attributeList, time, requestID);
return OTF2_CALLBACK_SUCCESS;
}
static OTF2_CallbackCode
GlobalEvtReaderCallback_MpiRequestCancelled(
[[maybe_unused]] OTF2_LocationRef locationID, OTF2_TimeStamp time,
void *userData, OTF2_AttributeList *attributeList, uint64_t requestID) {
EventProcessor *reader{static_cast<EventProcessor *>(userData)};
reader->handleMPIRequestCancelled(attributeList, time, requestID);
return OTF2_CALLBACK_SUCCESS;
}
static OTF2_CallbackCode
GlobalEvtReaderCallback_MpiCollectiveBegin(
[[maybe_unused]] OTF2_LocationRef locationID, OTF2_TimeStamp time,
void *userData, OTF2_AttributeList *attributeList) {
EventProcessor *reader{static_cast<EventProcessor *>(userData)};
reader->handleMPIBeginProps(attributeList, time);
return OTF2_CALLBACK_SUCCESS;
}
static OTF2_CallbackCode
GlobalEvtReaderCallback_MpiCollectiveEnd(
[[maybe_unused]] OTF2_LocationRef locationID, OTF2_TimeStamp time,
void *userData, OTF2_AttributeList *attributeList,
OTF2_CollectiveOp collectiveOp, OTF2_CommRef communicator, uint32_t root,
uint64_t sizeSent, uint64_t sizeReceived) {
EventProcessor *reader{static_cast<EventProcessor *>(userData)};
reader->handleMPIEndProps(attributeList, time, collectiveOp, communicator,
root, sizeSent, sizeReceived);
return OTF2_CALLBACK_SUCCESS;
}
static OTF2_CallbackCode
GlobalEvtReaderCallback_OmpFork([[maybe_unused]] OTF2_LocationRef locationID,
OTF2_TimeStamp time, void *userData,
OTF2_AttributeList *attributeList,
uint32_t numberOfRequestedThreads) {
EventProcessor *reader{static_cast<EventProcessor *>(userData)};
reader->handleOmpFork(attributeList, time, numberOfRequestedThreads);
return OTF2_CALLBACK_SUCCESS;
}
static OTF2_CallbackCode
GlobalEvtReaderCallback_OmpJoin([[maybe_unused]] OTF2_LocationRef locationID,
OTF2_TimeStamp time, void *userData,
OTF2_AttributeList *attributeList) {
EventProcessor *reader{static_cast<EventProcessor *>(userData)};
reader->handleOmpJoin(attributeList, time);
return OTF2_CALLBACK_SUCCESS;
}
static OTF2_CallbackCode
GlobalEvtReaderCallback_OmpAcquireLock(
[[maybe_unused]] OTF2_LocationRef locationID, OTF2_TimeStamp time,
void *userData, OTF2_AttributeList *attributeList, uint32_t lockID,
uint32_t acquisitionOrder) {
EventProcessor *reader{static_cast<EventProcessor *>(userData)};
reader->handleOmpAcquireLock(attributeList, time, lockID, acquisitionOrder);
return OTF2_CALLBACK_SUCCESS;
}
static OTF2_CallbackCode
GlobalEvtReaderCallback_OmpReleaseLock(
[[maybe_unused]] OTF2_LocationRef locationID, OTF2_TimeStamp time,
void *userData, OTF2_AttributeList *attributeList, uint32_t lockID,
uint32_t acquisitionOrder) {
EventProcessor *reader{static_cast<EventProcessor *>(userData)};
reader->handleOmpReleaseLock(attributeList, time, lockID, acquisitionOrder);
return OTF2_CALLBACK_SUCCESS;
}
static OTF2_CallbackCode
GlobalEvtReaderCallback_OmpTaskCreate(
[[maybe_unused]] OTF2_LocationRef locationID, OTF2_TimeStamp time,
void *userData, OTF2_AttributeList *attributeList, uint64_t taskID) {
EventProcessor *reader{static_cast<EventProcessor *>(userData)};
reader->handleOmpTaskCreate(attributeList, time, taskID);
return OTF2_CALLBACK_SUCCESS;
}
static OTF2_CallbackCode
GlobalEvtReaderCallback_OmpTaskSwitch(
[[maybe_unused]] OTF2_LocationRef locationID, OTF2_TimeStamp time,
void *userData, OTF2_AttributeList *attributeList, uint64_t taskID) {
EventProcessor *reader{static_cast<EventProcessor *>(userData)};
reader->handleOmpTaskSwitch(attributeList, time, taskID);
return OTF2_CALLBACK_SUCCESS;
}
static OTF2_CallbackCode
GlobalEvtReaderCallback_OmpTaskComplete(
[[maybe_unused]] OTF2_LocationRef locationID, OTF2_TimeStamp time,
void *userData, OTF2_AttributeList *attributeList, uint64_t taskID) {
EventProcessor *reader{static_cast<EventProcessor *>(userData)};
reader->handleOmpTaskComplete(attributeList, time, taskID);
return OTF2_CALLBACK_SUCCESS;
}
static OTF2_CallbackCode
GlobalEvtReaderCallback_ThreadFork([[maybe_unused]] OTF2_LocationRef locationID,
OTF2_TimeStamp time, void *userData,
OTF2_AttributeList *attributeList,
OTF2_Paradigm model,
uint32_t numberOfRequestedThreads) {
EventProcessor *reader{static_cast<EventProcessor *>(userData)};
reader->handleThreadFork(attributeList, time, model,
numberOfRequestedThreads);
return OTF2_CALLBACK_SUCCESS;
}
static OTF2_CallbackCode
GlobalEvtReaderCallback_ThreadJoin([[maybe_unused]] OTF2_LocationRef locationID,
OTF2_TimeStamp time, void *userData,
OTF2_AttributeList *attributeList,
OTF2_Paradigm model) {
EventProcessor *reader{static_cast<EventProcessor *>(userData)};
reader->handleThreadJoin(attributeList, time, model);
return OTF2_CALLBACK_SUCCESS;
}
static OTF2_CallbackCode
GlobalEvtReaderCallback_ThreadTeamBegin(
[[maybe_unused]] OTF2_LocationRef locationID, OTF2_TimeStamp time,
void *userData, OTF2_AttributeList *attributeList,
OTF2_CommRef threadTeam) {
EventProcessor *reader{static_cast<EventProcessor *>(userData)};
reader->handleThreadTeamBegin(attributeList, time, threadTeam);
return OTF2_CALLBACK_SUCCESS;
}
static OTF2_CallbackCode
GlobalEvtReaderCallback_ThreadTeamEnd(
[[maybe_unused]] OTF2_LocationRef locationID, OTF2_TimeStamp time,
void *userData, OTF2_AttributeList *attributeList,
OTF2_CommRef threadTeam) {
EventProcessor *reader{static_cast<EventProcessor *>(userData)};
reader->handleThreadTeamEnd(attributeList, time, threadTeam);
return OTF2_CALLBACK_SUCCESS;
}
static OTF2_CallbackCode
GlobalEvtReaderCallback_ThreadAcquireLock(
[[maybe_unused]] OTF2_LocationRef locationID, OTF2_TimeStamp time,
void *userData, OTF2_AttributeList *attributeList, OTF2_Paradigm model,
uint32_t lockID, uint32_t acquisitionOrder) {
EventProcessor *reader{static_cast<EventProcessor *>(userData)};
reader->handleThreadAcquireLock(attributeList, time, model, lockID,
acquisitionOrder);
return OTF2_CALLBACK_SUCCESS;
}
static OTF2_CallbackCode
GlobalEvtReaderCallback_ThreadReleaseLock(
[[maybe_unused]] OTF2_LocationRef locationID, OTF2_TimeStamp time,
void *userData, OTF2_AttributeList *attributeList, OTF2_Paradigm model,
uint32_t lockID, uint32_t acquisitionOrder) {
EventProcessor *reader{static_cast<EventProcessor *>(userData)};
reader->handleThreadReleaseLock(attributeList, time, model, lockID,
acquisitionOrder);
return OTF2_CALLBACK_SUCCESS;
}
static OTF2_CallbackCode
GlobalEvtReaderCallback_ThreadTaskCreate(
[[maybe_unused]] OTF2_LocationRef locationID, OTF2_TimeStamp time,
void *userData, OTF2_AttributeList *attributeList, OTF2_CommRef threadTeam,
uint32_t creatingThread, uint32_t generationNumber) {
EventProcessor *reader{static_cast<EventProcessor *>(userData)};
reader->handleThreadTaskCreate(attributeList, time, threadTeam,
creatingThread, generationNumber);
return OTF2_CALLBACK_SUCCESS;
}
static OTF2_CallbackCode
GlobalEvtReaderCallback_ThreadTaskSwitch(
[[maybe_unused]] OTF2_LocationRef locationID, OTF2_TimeStamp time,
void *userData, OTF2_AttributeList *attributeList, OTF2_CommRef threadTeam,
uint32_t creatingThread, uint32_t generationNumber) {
EventProcessor *reader{static_cast<EventProcessor *>(userData)};
reader->handleThreadTaskCreate(attributeList, time, threadTeam,
creatingThread, generationNumber);
return OTF2_CALLBACK_SUCCESS;
}
static OTF2_CallbackCode
GlobalEvtReaderCallback_ThreadTaskComplete(
[[maybe_unused]] OTF2_LocationRef locationID, OTF2_TimeStamp time,
void *userData, OTF2_AttributeList *attributeList, OTF2_CommRef threadTeam,
uint32_t creatingThread, uint32_t generationNumber) {
EventProcessor *reader{static_cast<EventProcessor *>(userData)};
reader->handleThreadTaskComplete(attributeList, time, threadTeam,
creatingThread, generationNumber);
return OTF2_CALLBACK_SUCCESS;
}
static OTF2_CallbackCode
GlobalEvtReaderCallback_ThreadCreate(
[[maybe_unused]] OTF2_LocationRef locationID, OTF2_TimeStamp time,
void *userData, OTF2_AttributeList *attributeList,
OTF2_CommRef threadContingent, uint64_t sequenceCount) {
EventProcessor *reader{static_cast<EventProcessor *>(userData)};
reader->handleThreadCreate(attributeList, time, threadContingent,
sequenceCount);
return OTF2_CALLBACK_SUCCESS;
}
static OTF2_CallbackCode
GlobalEvtReaderCallback_ThreadBegin(
[[maybe_unused]] OTF2_LocationRef locationID, OTF2_TimeStamp time,
void *userData, OTF2_AttributeList *attributeList,
OTF2_CommRef threadContingent, uint64_t sequenceCount) {
EventProcessor *reader{static_cast<EventProcessor *>(userData)};
reader->handleThreadBegin(attributeList, time, threadContingent,
sequenceCount);
return OTF2_CALLBACK_SUCCESS;
}
static OTF2_CallbackCode
GlobalEvtReaderCallback_ThreadWait([[maybe_unused]] OTF2_LocationRef locationID,
OTF2_TimeStamp time, void *userData,
OTF2_AttributeList *attributeList,
OTF2_CommRef threadContingent,
uint64_t sequenceCount) {
EventProcessor *reader{static_cast<EventProcessor *>(userData)};
reader->handleThreadWait(attributeList, time, threadContingent,
sequenceCount);
return OTF2_CALLBACK_SUCCESS;
}
static OTF2_CallbackCode
GlobalEvtReaderCallback_ThreadEnd([[maybe_unused]] OTF2_LocationRef locationID,
OTF2_TimeStamp time, void *userData,
OTF2_AttributeList *attributeList,
OTF2_CommRef threadContingent,
uint64_t sequenceCount) {
EventProcessor *reader{static_cast<EventProcessor *>(userData)};
reader->handleThreadEnd(attributeList, time, threadContingent, sequenceCount);
return OTF2_CALLBACK_SUCCESS;
}
static OTF2_CallbackCode
GlobalEvtReaderCallback_IoCreateHandle(
[[maybe_unused]] OTF2_LocationRef locationID, OTF2_TimeStamp time,
void *userData, OTF2_AttributeList *attributeList, OTF2_IoHandleRef handle,
OTF2_IoAccessMode mode, OTF2_IoCreationFlag creationFlags,
OTF2_IoStatusFlag statusFlags) {
EventProcessor *reader{static_cast<EventProcessor *>(userData)};
reader->handleIoCreateHandle(attributeList, time, handle, mode, creationFlags,
statusFlags);
return OTF2_CALLBACK_SUCCESS;
}
static OTF2_CallbackCode
GlobalEvtReaderCallback_IoDestroyHandle(
[[maybe_unused]] OTF2_LocationRef locationID, OTF2_TimeStamp time,
void *userData, OTF2_AttributeList *attributeList,
OTF2_IoHandleRef handle) {
EventProcessor *reader{static_cast<EventProcessor *>(userData)};
reader->handleIoDestroyHandle(attributeList, time, handle);
return OTF2_CALLBACK_SUCCESS;
}
static OTF2_CallbackCode
GlobalEvtReaderCallback_IoDuplicateHandle(
[[maybe_unused]] OTF2_LocationRef locationID, OTF2_TimeStamp time,
void *userData, OTF2_AttributeList *attributeList,
OTF2_IoHandleRef oldHandle, OTF2_IoHandleRef newHandle,
OTF2_IoStatusFlag statusFlags) {
EventProcessor *reader{static_cast<EventProcessor *>(userData)};
reader->handleIoHandleDuplicate(attributeList, time, oldHandle, newHandle,
statusFlags);
return OTF2_CALLBACK_SUCCESS;
}
static OTF2_CallbackCode
GlobalEvtReaderCallback_IoSeek([[maybe_unused]] OTF2_LocationRef locationID,
OTF2_TimeStamp time, void *userData,
OTF2_AttributeList *attributeList,
OTF2_IoHandleRef handle, int64_t offsetRequest,
OTF2_IoSeekOption whence,
uint64_t offsetResult) {
EventProcessor *reader{static_cast<EventProcessor *>(userData)};
reader->handleIoSeek(attributeList, time, handle, offsetRequest, whence,
offsetResult);
return OTF2_CALLBACK_SUCCESS;
}
static OTF2_CallbackCode
GlobalEvtReaderCallback_IoChangeStatusFlags(
[[maybe_unused]] OTF2_LocationRef locationID, OTF2_TimeStamp time,
void *userData, OTF2_AttributeList *attributeList, OTF2_IoHandleRef handle,
OTF2_IoStatusFlag statusFlags) {
EventProcessor *reader{static_cast<EventProcessor *>(userData)};
reader->handleIoChangeStatusFlags(attributeList, time, handle, statusFlags);
return OTF2_CALLBACK_SUCCESS;
}
static OTF2_CallbackCode
GlobalEvtReaderCallback_IoDeleteFile(
[[maybe_unused]] OTF2_LocationRef locationID, OTF2_TimeStamp time,
void *userData, OTF2_AttributeList *attributeList,
OTF2_IoParadigmRef ioParadigm, OTF2_IoFileRef file) {
EventProcessor *reader{static_cast<EventProcessor *>(userData)};
reader->handleIoDeleteFile(attributeList, time, ioParadigm, file);
return OTF2_CALLBACK_SUCCESS;
}
static OTF2_CallbackCode
GlobalEvtReaderCallback_IoOperationBegin(
[[maybe_unused]] OTF2_LocationRef locationID, OTF2_TimeStamp time,
void *userData, OTF2_AttributeList *attributeList, OTF2_IoHandleRef handle,
OTF2_IoOperationMode mode, OTF2_IoOperationFlag operationFlags,
uint64_t bytesRequest, uint64_t matchingId) {
EventProcessor *reader{static_cast<EventProcessor *>(userData)};
reader->handleIoOperationBegin(attributeList, time, handle, mode,
operationFlags, bytesRequest, matchingId);
return OTF2_CALLBACK_SUCCESS;
}
static OTF2_CallbackCode
GlobalEvtReaderCallback_IoOperationTest(
[[maybe_unused]] OTF2_LocationRef locationID, OTF2_TimeStamp time,
void *userData, OTF2_AttributeList *attributeList, OTF2_IoHandleRef handle,
uint64_t matchingId) {
EventProcessor *reader{static_cast<EventProcessor *>(userData)};
reader->handleIoOperationTest(attributeList, time, handle, matchingId);
return OTF2_CALLBACK_SUCCESS;
}
static OTF2_CallbackCode
GlobalEvtReaderCallback_IoOperationIssued(
[[maybe_unused]] OTF2_LocationRef locationID, OTF2_TimeStamp time,
void *userData, OTF2_AttributeList *attributeList, OTF2_IoHandleRef handle,
uint64_t matchingId) {
EventProcessor *reader{static_cast<EventProcessor *>(userData)};
reader->handleIoOperationIssued(attributeList, time, handle, matchingId);
return OTF2_CALLBACK_SUCCESS;
}
static OTF2_CallbackCode
GlobalEvtReaderCallback_IoOperationComplete(
[[maybe_unused]] OTF2_LocationRef locationID, OTF2_TimeStamp time,
void *userData, OTF2_AttributeList *attributeList, OTF2_IoHandleRef handle,
uint64_t bytesResult, uint64_t matchingId) {
EventProcessor *reader{static_cast<EventProcessor *>(userData)};
reader->handleIoOperationComplete(attributeList, time, handle, bytesResult,
matchingId);
return OTF2_CALLBACK_SUCCESS;
}
static OTF2_CallbackCode
GlobalEvtReaderCallback_IoOperationCancelled(
[[maybe_unused]] OTF2_LocationRef locationID, OTF2_TimeStamp time,
void *userData, OTF2_AttributeList *attributeList, OTF2_IoHandleRef handle,
uint64_t matchingId) {
EventProcessor *reader{static_cast<EventProcessor *>(userData)};
reader->handleIoOperationCancelled(attributeList, time, handle, matchingId);
return OTF2_CALLBACK_SUCCESS;
}
static OTF2_CallbackCode
GlobalEvtReaderCallback_IoAcquireLock(
[[maybe_unused]] OTF2_LocationRef locationID, OTF2_TimeStamp time,
void *userData, OTF2_AttributeList *attributeList, OTF2_IoHandleRef handle,
OTF2_LockType lockType) {
EventProcessor *reader{static_cast<EventProcessor *>(userData)};
reader->handleIoAcquireLock(attributeList, time, handle, lockType);
return OTF2_CALLBACK_SUCCESS;
}
static OTF2_CallbackCode
GlobalEvtReaderCallback_IoReleaseLock(
[[maybe_unused]] OTF2_LocationRef locationID, OTF2_TimeStamp time,
void *userData, OTF2_AttributeList *attributeList, OTF2_IoHandleRef handle,
OTF2_LockType lockType) {
EventProcessor *reader{static_cast<EventProcessor *>(userData)};
reader->handleIoReleaseLock(attributeList, time, handle, lockType);
return OTF2_CALLBACK_SUCCESS;
}
static OTF2_CallbackCode
GlobalEvtReaderCallback_IoTryLock([[maybe_unused]] OTF2_LocationRef locationID,
OTF2_TimeStamp time, void *userData,
OTF2_AttributeList *attributeList,
OTF2_IoHandleRef handle,
OTF2_LockType lockType) {
EventProcessor *reader{static_cast<EventProcessor *>(userData)};
reader->handleIoTryLock(attributeList, time, handle, lockType);
return OTF2_CALLBACK_SUCCESS;
}
}
EventProcessor::EventProcessor(Maps &maps, OTF2_Reader *reader,
OTF2_Archive *archive, const string &traceName)
: m_maps{maps}, m_otf2Reader{reader}, m_archive{archive}, m_traceName{
traceName} {
m_otf2Reader = OTF2_Reader_Open(m_traceName.c_str());
m_evtWriter = NULL;
OTF2_Reader_SetSerialCollectiveCallbacks(m_otf2Reader);
m_maps.ComputeRelativeClockFactor();
}
void EventProcessor::readLocationWise() {
auto location_tuple = m_maps.getLocationRange();
auto start_itr = std::get<0>(location_tuple);
auto end_itr = std::get<1>(location_tuple);
OTF2_GlobalEvtReaderCallbacks *global_evt_callbacks =
OTF2_GlobalEvtReaderCallbacks_New();
OTF2_GlobalEvtReaderCallbacks_SetEnterCallback(
global_evt_callbacks, &GlobalEvtReaderCallback_Enter);
OTF2_GlobalEvtReaderCallbacks_SetLeaveCallback(
global_evt_callbacks, &GlobalEvtReaderCallback_Leave);
OTF2_GlobalEvtReaderCallbacks_SetMpiSendCallback(
global_evt_callbacks, &GlobalEvtReaderCallback_MpiSend);
OTF2_GlobalEvtReaderCallbacks_SetMpiRecvCallback(
global_evt_callbacks, &GlobalEvtReaderCallback_MpiRecv);
OTF2_GlobalEvtReaderCallbacks_SetMpiIsendCallback(
global_evt_callbacks, &GlobalEvtReaderCallback_MpiIsend);
OTF2_GlobalEvtReaderCallbacks_SetMpiIrecvCallback(
global_evt_callbacks, &GlobalEvtReaderCallback_MpiIrecv);
OTF2_GlobalEvtReaderCallbacks_SetMpiIsendCompleteCallback(
global_evt_callbacks, &GlobalEvtReaderCallback_MpiIsendComplete);
OTF2_GlobalEvtReaderCallbacks_SetMpiIrecvRequestCallback(
global_evt_callbacks, &GlobalEvtReaderCallback_MpiIrecvRequest);
OTF2_GlobalEvtReaderCallbacks_SetMpiRequestTestCallback(
global_evt_callbacks, &GlobalEvtReaderCallback_MpiRequestTest);
OTF2_GlobalEvtReaderCallbacks_SetMpiRequestCancelledCallback(
global_evt_callbacks, &GlobalEvtReaderCallback_MpiRequestCancelled);
OTF2_GlobalEvtReaderCallbacks_SetMpiCollectiveBeginCallback(
global_evt_callbacks, &GlobalEvtReaderCallback_MpiCollectiveBegin);
OTF2_GlobalEvtReaderCallbacks_SetMpiCollectiveEndCallback(
global_evt_callbacks, &GlobalEvtReaderCallback_MpiCollectiveEnd);
OTF2_GlobalEvtReaderCallbacks_SetOmpForkCallback(
global_evt_callbacks, &GlobalEvtReaderCallback_OmpFork);
OTF2_GlobalEvtReaderCallbacks_SetOmpJoinCallback(
global_evt_callbacks, &GlobalEvtReaderCallback_OmpJoin);
OTF2_GlobalEvtReaderCallbacks_SetOmpAcquireLockCallback(
global_evt_callbacks, &GlobalEvtReaderCallback_OmpAcquireLock);
OTF2_GlobalEvtReaderCallbacks_SetOmpReleaseLockCallback(
global_evt_callbacks, &GlobalEvtReaderCallback_OmpReleaseLock);
OTF2_GlobalEvtReaderCallbacks_SetOmpTaskCreateCallback(
global_evt_callbacks, &GlobalEvtReaderCallback_OmpTaskCreate);
OTF2_GlobalEvtReaderCallbacks_SetOmpTaskSwitchCallback(
global_evt_callbacks, &GlobalEvtReaderCallback_OmpTaskSwitch);
OTF2_GlobalEvtReaderCallbacks_SetOmpTaskCompleteCallback(
global_evt_callbacks, &GlobalEvtReaderCallback_OmpTaskComplete);
OTF2_GlobalEvtReaderCallbacks_SetThreadForkCallback(
global_evt_callbacks, &GlobalEvtReaderCallback_ThreadFork);
OTF2_GlobalEvtReaderCallbacks_SetThreadJoinCallback(
global_evt_callbacks, &GlobalEvtReaderCallback_ThreadJoin);
OTF2_GlobalEvtReaderCallbacks_SetThreadTeamBeginCallback(
global_evt_callbacks, &GlobalEvtReaderCallback_ThreadTeamBegin);
OTF2_GlobalEvtReaderCallbacks_SetThreadTeamEndCallback(
global_evt_callbacks, &GlobalEvtReaderCallback_ThreadTeamEnd);
OTF2_GlobalEvtReaderCallbacks_SetThreadAcquireLockCallback(
global_evt_callbacks, &GlobalEvtReaderCallback_ThreadAcquireLock);
OTF2_GlobalEvtReaderCallbacks_SetThreadReleaseLockCallback(
global_evt_callbacks, &GlobalEvtReaderCallback_ThreadReleaseLock);
OTF2_GlobalEvtReaderCallbacks_SetThreadTaskCreateCallback(
global_evt_callbacks, &GlobalEvtReaderCallback_ThreadTaskCreate);
OTF2_GlobalEvtReaderCallbacks_SetThreadTaskSwitchCallback(
global_evt_callbacks, &GlobalEvtReaderCallback_ThreadTaskSwitch);
OTF2_GlobalEvtReaderCallbacks_SetThreadTaskCompleteCallback(
global_evt_callbacks, &GlobalEvtReaderCallback_ThreadTaskComplete);
OTF2_GlobalEvtReaderCallbacks_SetThreadCreateCallback(
global_evt_callbacks, &GlobalEvtReaderCallback_ThreadCreate);
OTF2_GlobalEvtReaderCallbacks_SetThreadBeginCallback(
global_evt_callbacks, &GlobalEvtReaderCallback_ThreadBegin);
OTF2_GlobalEvtReaderCallbacks_SetThreadWaitCallback(
global_evt_callbacks, &GlobalEvtReaderCallback_ThreadWait);
OTF2_GlobalEvtReaderCallbacks_SetThreadEndCallback(
global_evt_callbacks, &GlobalEvtReaderCallback_ThreadEnd);
OTF2_GlobalEvtReaderCallbacks_SetIoCreateHandleCallback(
global_evt_callbacks, &GlobalEvtReaderCallback_IoCreateHandle);
OTF2_GlobalEvtReaderCallbacks_SetIoDestroyHandleCallback(
global_evt_callbacks, &GlobalEvtReaderCallback_IoDestroyHandle);
OTF2_GlobalEvtReaderCallbacks_SetIoDuplicateHandleCallback(
global_evt_callbacks, &GlobalEvtReaderCallback_IoDuplicateHandle);
OTF2_GlobalEvtReaderCallbacks_SetIoSeekCallback(
global_evt_callbacks, &GlobalEvtReaderCallback_IoSeek);
OTF2_GlobalEvtReaderCallbacks_SetIoChangeStatusFlagsCallback(
global_evt_callbacks, &GlobalEvtReaderCallback_IoChangeStatusFlags);
OTF2_GlobalEvtReaderCallbacks_SetIoDeleteFileCallback(
global_evt_callbacks, &GlobalEvtReaderCallback_IoDeleteFile);
OTF2_GlobalEvtReaderCallbacks_SetIoOperationBeginCallback(
global_evt_callbacks, &GlobalEvtReaderCallback_IoOperationBegin);
OTF2_GlobalEvtReaderCallbacks_SetIoOperationTestCallback(
global_evt_callbacks, &GlobalEvtReaderCallback_IoOperationTest);
OTF2_GlobalEvtReaderCallbacks_SetIoOperationIssuedCallback(
global_evt_callbacks, &GlobalEvtReaderCallback_IoOperationIssued);
OTF2_GlobalEvtReaderCallbacks_SetIoOperationCompleteCallback(
global_evt_callbacks, &GlobalEvtReaderCallback_IoOperationComplete);
OTF2_GlobalEvtReaderCallbacks_SetIoOperationCancelledCallback(
global_evt_callbacks, &GlobalEvtReaderCallback_IoOperationCancelled);
OTF2_GlobalEvtReaderCallbacks_SetIoAcquireLockCallback(
global_evt_callbacks, &GlobalEvtReaderCallback_IoAcquireLock);
OTF2_GlobalEvtReaderCallbacks_SetIoReleaseLockCallback(
global_evt_callbacks, &GlobalEvtReaderCallback_IoReleaseLock);
OTF2_GlobalEvtReaderCallbacks_SetIoTryLockCallback(
global_evt_callbacks, &GlobalEvtReaderCallback_IoTryLock);
for (auto location_itr = start_itr; location_itr != end_itr; location_itr++) {
auto reading_location = location_itr->first;
auto writing_location = location_itr->second;
OTF2_Reader_SelectLocation(m_otf2Reader, reading_location);
bool successful_open_def_files =
OTF2_Reader_OpenDefFiles(m_otf2Reader) == OTF2_SUCCESS;
OTF2_Reader_OpenEvtFiles(m_otf2Reader);
if (successful_open_def_files) {
OTF2_DefReader *def_reader =
OTF2_Reader_GetDefReader(m_otf2Reader, reading_location);
if (def_reader) {
uint64_t def_reads = 0;
OTF2_Reader_ReadAllLocalDefinitions(m_otf2Reader, def_reader,
&def_reads);
OTF2_Reader_CloseDefReader(m_otf2Reader, def_reader);
}
}
[[maybe_unused]] OTF2_EvtReader *evt_reader =
OTF2_Reader_GetEvtReader(m_otf2Reader, reading_location);
if (successful_open_def_files) {
OTF2_Reader_CloseDefFiles(m_otf2Reader);
}
OTF2_GlobalEvtReader *global_evt_reader =
OTF2_Reader_GetGlobalEvtReader(m_otf2Reader);
OTF2_Reader_RegisterGlobalEvtCallbacks(m_otf2Reader, global_evt_reader,
global_evt_callbacks, this);
OTF2_Archive_OpenEvtFiles(m_archive);
m_evtWriter = OTF2_Archive_GetEvtWriter(m_archive, writing_location);
uint64_t events_read{};
OTF2_Reader_ReadAllGlobalEvents(m_otf2Reader, global_evt_reader,
&events_read);
OTF2_Reader_CloseGlobalEvtReader(m_otf2Reader, global_evt_reader);
}
OTF2_GlobalEvtReaderCallbacks_Delete(global_evt_callbacks);
}
void EventProcessor::handleEvtEnter(
OTF2_TimeStamp time, [[maybe_unused]] OTF2_AttributeList *attributeList,
OTF2_RegionRef region) {
time = m_maps.getNewTimestamp(time);
region = m_maps.getRegionID(region);
OTF2_EvtWriter_Enter(m_evtWriter, NULL, time, region);
}
void EventProcessor::handleEvtLeave(
OTF2_TimeStamp time, [[maybe_unused]] OTF2_AttributeList *attributeList,
OTF2_RegionRef region) {
time = m_maps.getNewTimestamp(time);
region = m_maps.getRegionID(region);
OTF2_EvtWriter_Leave(m_evtWriter, NULL, time, region);
}
void EventProcessor::handleMPISend(OTF2_AttributeList *attributeList,
OTF2_TimeStamp time, uint32_t receiver,
OTF2_CommRef communicator, uint32_t msgTag,
uint64_t msgLength) {
time = m_maps.getNewTimestamp(time);
communicator = m_maps.getCommID(communicator);
OTF2_EvtWriter_MpiSend(m_evtWriter, attributeList, time, receiver,
communicator, msgTag, msgLength);
}
void EventProcessor::handleMPIRecv(OTF2_AttributeList *attributeList,
OTF2_TimeStamp time, uint32_t sender,
OTF2_CommRef communicator, uint32_t msgTag,
uint64_t msgLength) {
time = m_maps.getNewTimestamp(time);
communicator = m_maps.getCommID(communicator);
OTF2_EvtWriter_MpiRecv(m_evtWriter, attributeList, time, sender, communicator,
msgTag, msgLength);
}
void EventProcessor::handleMPIISend(OTF2_AttributeList *attributeList,
OTF2_TimeStamp time, uint32_t receiver,
OTF2_CommRef communicator, uint32_t msgTag,
uint64_t msgLength, uint64_t requestID) {
time = m_maps.getNewTimestamp(time);
communicator = m_maps.getCommID(communicator);
OTF2_EvtWriter_MpiIsend(m_evtWriter, attributeList, time, receiver,
communicator, msgTag, msgLength, requestID);
}
void EventProcessor::handleMPIIRecv(OTF2_AttributeList *attributeList,
OTF2_TimeStamp time, uint32_t sender,
OTF2_CommRef communicator, uint32_t msgTag,
uint64_t msgLength, uint64_t requestID) {
time = m_maps.getNewTimestamp(time);
communicator = m_maps.getCommID(communicator);
OTF2_EvtWriter_MpiIrecv(m_evtWriter, attributeList, time, sender,
communicator, msgTag, msgLength, requestID);
}
void EventProcessor::handleMPIISendComplete(OTF2_AttributeList *attributeList,
OTF2_TimeStamp time,
uint64_t requestID) {
time = m_maps.getNewTimestamp(time);
OTF2_EvtWriter_MpiIsendComplete(m_evtWriter, attributeList, time, requestID);
}
void EventProcessor::handleMPIIRecvRequest(OTF2_AttributeList *attributeList,
OTF2_TimeStamp time,
uint64_t requestID) {
time = m_maps.getNewTimestamp(time);
OTF2_EvtWriter_MpiIrecvRequest(m_evtWriter, attributeList, time, requestID);
}
void EventProcessor::handleMPIRequestTest(OTF2_AttributeList *attributeList,
OTF2_TimeStamp time,
uint64_t requestID) {
time = m_maps.getNewTimestamp(time);
OTF2_EvtWriter_MpiRequestTest(m_evtWriter, attributeList, time, requestID);
}
void EventProcessor::handleMPIRequestCancelled(
OTF2_AttributeList *attributeList, OTF2_TimeStamp time,
uint64_t requestID) {
time = m_maps.getNewTimestamp(time);
OTF2_EvtWriter_MpiRequestCancelled(m_evtWriter, attributeList, time,
requestID);
}
void EventProcessor::handleMPIBeginProps(OTF2_AttributeList *attributeList,
OTF2_TimeStamp time) {
time = m_maps.getNewTimestamp(time);
OTF2_EvtWriter_MpiCollectiveBegin(m_evtWriter, attributeList, time);
}
void EventProcessor::handleMPIEndProps(OTF2_AttributeList *attributeList,
OTF2_TimeStamp time,
OTF2_CollectiveOp collectiveOp,
OTF2_CommRef communicator, uint32_t root,
uint64_t sizeSent,
uint64_t sizeReceived) {
time = m_maps.getNewTimestamp(time);
communicator = m_maps.getCommID(communicator);
OTF2_EvtWriter_MpiCollectiveEnd(m_evtWriter, attributeList, time,
collectiveOp, communicator, root, sizeSent,
sizeReceived);
}