58 #include <common/alignment.h> 60 #include <spi/bgp_SPI.h> 65 #define MAX_COUNTERS 256 66 #define NUMBER_COUNTERS_PER_ROW 8 89 void DumpInHex(
const char* pBuffer,
int pSize);
105 int main(
int argc,
char * argv[]) {
106 _BGP_Personality_t personality;
107 int pRank=0, pMode=-2, pCore=0, pEdge=1, xActiveCore=0, xActiveRank=0, xRC;
114 sscanf(argv[1],
"%d", &pRank);
116 sscanf(argv[2],
"%d", &pMode);
118 sscanf(argv[3],
"%d", &pCore);
120 sscanf(argv[4],
"%d", &pEdge);
125 if ( pRank < 0 || pRank > 31 ) {
126 printf(
"Invalid rank (%d) specified\n", pRank);
135 if ( pMode < -2 || pMode > 3 ) {
136 printf(
"Invalid mode (%d) specified\n", pMode);
142 if ( pCore < 0 || pCore > 3 ) {
143 printf(
"Invalid core (%d) specified\n", pCore);
154 if ( pEdge != 0 && pEdge != 1 && pEdge != 4 && pEdge != 8 && pEdge != 12 ) {
155 printf(
"Invalid edge (%d) specified\n", pEdge);
165 if (xRC != 50921472) {
166 printf(
"PAPI_library_init failed: xRC=%d, ending...\n", xRC);
174 xRC = Kernel_GetPersonality(&personality,
sizeof(_BGP_Personality_t));
176 printf(
" Kernel_GetPersonality returned %d\n",xRC) ;
179 xActiveRank = personality.Network_Config.Rank;
180 xActiveCore = Kernel_PhysicalProcessorID();
182 printf(
"Rank %d, core %d reporting...\n", xActiveRank, xActiveCore);
184 if (xActiveRank != pRank) {
185 printf(
"Rank %d is not to run... Exiting...\n", xActiveRank);
189 if ( xActiveCore == pCore ) {
190 printf(
"Program is to run on rank %d core %d, using mode= %d, edge= %d\n", pRank, xActiveCore, pMode, pEdge);
193 printf(
"Program is NOT to run on rank %d core %d... Exiting...\n", pRank, xActiveCore);
200 printf(
"************************************************************\n");
201 printf(
"* Configuration parameters used: *\n");
202 printf(
"* Rank = %d *\n", pRank);
203 printf(
"* Mode = %d *\n", pMode);
204 printf(
"* Core = %d *\n", pCore);
205 printf(
"* Edge = %d *\n", pEdge);
206 printf(
"************************************************************\n\n");
208 printf(
"Print config after PAPI_library_init...\n");
209 BGP_UPC_Print_Config();
216 BGP_UPC_Initialize_Counter_Config(pMode, pEdge);
217 printf(
"UPC unit(s) initialized with mode=%d, edge=%d...\n", pMode, pEdge);
220 printf(
"Before running the main test procedure...\n");
221 BGP_UPC_Print_Config();
222 BGP_UPC_Print_Counter_Values(BGP_UPC_READ_EXCLUSIVE);
232 printf(
"After running the main test procedure...\n");
233 BGP_UPC_Print_Config();
234 BGP_UPC_Print_Counter_Values(BGP_UPC_READ_EXCLUSIVE);
245 printf(
"==> Do_Tests(): Beginning of the main body...\n");
255 printf(
"==> Do_Tests(): End of the main body...\n");
266 int xRC, xEventSet, xEventCode, xState;
270 printf(
"==> Do_Low_Level_Tests(): Beginning of the main body...\n");
278 printf(
"SUCCESS: PAPI has been low-level initialized by main()...\n");
280 printf(
"FAILURE: PAPI has not been properly initialized by main(), xRC=%d, ending...\n", xRC);
293 BGP_UPC_Read_Counters_Struct_t* xTemp;
294 xTemp = (BGP_UPC_Read_Counters_Struct_t*)(
void*)
Native_Buffer;
302 printf(
"PAPI_get_real_cyc: xLLValue=%lld...\n", xLLValue);
306 printf(
"PAPI_get_virt_cyc: xLLValue=%lld...\n", xLLValue);
310 printf(
"PAPI_get_real_usec: xLLValue=%lld...\n", xLLValue);
314 printf(
"PAPI_get_virt_usec: xLLValue=%lld...\n", xLLValue);
318 printf(
"SUCCESS: PAPI_num_hwctrs returned 256 hardware counters...\n");
320 printf(
"FAILURE: PAPI_num_hwctrs failed, returned xRC=%d...\n", xRC);
323 char* xEventName_1 =
"PAPI_L3_LDM";
326 xRC = strcmp(xName,xEventName_1);
328 printf(
"SUCCESS: PAPI_event_code_to_name for PAPI_L3_LDM...\n");
330 printf(
"FAILURE: PAPI_event_code_to_name returned incorrect name, xName=%s\n", xName);
333 printf(
"FAILURE: PAPI_event_code_to_name failed, xRC=%d...\n", xRC);
336 char* xEventName_2 =
"PNE_BGP_PU1_IPIPE_INSTRUCTIONS";
339 xRC = strcmp(xName,xEventName_2);
341 printf(
"SUCCESS: PAPI_event_code_to_name for PNE_BGP_PU1_IPIPE_INSTRUCTIONS...\n");
343 printf(
"FAILURE: PAPI_event_code_to_name returned incorrect name, xName=%s\n", xName);
346 printf(
"FAILURE: PAPI_event_code_to_name failed, xRC=%d...\n", xRC);
348 strcpy(xName,
"PAPI_L3_LDM");
351 if (xEventCode == 0x8000000E)
352 printf(
"SUCCESS: PAPI_event_name_to_code for PAPI_L3_LDM...\n");
354 printf(
"FAILURE: PAPI_event_name_to_code returned incorrect code, xEventCode=%d\n", xEventCode);
356 printf(
"FAILURE: PAPI_event_name_to_code failed, xRC=%d...\n", xRC);
358 strcpy(xName,
"PNE_BGP_PU1_IPIPE_INSTRUCTIONS");
361 if (xEventCode == 0x40000027)
362 printf(
"SUCCESS: PAPI_event_name_to_code for PNE_BGP_PU1_IPIPE_INSTRUCTIONS...\n");
364 printf(
"FAILURE: PAPI_event_name_to_code returned incorrect code, xEventCode=%8.8x\n", xEventCode);
366 printf(
"FAILURE: PAPI_event_name_to_code failed, xRC=%d...\n", xRC);
368 xEventCode = 0x80000000;
371 if (xEventCode == 0x80000001)
372 printf(
"SUCCESS: PAPI_enum_event for 0x80000000 PAPI_PRESET_ENUM_ALL, returned 0x80000001...\n");
374 printf(
"FAILURE: PAPI_enum_event for 0x80000000 PAPI_PRESET_ENUM_ALL returned incorrect code, xEventCode=%8.8x\n", xEventCode);
376 printf(
"FAILURE: PAPI_enum_event for 0x80000000 PAPI_PRESET_ENUM_ALL failed, xRC=%d...\n", xRC);
378 xEventCode = 0x80000002;
381 if (xEventCode == 0x80000003)
382 printf(
"SUCCESS: PAPI_enum_event for 0x80000002 PAPI_PRESET_ENUM_ALL, returned 0x80000003...\n");
384 printf(
"FAILURE: PAPI_enum_event for 0x80000002 PAPI_PRESET_ENUM_ALL returned incorrect code, xEventCode=%8.8x\n", xEventCode);
386 printf(
"FAILURE: PAPI_enum_event for 0x80000002 PAPI_PRESET_ENUM_ALL failed, xRC=%d...\n", xRC);
388 xEventCode = 0x80000067;
391 if (xEventCode == 0x80000068)
392 printf(
"SUCCESS: PAPI_enum_event for 0x80000067 PAPI_PRESET_ENUM_ALL, returned 0x80000068...\n");
394 printf(
"FAILURE: PAPI_enum_event for 0x80000067 PAPI_PRESET_ENUM_ALL returned incorrect code, xEventCode=%8.8x\n", xEventCode);
396 printf(
"FAILURE: PAPI_enum_event for 0x80000067 PAPI_PRESET_ENUM_ALL failed, xRC=%d...\n", xRC);
398 xEventCode = 0x80000068;
401 printf(
"SUCCESS: PAPI_enum_event for 0x80000068 PAPI_PRESET_ENUM_ALL, no next event...\n");
403 printf(
"FAILURE: PAPI_enum_event for 0x80000068 PAPI_PRESET_ENUM_ALL failed, xRC=%d...\n", xRC);
405 xEventCode = 0x40000000;
408 if (xEventCode == 0x40000001)
409 printf(
"SUCCESS: PAPI_enum_event for 0x40000000 PAPI_PRESET_ENUM_ALL, returned 0x40000001...\n");
411 printf(
"FAILURE: PAPI_enum_event for 0x40000000 PAPI_PRESET_ENUM_ALL returned incorrect code, xEventCode=%8.8x\n", xEventCode);
413 printf(
"FAILURE: PAPI_enum_event for 0x40000000 PAPI_PRESET_ENUM_ALL failed, xRC=%d...\n", xRC);
415 xEventCode = 0x40000001;
418 if (xEventCode == 0x40000002)
419 printf(
"SUCCESS: PAPI_enum_event for 0x40000001 PAPI_PRESET_ENUM_ALL, returned 0x40000002...\n");
421 printf(
"FAILURE: PAPI_enum_event for 0x40000001 PAPI_PRESET_ENUM_ALL returned incorrect code, xEventCode=%8.8x\n", xEventCode);
423 printf(
"FAILURE: PAPI_enum_event for 0x40000001 PAPI_PRESET_ENUM_ALL failed, xRC=%d...\n", xRC);
425 xEventCode = 0x400000FC;
428 if (xEventCode == 0x400000FF)
429 printf(
"SUCCESS: PAPI_enum_event for 0x400000FC PAPI_PRESET_ENUM_ALL, returned 0x400000FF...\n");
431 printf(
"FAILURE: PAPI_enum_event for 0x400000FC PAPI_PRESET_ENUM_ALL returned incorrect code, xEventCode=%8.8x\n", xEventCode);
433 printf(
"FAILURE: PAPI_enum_event for 0x400000FC PAPI_PRESET_ENUM_ALL failed, xRC=%d...\n", xRC);
435 xEventCode = 0x400001FD;
438 if (xEventCode == 0x400001FF)
439 printf(
"SUCCESS: PAPI_enum_event for 0x400001FD PAPI_ENUM_ALL, returned 0x400001FF...\n");
441 printf(
"FAILURE: PAPI_enum_event for 0x400001FD PAPI_ENUM_ALL returned incorrect code, xEventCode=%8.8x\n", xEventCode);
443 printf(
"FAILURE: PAPI_enum_event for 0x400001FD PAPI_ENUM_ALL failed, xRC=%d...\n", xRC);
445 xEventCode = 0x400001FF;
448 printf(
"SUCCESS: PAPI_enum_event for 0x400001FF PAPI_PRESET_ENUM_ALL, no next event...\n");
450 printf(
"FAILURE: PAPI_enum_event for 0x400001FF PAPI_PRESET_ENUM_ALL failed, xRC=%d...\n", xRC);
452 xEventCode = 0x80000000;
455 if (xEventCode == 0x80000001)
456 printf(
"SUCCESS: PAPI_enum_event for 0x80000000 PAPI_PRESET_ENUM_AVAIL, returned 0x80000001...\n");
458 printf(
"FAILURE: PAPI_enum_event for 0x80000000PAPI_PRESET_ENUM_AVAIL returned incorrect code, xEventCode=%8.8x\n", xEventCode);
460 printf(
"FAILURE: PAPI_enum_event for 0x80000000PAPI_PRESET_ENUM_AVAIL failed, xRC=%d...\n", xRC);
462 xEventCode = 0x80000002;
465 if (xEventCode == 0x80000006)
466 printf(
"SUCCESS: PAPI_enum_event for 0x80000002 PAPI_PRESET_ENUM_AVAIL, returned 0x80000006...\n");
468 printf(
"FAILURE: PAPI_enum_event for 0x80000002 PAPI_PRESET_ENUM_AVAIL returned incorrect code, xEventCode=%8.8x\n", xEventCode);
470 printf(
"FAILURE: PAPI_enum_event for 0x80000002 PAPI_PRESET_ENUM_AVAIL failed, xRC=%d...\n", xRC);
472 xEventCode = 0x80000067;
475 if (xEventCode == 0x80000068)
476 printf(
"SUCCESS: PAPI_enum_event for 0x80000067 PAPI_PRESET_ENUM_AVAIL, returned 0x80000068...\n");
478 printf(
"FAILURE: PAPI_enum_event for 0x80000067 PAPI_PRESET_ENUM_AVAIL returned incorrect code, xEventCode=%8.8x\n", xEventCode);
480 printf(
"FAILURE: PAPI_enum_event for 0x80000067 PAPI_PRESET_ENUM_AVAIL failed, xRC=%d...\n", xRC);
482 xEventCode = 0x80000068;
485 printf(
"SUCCESS: PAPI_enum_event for 0x80000068 PAPI_PRESET_ENUM_AVAIL, no next event...\n");
487 printf(
"FAILURE: PAPI_enum_event for 0x80000068 PAPI_PRESET_ENUM_AVAIL failed, xRC=%d...\n", xRC);
489 xEventCode = 0x40000000;
492 if (xEventCode == 0x40000001)
493 printf(
"SUCCESS: PAPI_enum_event for 0x40000000 PAPI_PRESET_ENUM_AVAIL, returned 0x40000001...\n");
495 printf(
"FAILURE: PAPI_enum_event for 0x40000000 PAPI_PRESET_ENUM_AVAIL returned incorrect code, xEventCode=%8.8x\n", xEventCode);
497 printf(
"FAILURE: PAPI_enum_event for 0x40000000 PAPI_PRESET_ENUM_AVAIL failed, xRC=%d...\n", xRC);
499 xEventCode = 0x40000001;
502 if (xEventCode == 0x40000002)
503 printf(
"SUCCESS: PAPI_enum_event for 0x40000001 PAPI_PRESET_ENUM_AVAIL, returned 0x40000002...\n");
505 printf(
"FAILURE: PAPI_enum_event for 0x40000001 PAPI_PRESET_ENUM_AVAIL returned incorrect code, xEventCode=%8.8x\n", xEventCode);
507 printf(
"FAILURE: PAPI_enum_event for 0x40000001 PAPI_PRESET_ENUM_AVAIL failed, xRC=%d...\n", xRC);
509 printf(
"NOTE: Might get two messages indicating invalid event id specified for 253 and 254. These are OK...\n");
510 xEventCode = 0x400000FC;
513 if (xEventCode == 0x400000FF)
514 printf(
"SUCCESS: PAPI_enum_event for 0x400000FC PAPI_PRESET_ENUM_AVAIL, returned 0x400000FF...\n");
516 printf(
"FAILURE: PAPI_enum_event for 0x400000FC PAPI_PRESET_ENUM_AVAIL returned incorrect code, xEventCode=%8.8x\n", xEventCode);
518 printf(
"FAILURE: PAPI_enum_event for 0x400000FC PAPI_PRESET_ENUM_AVAIL failed, xRC=%d...\n", xRC);
520 printf(
"NOTE: Might get one message indicating invalid event id specified for 510. This is OK...\n");
521 xEventCode = 0x400001FD;
524 if (xEventCode == 0x400001FF)
525 printf(
"SUCCESS: PAPI_enum_event for 0x400001FD PAPI_PRESET_ENUM_AVAIL, returned 0x400001FF...\n");
527 printf(
"FAILURE: PAPI_enum_event for 0x400001FD PAPI_PRESET_ENUM_AVAIL returned incorrect code, xEventCode=%8.8x\n", xEventCode);
529 printf(
"FAILURE: PAPI_enum_event for 0x400001FD PAPI_PRESET_ENUM_AVAIL failed, xRC=%d...\n", xRC);
531 xEventCode = 0x400001FF;
534 printf(
"SUCCESS: PAPI_enum_event for 0x400001FF PAPI_PRESET_ENUM_AVAIL, no next event...\n");
536 printf(
"FAILURE: PAPI_enum_event for 0x400001FF PAPI_PRESET_ENUM_AVAIL failed, xRC=%d...\n", xRC);
542 printf(
"SUCCESS: PAPI_get_dmem_info...\n");
545 printf(
"FAILURE: PAPI_get_dmem_info failed, xRC=%d...\n", xRC);
551 printf(
"SUCCESS: PAPI_get_event_info for PAPI_L3_LDM...\n");
554 printf(
"FAILURE: PAPI_get_event_info failed for PAPI_L3_LDM, xRC=%d...\n", xRC);
559 printf(
"SUCCESS: PAPI_get_executable_info...\n");
562 printf(
"FAILURE: PAPI_get_executable_info failed, returned null pointer...\n");
567 printf(
"SUCCESS: PAPI_get_hardware_info...\n");
570 printf(
"FAILURE: PAPI_get_hardware_info failed, returned null pointer...\n");
575 printf(
"SUCCESS: PAPI_get_shared_lib_info...\n");
578 printf(
"FAILURE: PAPI_get_shared_lib_info failed, returned null pointer...\n");
583 printf(
"SUCCESS: PAPI_create_eventset created...\n");
585 printf(
"FAILURE: PAPI_create_eventset failed, xRC=%d...\n", xRC);
589 printf(
"==> No events should be in the event set...\n");
594 printf(
"SUCCESS: PAPI_num_events returned 0...\n");
596 printf(
"FAILURE: PAPI_num_events failed, returned xRC=%d...\n", xRC);
600 printf(
"SUCCESS: PAPI_add_event PAPI_L1_DCM...\n");
602 printf(
"FAILURE: PAPI_add_event PAPI_L1_DCM failed, xRC=%d...\n", xRC);
606 printf(
"SUCCESS: PAPI_num_events returned 1...\n");
608 printf(
"FAILURE: PAPI_num_events failed, returned xRC=%d...\n", xRC);
612 printf(
"SUCCESS: PAPI_add_event PNE_BGP_PU3_L2_MEMORY_WRITES...\n");
614 printf(
"FAILURE: PAPI_add_event PNE_BGP_PU3_L2_MEMORY_WRITES failed, xRC=%d...\n", xRC);
618 printf(
"SUCCESS: PAPI_num_events returned 2...\n");
620 printf(
"FAILURE: PAPI_num_events failed, returned xRC=%d...\n", xRC);
624 printf(
"SUCCESS: PAPI_add_event BGP_PU3_L2_MEMORY_WRITES not allowed...\n");
626 printf(
"FAILURE: PAPI_add_event BGP_PU3_L2_MEMORY_WRITES allowed, or failed incorrectly..., xRC=%d...\n", xRC);
630 printf(
"SUCCESS: PAPI_num_events returned 2...\n");
632 printf(
"FAILURE: PAPI_num_events failed, returned xRC=%d...\n", xRC);
636 printf(
"SUCCESS: PAPI_add_event 0x40000208 not allowed...\n");
638 printf(
"FAILURE: PAPI_add_event 0x40000208 allowed, or failed incorrectly..., xRC=%d...\n", xRC);
642 printf(
"SUCCESS: PAPI_num_events returned 2...\n");
644 printf(
"FAILURE: PAPI_num_events failed, returned xRC=%d...\n", xRC);
648 printf(
"SUCCESS: PAPI_add_event PAPI_L1_ICM...\n");
650 printf(
"FAILURE: PAPI_add_event PAPI_L1_ICM failed, xRC=%d...\n", xRC);
654 printf(
"SUCCESS: PAPI_num_events returned 3...\n");
656 printf(
"FAILURE: PAPI_num_events failed, returned xRC=%d...\n", xRC);
660 printf(
"SUCCESS: PAPI_add_event PAPI_L1_TCM...\n");
662 printf(
"FAILURE: PAPI_add_event PAPI_L1_TCM failed, xRC=%d...\n", xRC);
666 printf(
"SUCCESS: PAPI_num_events returned 4...\n");
668 printf(
"FAILURE: PAPI_num_events failed, returned xRC=%d...\n", xRC);
672 printf(
"SUCCESS: PAPI_add_event, redundantly adding PAPI_L1_DCM not allowed...\n");
674 printf(
"FAILURE: PAPI_add_event PAPI_L1_DCM failed incorrectly, xRC=%d...\n", xRC);
678 printf(
"SUCCESS: PAPI_add_event, redundantly adding PNE_BGP_PU3_L2_MEMORY_WRITES not allowed...\n");
680 printf(
"FAILURE: PAPI_add_event PNE_BGP_PU3_L2_MEMORY_WRITES failed incorectly, xRC=%d...\n", xRC);
682 printf(
"\n==> All events added... Perform a read now...\n");
685 printf(
"SUCCESS: PAPI_read...\n");
687 printf(
"FAILURE: PAPI_read failed, xRC=%d...\n", xRC);
689 printf(
"\n==> Perform a reset now...\n");
692 printf(
"SUCCESS: PAPI_reset...\n");
694 printf(
"FAILURE: PAPI_reset failed, xRC=%d...\n", xRC);
696 printf(
"\n==> Perform another read now...\n");
699 printf(
"SUCCESS: PAPI_read...\n");
701 printf(
"FAILURE: PAPI_read failed, xRC=%d...\n", xRC);
703 printf(
"\n==> Should be 4 counters below, preset, native, preset, and preset. All counter values should be zero.\n");
706 printf(
"\n==> Stop the UPC now...\n");
709 printf(
"SUCCESS: PAPI_stop, but not running...\n");
711 printf(
"FAILURE: PAPI_stop failed incorectly, xRC=%d...\n", xRC);
713 printf(
"\n==> Start the UPC now...\n");
716 printf(
"SUCCESS: PAPI_start...\n");
718 printf(
"FAILURE: PAPI_start failed, xRC=%d...\n", xRC);
722 printf(
"\n==> Try to start it again...\n");
725 printf(
"SUCCESS: PAPI_start, but already running...\n");
727 printf(
"FAILURE: PAPI_start failed incorectly, xRC=%d...\n", xRC);
731 printf(
"\n==> Stop the UPC after the arithmetic was performed... The individual native counter values will be greater than the PAPI counters because the PAPI counters are read prior to the UPC(s) being stopped...\n");
734 printf(
"SUCCESS: PAPI_stop...\n");
736 printf(
"FAILURE: PAPI_stop failed, xRC=%d...\n", xRC);
741 printf(
"\n==> Perform a read of the counters after performing arithmetic, UPC is stopped... Values should be the same as right after the prior PAPI_Stop()...\n");
744 printf(
"SUCCESS: PAPI_read...\n");
746 printf(
"FAILURE: PAPI_read failed, xRC=%d...\n", xRC);
749 printf(
"\n==> Zero local counters. Perform a PAPI_accum, UPC is stopped... Native values should be zero, and the local PAPI counters the same as the previous read...\n");
753 printf(
"SUCCESS: PAPI_accum...\n");
756 printf(
"FAILURE: PAPI_accum failed, xRC=%d...\n", xRC);
761 printf(
"\n==> Perform a PAPI_read, UPC is stopped... All values should be zero...\n");
764 printf(
"SUCCESS: PAPI_read...\n");
767 printf(
"FAILURE: PAPI_read failed, xRC=%d...\n", xRC);
772 printf(
"\n==> Perform a reset after performing arithmetic, UPC is stopped... All values should be zero...\n");
775 printf(
"SUCCESS: PAPI_reset...\n");
778 printf(
"FAILURE: PAPI_reset failed, xRC=%d...\n", xRC);
783 printf(
"\n==> Perform another read of the counters after resetting the counters, UPC is stopped... All values should be zero...\n");
786 printf(
"SUCCESS: PAPI_read...\n");
788 printf(
"FAILURE: PAPI_read failed, xRC=%d...\n", xRC);
791 printf(
"\n==> Perform another PAPI_accum after resetting the counters, UPC is stopped... All values should be zero...\n");
795 printf(
"SUCCESS: PAPI_accum...\n");
798 printf(
"FAILURE: PAPI_accum failed, xRC=%d...\n", xRC);
803 printf(
"\n==> Perform another PAPI_read after accumulating and resetting the UPC, UPC is stopped... All values should be zero...\n");
806 printf(
"SUCCESS: PAPI_read...\n");
809 printf(
"FAILURE: PAPI_read failed, xRC=%d...\n", xRC);
814 printf(
"\n==> Start the UPC again...\n");
817 printf(
"SUCCESS: PAPI_start...\n");
819 printf(
"FAILURE: PAPI_start failed, xRC=%d...\n", xRC);
825 printf(
"\n==> Get the state of the event set...\n");
829 printf(
"SUCCESS: PAPI_state is RUNNING...\n");
832 printf(
"FAILURE: PAPI_state failed, incorrect state, xState=%d...\n", xState);
836 printf(
"FAILURE: PAPI_state failed, xRC=%d...\n", xRC);
840 printf(
"\n==> Perform a read of the counters, UPC is running... The individual native counter values will be greater than the PAPI counters because the PAPI counters are read prior to the reads for the individual counter values...\n");
843 printf(
"SUCCESS: PAPI_read...\n");
845 printf(
"FAILURE: PAPI_read failed, xRC=%d...\n", xRC);
850 printf(
"\n==> Perform another read of the counters, UPC is running... Values should be increasing...\n");
853 printf(
"SUCCESS: PAPI_read...\n");
855 printf(
"FAILURE: PAPI_read failed, xRC=%d...\n", xRC);
860 printf(
"\n==> Perform another read of the counters, UPC is running... Values should continue increasing...\n");
863 printf(
"SUCCESS: PAPI_read...\n");
865 printf(
"FAILURE: PAPI_read failed, xRC=%d...\n", xRC);
868 printf(
"\n==> Perform a reset after performing arithmetic, UPC is still running... Native counter values should be less than prior read, but PAPI counter values should be identical to the prior read (local buffer was not changed)...\n");
871 printf(
"SUCCESS: PAPI_reset...\n");
874 printf(
"FAILURE: PAPI_reset failed, xRC=%d...\n", xRC);
879 printf(
"\n==> Zero local counters. Perform a PAPI_accum, UPC is still running...\n");
883 printf(
"SUCCESS: PAPI_accum...\n");
886 printf(
"FAILURE: PAPI_accum failed, xRC=%d...\n", xRC);
893 printf(
"\n==> Accumulate local counters. Perform a PAPI_accum, UPC is still running... PAPI counters should show an increase from prior accumulate...\n");
896 printf(
"SUCCESS: PAPI_accum...\n");
899 printf(
"FAILURE: PAPI_accum failed, xRC=%d...\n", xRC);
906 printf(
"\n==> Accumulate local counters. Perform another PAPI_accum, UPC is still running... PAPI counters should show an increase from prior accumulate...\n");
909 printf(
"SUCCESS: PAPI_accum...\n");
912 printf(
"FAILURE: PAPI_accum failed, xRC=%d...\n", xRC);
917 printf(
"\n==> Zero local counters. Perform a PAPI_accum, UPC is still running... PAPI counters should be less than the prior accumulate...\n");
921 printf(
"SUCCESS: PAPI_accum...\n");
924 printf(
"FAILURE: PAPI_accum failed, xRC=%d...\n", xRC);
929 printf(
"\n==> Perform a PAPI_read, UPC is still running... Native counters and PAPI counters should have both increased from prior accumulate...\n");
932 printf(
"SUCCESS: PAPI_read...\n");
935 printf(
"FAILURE: PAPI_read failed, xRC=%d...\n", xRC);
940 printf(
"\n==> Perform a PAPI_write (not supported when UPC is running)...\n");
943 printf(
"SUCCESS: PAPI_write, not allowed...\n");
946 printf(
"FAILURE: PAPI_write failed, xRC=%d...\n", xRC);
950 printf(
"\n==> Stop the UPC... The individual native counter values will be greater than the PAPI counters because the PAPI counters are read prior to the UPC(s) being stopped...\n");
953 printf(
"SUCCESS: PAPI_stop...\n");
955 printf(
"FAILURE: PAPI_stop failed, xRC=%d...\n", xRC);
960 printf(
"\n==> Perform a PAPI_read with the UPC stopped...\n");
963 printf(
"SUCCESS: PAPI_read...\n");
965 printf(
"FAILURE: PAPI_read failed, xRC=%d...\n", xRC);
967 printf(
"\n==> Should be same 4 counters below, with the same native and PAPI counters as after the PAPI_stop...\n");
970 printf(
"\n==> Perform a PAPI_accum with the UPC stopped... Native counters sould be zeroed, with the PAPI counters unchanged from prior read (with the UPC already stopped, the accumulate does not add any counter values to the local buffer)...\n");
974 printf(
"SUCCESS: PAPI_accum...\n");
977 printf(
"FAILURE: PAPI_accum failed, xRC=%d...\n", xRC);
982 printf(
"\n==> Perform a PAPI_read with the UPC stopped... Native and PAPI counters are zero...\n");
985 printf(
"SUCCESS: PAPI_read...\n");
987 printf(
"FAILURE: PAPI_read failed, xRC=%d...\n", xRC);
990 printf(
"\n==> Perform a reset, UPC is stopped... Native and PAPI counters are zero...\n");
993 printf(
"SUCCESS: PAPI_reset...\n");
996 printf(
"FAILURE: PAPI_reset failed, xRC=%d...\n", xRC);
1001 printf(
"\n==> Perform a PAPI_write, but only to local memory...\n");
1004 printf(
"SUCCESS: PAPI_write, but only to local memory...\n");
1007 printf(
"FAILURE: PAPI_write failed, xRC=%d...\n", xRC);
1011 printf(
"\n==> Get the state of the event set...\n");
1015 printf(
"SUCCESS: PAPI_state is STOPPED...\n");
1018 printf(
"FAILURE: PAPI_state failed, incorrect state, xState=%d...\n", xState);
1022 printf(
"FAILURE: PAPI_state failed, xRC=%d...\n", xRC);
1026 printf(
"\n==> Get the multiplex status of the eventset...\n");
1029 printf(
"SUCCESS: PAPI_get_multiplex (NOTE: The rest of the multiplex path is untested)...\n");
1032 printf(
"FAILURE: PAPI_get_multiplex failed, xRC=%d...\n", xRC);
1036 printf(
"\n==> Remove the events, and clean up the event set...\n");
1039 printf(
"SUCCESS: PAPI_remove_event could not find PNE_BGP_PU1_IPIPE_INSTRUCTIONS...\n");
1041 printf(
"FAILURE: PAPI_remove_event PNE_BGP_PU1_IPIPE_INSTRUCTIONS failed, xRC=%d...\n", xRC);
1045 printf(
"SUCCESS: PAPI_remove_event could not find PAPI_L3_LDM...\n");
1047 printf(
"FAILURE: PAPI_remove_event PAPI_L3_LDM failed, xRC=%d...\n", xRC);
1051 printf(
"SUCCESS: PAPI_remove_event PAPI_L1_TCM...\n");
1053 printf(
"FAILURE: PAPI_remove_event PAPI_L1_TCM failed, xRC=%d...\n", xRC);
1057 printf(
"SUCCESS: PAPI_num_events returned 3...\n");
1059 printf(
"FAILURE: PAPI_num_events failed, returned xRC=%d...\n", xRC);
1063 printf(
"SUCCESS: PAPI_remove_event PAPI_L1_ICM...\n");
1065 printf(
"FAILURE: PAPI_remove_event PAPI_L1_ICM failed, xRC=%d...\n", xRC);
1069 printf(
"SUCCESS: PAPI_num_events returned 2...\n");
1071 printf(
"FAILURE: PAPI_num_events failed, returned xRC=%d...\n", xRC);
1075 printf(
"SUCCESS: PAPI_remove_event PNE_BGP_PU3_L2_MEMORY_WRITES...\n");
1077 printf(
"FAILURE: PAPI_remove_event PNE_BGP_PU3_L2_MEMORY_WRITES failed, xRC=%d...\n", xRC);
1081 printf(
"SUCCESS: PAPI_num_events returned 1...\n");
1083 printf(
"FAILURE: PAPI_num_events failed, returned xRC=%d...\n", xRC);
1087 printf(
"SUCCESS: PAPI_remove_event PAPI_L1_DCM...\n");
1089 printf(
"FAILURE: PAPI_remove_event PAPI_L1_DCM failed, xRC=%d...\n", xRC);
1093 printf(
"SUCCESS: PAPI_num_events returned 0...\n");
1095 printf(
"FAILURE: PAPI_num_events failed, returned xRC=%d...\n", xRC);
1099 printf(
"SUCCESS: PAPI_cleanup_eventset...\n");
1101 printf(
"FAILURE: PAPI_cleanup_eventset failed, xRC=%d...\n", xRC);
1105 printf(
"SUCCESS: PAPI_destroy_eventset...\n");
1107 printf(
"FAILURE: PAPI_destroy_eventset failed, xRC=%d...\n", xRC);
1109 printf(
"==> Do_Low_Level_Tests(): End of the main body...\n");
1119 uint xEventId, xEventCode;
1120 int xRC, xNumEvents;
1122 printf(
"==> Do_High_Level_Tests(): Beginning of the main body...\n");
1126 printf(
"SUCCESS: PAPI_num_counters returned 256 hardware counters...\n");
1128 printf(
"FAILURE: PAPI_num_counters failed, returned xRC=%d...\n", xRC);
1132 printf(
"SUCCESS: PAPI_num_components returned 256 hardware counters...\n");
1134 printf(
"FAILURE: PAPI_num_components failed, returned xRC=%d...\n", xRC);
1140 xEventCode = xEventId | 0x80000000;
1143 switch(xEventCode) {
1215 printf(
"FAILURE: Do_High_Level_Tests, preset event code %#8.8x added to list of events to be started, but should not be allowed...\n", xEventCode);
1218 printf(
"SUCCESS: Do_High_Level_Tests, preset event code %#8.8x added to list of events to be started...\n", xEventCode);
1224 switch(xEventCode) {
1296 printf(
"SUCCESS: Do_High_Level_Tests, preset event code %#8.8x cannot be added to list of events to be started, xRC = %d...\n", xEventCode, xRC);
1299 printf(
"FAILURE: Do_High_Level_Tests, preset event code %#8.8x cannot be added to list of events to be started, xRC = %d...\n", xEventCode, xRC);
1312 xEventCode = xEventId | 0x40000000;
1315 switch(xEventCode) {
1373 printf(
"FAILURE: Do_High_Level_Tests, native event code %#8.8x added to list of events to be started, but should not be allowed...\n", xEventCode);
1376 printf(
"SUCCESS: Do_High_Level_Tests, native event code %#8.8x added to list of events to be started...\n", xEventCode);
1382 switch(xEventCode) {
1440 printf(
"SUCCESS: Do_High_Level_Tests, native event code %#8.8x cannot be added to list of events to be started, xRC = %d...\n", xEventCode, xRC);
1443 printf(
"FAILURE: Do_High_Level_Tests, native event code %#8.8x cannot be added to list of events to be started, xRC = %d...\n", xEventCode, xRC);
1452 float xRtime, xPtime, xMflips, xMflops, xIpc;
1453 long long xFlpins, xFlpops, xIns;
1456 xRC =
PAPI_flips(&xRtime, &xPtime, &xFlpins, &xMflips);
1459 printf(
"SUCCESS: PAPI_flips started.\n");
1461 printf(
"FAILURE: PAPI_flips failed, returned xRC=%d...\n", xRC);
1465 xRC =
PAPI_flips(&xRtime, &xPtime, &xFlpins, &xMflips);
1467 printf(
"SUCCESS: PAPI_flips Rtime=%e Ptime=%e, Flpins=%lld, Mflips=%e\n", xRtime, xPtime, xFlpins, xMflips);
1469 printf(
"FAILURE: PAPI_flips failed, returned xRC=%d...\n", xRC);
1474 xRC =
PAPI_flips(&xRtime, &xPtime, &xFlpins, &xMflips);
1476 printf(
"SUCCESS: PAPI_flips Rtime=%e Ptime=%e, Flpins=%lld, Mflips=%e\n", xRtime, xPtime, xFlpins, xMflips);
1478 printf(
"FAILURE: PAPI_flips failed, returned xRC=%d...\n", xRC);
1482 printf(
"SUCCESS: PAPI_stop_counters stopped counters.\n");
1484 printf(
"FAILURE: PAPI_stop_counters failed, returned xRC=%d...\n", xRC);
1487 xRC =
PAPI_flops(&xRtime, &xPtime, &xFlpops, &xMflops);
1489 printf(
"SUCCESS: PAPI_flops started.\n");
1491 printf(
"FAILURE: PAPI_flops failed, returned xRC=%d...\n", xRC);
1495 xRC =
PAPI_flops(&xRtime, &xPtime, &xFlpops, &xMflops);
1497 printf(
"SUCCESS: PAPI_flops Rtime=%e Ptime=%e Flpops=%lld Mflops=%e\n", xRtime, xPtime, xFlpops, xMflops);
1499 printf(
"FAILURE: PAPI_flops failed, returned xRC=%d...\n", xRC);
1504 xRC =
PAPI_flops(&xRtime, &xPtime, &xFlpops, &xMflops);
1506 printf(
"SUCCESS: PAPI_flops Rtime=%e Ptime=%e Flpops=%lld Mflops=%e\n", xRtime, xPtime, xFlpops, xMflops);
1508 printf(
"FAILURE: PAPI_flops failed, returned xRC=%d...\n", xRC);
1512 printf(
"SUCCESS: PAPI_stop_counters stopped counters.\n");
1514 printf(
"FAILURE: PAPI_stop_counters failed, returned xRC=%d...\n", xRC);
1516 xRC =
PAPI_ipc(&xRtime, &xPtime, &xIns, &xIpc);
1518 printf(
"SUCCESS: PAPI_ipc, no event found...\n");
1520 printf(
"FAILURE: PAPI_ipc failed, returned xRC=%d...\n", xRC);
1522 printf(
"==> Do_High_Level_Tests(): End of the main body...\n");
1535 printf(
"==> Do_Multiplex_Tests(): Beginning of the main body...\n");
1539 printf(
"SUCCESS: PAPI_multiplex_init...\n");
1541 printf(
"FAILURE: PAPI_multiplex_init failed, returned xRC=%d...\n", xRC);
1543 printf(
"==> Do_Multiplex_Tests(): End of the main body...\n");
1556 printf(
"SUCCESS: PAPI_start_counters...\n");
1558 printf(
"FAILURE: PAPI_start_counters failed, returned xRC=%d...\n", xRC);
1570 printf(
"SUCCESS: PAPI_read_counters...\n");
1572 printf(
"FAILURE: PAPI_read_counters failed, returned xRC=%d...\n", xRC);
1585 printf(
"SUCCESS: PAPI_accum_counters...\n");
1587 printf(
"FAILURE: PAPI_accum_counters failed, returned xRC=%d...\n", xRC);
1599 printf(
"SUCCESS: PAPI_read_counters...\n");
1601 printf(
"FAILURE: PAPI_read_counters failed, returned xRC=%d...\n", xRC);
1613 printf(
"SUCCESS: PAPI_stop_counters...\n");
1615 printf(
"FAILURE: PAPI_stop_counters failed, returned xRC=%d...\n", xRC);
1635 for (
i=0;
i<255;
i++)
1648 printf(
"\n==> Start: Performing arithmetic...\n");
1649 register unsigned int zero = 0;
1650 register double *x_p = &
x[0];
1652 for (
i = 0;
i < 32;
i++ )
1659 asm volatile (
"fabs 1,2");
1660 asm volatile (
"fmr 1,2");
1661 asm volatile (
"fnabs 1,2");
1662 asm volatile (
"fneg 1,2");
1664 asm volatile (
"fadd 1,2,3");
1665 asm volatile (
"fadds 1,2,3");
1666 asm volatile (
"fdiv 1,2,3");
1667 asm volatile (
"fdivs 1,2,3");
1668 asm volatile (
"fmul 1,2,3");
1669 asm volatile (
"fmuls 1,2,3");
1670 asm volatile (
"fres 1,2");
1671 asm volatile (
"frsqrte 1,2");
1674 asm volatile (
"fsub 1,2,3");
1675 asm volatile (
"fsubs 1,2,3");
1677 asm volatile (
"fmadd 3,4,5,6");
1678 asm volatile (
"fmadds 3,4,5,6");
1679 asm volatile (
"fmsub 3,4,5,6");
1680 asm volatile (
"fmsubs 3,4,5,6");
1681 asm volatile (
"fnmadd 3,4,5,6");
1682 asm volatile (
"fnmadds 3,4,5,6");
1683 asm volatile (
"fnmsub 3,4,5,6");
1684 asm volatile (
"fnmsubs 3,4,5,6");
1689 asm volatile (
"fctiw 5,6");
1690 asm volatile (
"fctiwz 5,6");
1691 asm volatile (
"frsp 5,6");
1693 asm volatile (
"fcmpo 0,1,2");
1694 asm volatile (
"fcmpu 0,1,2");
1695 asm volatile (
"fsel 0,1,2,3");
1701 asm volatile(
"fpadd 9,10,11");
1702 asm volatile(
"fpsub 9,10,11");
1709 asm volatile(
"fpmul 23,24,25");
1710 asm volatile(
"fxmul 26, 27, 28");
1711 asm volatile(
"fxpmul 28, 29, 30");
1712 asm volatile(
"fxsmul 2, 3, 4");
1717 asm volatile(
"fpmadd 10,11,12,13");
1718 asm volatile(
"fpmsub 18, 19, 20, 21");
1719 asm volatile(
"fpnmadd 26, 27, 28, 29");
1720 asm volatile(
"fpnmsub 16,17,18,19");
1722 asm volatile(
"fxmadd 10,11,12,13");
1723 asm volatile(
"fxmsub 18, 19, 20, 21");
1724 asm volatile(
"fxnmadd 26, 27, 28, 29");
1725 asm volatile(
"fxnmsub 16,17,18,19");
1727 asm volatile(
"fxcpmadd 10,11,12,13");
1728 asm volatile(
"fxcpmsub 18, 19, 20, 21");
1729 asm volatile(
"fxcpnmadd 26, 27, 28, 29");
1730 asm volatile(
"fxcpnmsub 16,17,18,19");
1732 asm volatile(
"fxcsmadd 10,11,12,13");
1733 asm volatile(
"fxcsmsub 18, 19, 20, 21");
1734 asm volatile(
"fxcsnmadd 26, 27, 28, 29");
1735 asm volatile(
"fxcsnmsub 16,17,18,19");
1737 asm volatile(
"fxcpnpma 1,2,3,4");
1738 asm volatile(
"fxcsnpma 5,6,7,8");
1739 asm volatile(
"fxcpnsma 9,10,11,12");
1740 asm volatile(
"fxcsnsma 3,4,5,6");
1742 asm volatile(
"fxcxnpma 9,10,11,12");
1743 asm volatile(
"fxcxnsma 8,9,10,11");
1744 asm volatile(
"fxcxma 3,4,5,6");
1745 asm volatile(
"fxcxnms 8,9,10,11");
1752 asm volatile(
"fpre 12, 13");
1753 asm volatile(
"fprsqrte 15, 16");
1754 asm volatile(
"fpsel 17, 18, 19, 20");
1755 asm volatile(
"fpctiw 1,2");
1756 asm volatile(
"fpctiwz 3,4");
1757 asm volatile(
"fprsp 5,6");
1758 asm volatile(
"fscmp 1,2,3");
1759 asm volatile(
"fpmr 1,2");
1760 asm volatile(
"fpneg 1,2");
1761 asm volatile(
"fpabs 1,2");
1762 asm volatile(
"fpnabs 1,2");
1763 asm volatile(
"fsmr 1,2");
1764 asm volatile(
"fsneg 1,2");
1765 asm volatile(
"fsabs 1,2");
1766 asm volatile(
"fsnabs 1,2");
1767 asm volatile(
"fxmr 1,2");
1768 asm volatile(
"fsmfp 1,2");
1769 asm volatile(
"fsmtp 1,2");
1774 asm volatile(
"lfdx 16,%0,%1" :
"+b"(x_p) :
"b"(zero));
1775 asm volatile(
"lfdux 16,%0,%1" :
"+b"(x_p) :
"b"(zero));
1776 asm volatile(
"lfsx 16,%0,%1" :
"+b"(x_p) :
"b"(zero));
1777 asm volatile(
"lfsux 16,%0,%1" :
"+b"(x_p) :
"b"(zero));
1779 asm volatile(
"lfsdx 16,%0,%1" :
"+b"(x_p) :
"b"(zero));
1780 asm volatile(
"lfsdux 16,%0,%1" :
"+b"(x_p) :
"b"(zero));
1781 asm volatile(
"lfssx 16,%0,%1" :
"+b"(x_p) :
"b"(zero));
1782 asm volatile(
"lfssux 16,%0,%1" :
"+b"(x_p) :
"b"(zero));
1784 asm volatile(
"lfpsx 16,%0,%1" :
"+b"(x_p) :
"b"(zero));
1785 asm volatile(
"lfpsux 16,%0,%1" :
"+b"(x_p) :
"b"(zero));
1786 asm volatile(
"lfxsx 16,%0,%1" :
"+b"(x_p) :
"b"(zero));
1787 asm volatile(
"lfxsux 16,%0,%1" :
"+b"(x_p) :
"b"(zero));
1791 asm volatile(
"lfpdx 16,%0,%1" :
"+b"(x_p) :
"b"(zero));
1792 asm volatile(
"lfpdux 16,%0,%1" :
"+b"(x_p) :
"b"(zero));
1793 asm volatile(
"lfxdx 16,%0,%1" :
"+b"(x_p) :
"b"(zero));
1794 asm volatile(
"lfxdux 16,%0,%1" :
"+b"(x_p) :
"b"(zero));
1798 asm volatile(
"stfdx 16,%0,%1" :
"+b"(x_p) :
"b"(zero));
1799 asm volatile(
"stfdux 16,%0,%1" :
"+b"(x_p) :
"b"(zero));
1800 asm volatile(
"stfsx 16,%0,%1" :
"+b"(x_p) :
"b"(zero));
1801 asm volatile(
"stfsux 16,%0,%1" :
"+b"(x_p) :
"b"(zero));
1803 asm volatile(
"stfsdx 16,%0,%1" :
"+b"(x_p) :
"b"(zero));
1804 asm volatile(
"stfsdux 16,%0,%1" :
"+b"(x_p) :
"b"(zero));
1805 asm volatile(
"stfssx 16,%0,%1" :
"+b"(x_p) :
"b"(zero));
1808 asm volatile(
"stfpsx 16,%0,%1" :
"+b"(x_p) :
"b"(zero));
1809 asm volatile(
"stfpsux 16,%0,%1" :
"+b"(x_p) :
"b"(zero));
1810 asm volatile(
"stfxsx 16,%0,%1" :
"+b"(x_p) :
"b"(zero));
1811 asm volatile(
"stfxsux 16,%0,%1" :
"+b"(x_p) :
"b"(zero));
1815 asm volatile(
"stfpdx 16,%0,%1" :
"+b"(x_p) :
"b"(zero));
1816 asm volatile(
"stfpdux 16,%0,%1" :
"+b"(x_p) :
"b"(zero));
1817 asm volatile(
"stfxdx 16,%0,%1" :
"+b"(x_p) :
"b"(zero));
1818 asm volatile(
"stfxdux 16,%0,%1" :
"+b"(x_p) :
"b"(zero));
1820 printf(
"==> End: Performing arithmetic...\n");
1830 printf(
"\n***** Start Print Counter Values *****\n");
1835 printf(
"\n***** End Print Counter Values *****\n");
1846 printf(
"\n***** Start Print of Native Counter Values *****\n");
1847 BGP_UPC_Print_Counter_Values(BGP_UPC_READ_EXCLUSIVE);
1848 printf(
"***** End Print of Native Counter Values *****\n");
1859 printf(
"\n***** Start Print of Native Counter Values for PAPI Counters *****\n");
1866 printf(
"No events are present in the event set.\n");
1868 printf(
"***** End Print of Native Counter Values for PAPI Counters *****\n");
1880 BGP_UPC_Event_Id_t xNativeEventId;
1884 for (
i=0;
i<pNumEvents;
i++) {
1889 printf(
"FAILURE: PAPI_get_event_info failed for %s, xRC=%d\n", xName, xRC);
1892 printf(
"\n *** PAPI Counter Location %3.3d: %#8.8x %s\n",
i,
PAPI_Events[
i], xName);
1895 for (j=0; j<xEventInfo.
count; j++) {
1896 xNativeEventId = (BGP_UPC_Event_Id_t)(xEventInfo.
code[j]&0xBFFFFFFF);
1898 BGP_UPC_Print_Counter_Value(xNativeEventId, BGP_UPC_READ_EXCLUSIVE);
1903 xNativeEventId = (BGP_UPC_Event_Id_t)(
PAPI_Events[
i]&0xBFFFFFFF);
1905 BGP_UPC_Print_Counter_Value(xNativeEventId, BGP_UPC_READ_EXCLUSIVE);
1909 printf(
"\n *** PAPI Counter Location %3.3d: Not mapped\n",
i);
1921 printf(
"\n***** Start Print of Native Counter Values *****\n");
1922 printf(
"Elapsed Running Time (native) = %lld\n", (*pBuffer).elapsed_time);
1925 printf(
"***** End Print of Native Counter Values *****\n");
1938 printf(
"\n***** Start Print of PAPI Counter Values *****\n");
1941 printf(
"Number of Counters = %d\n", pNumEvents);
1943 printf(
" Calculated Value Location Event Number Event Name\n");
1944 printf(
"-------------------- -------- ------------ --------------------------------------------\n");
1946 for (
i=0;
i<pNumEvents;
i++) {
1948 printf(
"PAPI_event_code_to_name failed on event code %d\n",
PAPI_Events[
i]);
1951 printf(
"%20llu %3d %#8.8x %s\n", pCounters[
i],
i,
PAPI_Events[
i], xName);
1954 printf(
"***** End Print of PAPI Counter Values *****\n");
1967 printf(
"\n***** Start Print of PAPI Counter Values *****\n");
1968 printf(
"Number of Counters = %d\n", pNumEvents);
1970 printf(
" Calculated Value Location Event Number Event Name\n");
1971 printf(
"-------------------- -------- ------------ --------------------------------------------\n");
1972 for (
i=0;
i<pNumEvents;
i++) {
1974 printf(
"PAPI_event_code_to_name failed on event code %d\n", pEventList[
i]);
1977 printf(
"%20llu %3d %#8.8x %s\n", pCounters[
i],
i, pEventList[
i], xName);
1980 printf(
"***** End Print of PAPI Counter Values *****\n");
1993 printf(
"Print_Counter_Values: Native_Buffer*=%p, pCounters*=%p\n",
Native_Buffer, pCounters);
1994 printf(
"Number of Counters = %d\n", pNumCounters);
1996 printf(
" +0 +1 +2 +3 +4 +5 +6 +7\n");
1997 printf(
"---------------------------------------------------------------------------------------------\n");
2001 if (
i+j < pNumCounters) {
2002 xCounters[j] = pCounters[
i+j];
2007 printf(
"Ctrs %3.3d-%3.3d: %8lld %8lld %8lld %8lld %8lld %8lld %8lld %8lld\n",
2008 i,
i+7, xCounters[0], xCounters[1], xCounters[2], xCounters[3], xCounters[4],
2009 xCounters[5], xCounters[6], xCounters[7]);
2022 BGP_UPC_Read_Counters_Struct_t* xTemp;
2023 xTemp = (BGP_UPC_Read_Counters_Struct_t*)(
void*)
Native_Buffer;
2024 printf(
"***** Start Print of Node Information *****\n");
2025 printf(
"Rank = %d\n", xTemp->rank);
2026 printf(
"Core = %d\n", xTemp->core);
2027 printf(
"UPC Number = %d\n", xTemp->upc_number);
2028 printf(
"Number of Processes per UPC = %d\n", xTemp->number_processes_per_upc);
2029 printf(
"User Mode = %d\n", (
int) xTemp->mode);
2030 printf(
"Location = %s\n", xTemp->location);
2031 printf(
"\n***** End Print of Node Information *****\n\n");
2043 int xRC = BGP_UPC_Read_Counter_Values(
Native_Buffer, pLength, BGP_UPC_READ_EXCLUSIVE);
2045 printf(
"FAILURE: BGP_UPC_Read_Counter_Values failed, xRC=%d...\n", xRC);
2061 for (
i=0;
i<pNumEvents;
i++) {
2063 printf(
"PAPI Counter Location %3.3d: %#8.8x %s\n",
i,
PAPI_Events[
i], xName);
2065 printf(
"PAPI Counter Location %3.3d: Not mapped\n",
i);
2078 printf(
"FAILURE: PAPI_list_events failed, returned xRC=%d...\n", xRC);
int PAPI_stop(int EventSet, long long *values)
int PAPI_is_initialized(void)
int PAPI_add_event(int EventSet, int EventCode)
long long PAPI_get_virt_usec(void)
int PAPI_reset(int EventSet)
const PAPI_shlib_info_t * PAPI_get_shared_lib_info(void)
int PAPI_write(int EventSet, long long *values)
int PAPI_ipc(float *rtime, float *ptime, long long *ins, float *ipc)
int PAPI_remove_event(int EventSet, int EventCode)
long long PAPI_get_virt_cyc(void)
void Print_Native_Counters()
int PAPI_flops(float *rtime, float *ptime, long long *flpops, float *mflops)
int PAPI_accum_counters(long long *values, int array_len)
int PAPI_num_components(void)
int PAPI_enum_event(int *EventCode, int modifier)
void Do_High_Level_Tests(void)
void Print_PAPI_Counters(const int pEventSet, const long long *pCounters)
void Read_Native_Counters(const int pLength)
void Print_Native_Counters_for_PAPI_Counters(const int pEventSet)
get the executable's info
void List_PAPI_Events(const int pEventSet, int *pEvents, int *xNumEvents)
char Native_Buffer[BGP_UPC_MAXIMUM_LENGTH_READ_COUNTERS_STRUCTURE]
int PAPI_event_name_to_code(const char *in, int *out)
unsigned int code[PAPI_MAX_INFO_TERMS]
const int MaxPresetEventId
Return codes and api definitions.
int PAPI_get_event_info(int EventCode, PAPI_event_info_t *info)
int PAPI_flips(float *rtime, float *ptime, long long *flpins, float *mflips)
int PAPI_accum(int EventSet, long long *values)
long long PAPI_Counters[MAX_COUNTERS]
const int NumEventsPerSet
int PAPI_library_init(int version)
int PAPI_num_hwctrs(void)
void Do_Multiplex_Tests(void)
int PAPI_stop_counters(long long *values, int array_len)
A pointer to the following is passed to PAPI_get_dmem_info()
const PAPI_exe_info_t * PAPI_get_executable_info(void)
int PAPI_num_events(int EventSet)
int PAPI_state(int EventSet, int *status)
int main(int argc, char *argv[])
void Run_Cycle(const int pNumEvents)
void Print_Native_Counters_via_Buffer(const BGP_UPC_Read_Counters_Struct_t *pBuffer)
void Do_Low_Level_Tests(void)
void Print_PAPI_Events(const int pEventSet)
int PAPI_cleanup_eventset(int EventSet)
void Print_Node_Info(void)
int PAPI_create_eventset(int *EventSet)
int PAPI_event_code_to_name(int EventCode, char *out)
void Print_Counters(const int pEventSet)
const int MaxNativeEventId
int PAPI_get_dmem_info(PAPI_dmem_info_t *dest)
int PAPI_query_event(int EventCode)
void Print_PAPI_Counters_From_List(const int *pEventList, const int pNumEvents, const long long *pCounters)
int PAPI_multiplex_init(void)
void DumpInHex(const char *pBuffer, int pSize)
long long PAPI_get_real_usec(void)
int PAPI_read_counters(long long *values, int array_len)
int PAPI_num_counters(void)
int PAPI_start_counters(int *events, int array_len)
#define NUMBER_COUNTERS_PER_ROW
void Print_Counter_Values(const long long *pCounters, const int pNumCounters)
int PAPI_destroy_eventset(int *EventSet)
int PAPI_Events[MAX_COUNTERS]
long long PAPI_get_real_cyc(void)
int PAPI_read(int EventSet, long long *values)
int PAPI_start(int EventSet)
void Print_Native_Counters_for_PAPI_Counters_From_List(const int *pEvents, const int pNumEvents)
int PAPI_get_multiplex(int EventSet)
const PAPI_hw_info_t * PAPI_get_hardware_info(void)
static long long values[NUM_EVENTS]
void Zero_Local_Counters(long long *pCounters)
double x [32] ALIGN_L3_CACHE
int PAPI_list_events(int EventSet, int *Events, int *number)