00001 
00002 #include "converse.h"
00003 
00004 #include <spi/UPC.h>
00005 #include <spi/UPC_Events.h>
00006 #include <iostream>
00007 
00008 
00009 
00011 void initBGP_UPC_Counters(void) {
00012 
00013     
00014     BGP_UPC_Initialize();
00015 
00016 
00017     
00018     
00019     
00020     
00021     
00022     BGP_UPC_Mode_t counter_mode = BGP_UPC_MODE_2;
00023     BGP_UPC_Event_Edge_t counter_trigger = BGP_UPC_CFG_EDGE_DEFAULT;
00024     
00025     BGP_UPC_Initialize_Counter_Config(counter_mode, counter_trigger);
00026 
00027     BGP_UPC_Zero_Counter_Values();
00028     BGP_UPC_Start(0);
00029 
00030 }
00031 
00032 
00033 
00034 
00035 
00037 void printBGP_UPC_Counters(void) {
00038     
00039  
00040     BGP_UPC_Stop();
00041    
00042     CmiMyPe();
00043 
00044     
00045 
00046 
00047 
00048 #if 0
00049     int64_t cxp = BGP_UPC_Read_Counter_Value(BGP_TORUS_XP_PACKETS, BGP_UPC_READ_EXCLUSIVE);
00050     std::cout << "BGP_UPC_Read_Counter_Value returned torus xp = " << cxp << std::endl;
00051 
00052     int64_t cxm = BGP_UPC_Read_Counter_Value(BGP_TORUS_XM_PACKETS, BGP_UPC_READ_EXCLUSIVE);
00053     std::cout << "BGP_UPC_Read_Counter_Value returned torus xm = " << cxm << std::endl;
00054 
00055     int64_t cyp = BGP_UPC_Read_Counter_Value(BGP_TORUS_YP_PACKETS, BGP_UPC_READ_EXCLUSIVE);
00056     std::cout << "BGP_UPC_Read_Counter_Value returned torus yp = " << cyp << std::endl;
00057 
00058     int64_t cym = BGP_UPC_Read_Counter_Value(BGP_TORUS_YM_PACKETS, BGP_UPC_READ_EXCLUSIVE);
00059     std::cout << "BGP_UPC_Read_Counter_Value returned torus ym = " << cym << std::endl;
00060 
00061     int64_t czp = BGP_UPC_Read_Counter_Value(BGP_TORUS_ZP_PACKETS, BGP_UPC_READ_EXCLUSIVE);
00062     std::cout << "BGP_UPC_Read_Counter_Value returned torus zp = " << czp << std::endl;
00063 
00064     int64_t czm = BGP_UPC_Read_Counter_Value(BGP_TORUS_ZM_PACKETS, BGP_UPC_READ_EXCLUSIVE);
00065     std::cout << "BGP_UPC_Read_Counter_Value returned torus zm = " << czm << std::endl;
00066 
00067 
00068 
00069     int64_t cxpc = BGP_UPC_Read_Counter_Value(BGP_TORUS_XP_32BCHUNKS, BGP_UPC_READ_EXCLUSIVE);
00070     std::cout << "BGP_UPC_Read_Counter_Value returned torus xp chunks = " << cxpc << std::endl;
00071 
00072     int64_t cxmc = BGP_UPC_Read_Counter_Value(BGP_TORUS_XM_32BCHUNKS, BGP_UPC_READ_EXCLUSIVE);
00073     std::cout << "BGP_UPC_Read_Counter_Value returned torus xm chunks = " << cxmc << std::endl;
00074 
00075     int64_t cypc = BGP_UPC_Read_Counter_Value(BGP_TORUS_YP_32BCHUNKS, BGP_UPC_READ_EXCLUSIVE);
00076     std::cout << "BGP_UPC_Read_Counter_Value returned torus yp chunks = " << cypc << std::endl;
00077 
00078     int64_t cymc = BGP_UPC_Read_Counter_Value(BGP_TORUS_YM_32BCHUNKS, BGP_UPC_READ_EXCLUSIVE);
00079     std::cout << "BGP_UPC_Read_Counter_Value returned torus ym chunks = " << cymc << std::endl;
00080 
00081     int64_t czpc = BGP_UPC_Read_Counter_Value(BGP_TORUS_ZP_32BCHUNKS, BGP_UPC_READ_EXCLUSIVE);
00082     std::cout << "BGP_UPC_Read_Counter_Value returned torus zp chunks = " << czpc << std::endl;
00083 
00084     int64_t czmc = BGP_UPC_Read_Counter_Value(BGP_TORUS_ZM_32BCHUNKS, BGP_UPC_READ_EXCLUSIVE);
00085     std::cout << "BGP_UPC_Read_Counter_Value returned torus zm chunks = " << czmc << std::endl;
00086 #else
00087 
00088     int pe = CmiMyPe();
00089 
00090 
00091 std::cout << "[" << pe << "] BGP_TORUS_XP_NO_TOKENS=" << BGP_UPC_Read_Counter_Value(BGP_TORUS_XP_NO_TOKENS, BGP_UPC_READ_EXCLUSIVE) << "\n";
00092 std::cout << "[" << pe << "] BGP_TORUS_XM_NO_TOKENS=" << BGP_UPC_Read_Counter_Value(BGP_TORUS_XM_NO_TOKENS, BGP_UPC_READ_EXCLUSIVE) << "\n";
00093 std::cout << "[" << pe << "] BGP_TORUS_YP_NO_TOKENS=" << BGP_UPC_Read_Counter_Value(BGP_TORUS_YP_NO_TOKENS, BGP_UPC_READ_EXCLUSIVE) << "\n";
00094 std::cout << "[" << pe << "] BGP_TORUS_YM_NO_TOKENS=" << BGP_UPC_Read_Counter_Value(BGP_TORUS_YM_NO_TOKENS, BGP_UPC_READ_EXCLUSIVE) << "\n";
00095 std::cout << "[" << pe << "] BGP_TORUS_ZP_NO_TOKENS=" << BGP_UPC_Read_Counter_Value(BGP_TORUS_ZP_NO_TOKENS, BGP_UPC_READ_EXCLUSIVE) << "\n";
00096 std::cout << "[" << pe << "] BGP_TORUS_ZM_NO_TOKENS=" << BGP_UPC_Read_Counter_Value(BGP_TORUS_ZM_NO_TOKENS, BGP_UPC_READ_EXCLUSIVE) << "\n";
00097 std::cout << "[" << pe << "] BGP_TORUS_XP_NO_VCD0_TOKENS=" << BGP_UPC_Read_Counter_Value(BGP_TORUS_XP_NO_VCD0_TOKENS, BGP_UPC_READ_EXCLUSIVE) << "\n";
00098 std::cout << "[" << pe << "] BGP_TORUS_XM_NO_VCD0_TOKENS=" << BGP_UPC_Read_Counter_Value(BGP_TORUS_XM_NO_VCD0_TOKENS, BGP_UPC_READ_EXCLUSIVE) << "\n";
00099 std::cout << "[" << pe << "] BGP_TORUS_YP_NO_VCD0_TOKENS=" << BGP_UPC_Read_Counter_Value(BGP_TORUS_YP_NO_VCD0_TOKENS, BGP_UPC_READ_EXCLUSIVE) << "\n";
00100 std::cout << "[" << pe << "] BGP_TORUS_YM_NO_VCD0_TOKENS=" << BGP_UPC_Read_Counter_Value(BGP_TORUS_YM_NO_VCD0_TOKENS, BGP_UPC_READ_EXCLUSIVE) << "\n";
00101 std::cout << "[" << pe << "] BGP_TORUS_ZP_NO_VCD0_TOKENS=" << BGP_UPC_Read_Counter_Value(BGP_TORUS_ZP_NO_VCD0_TOKENS, BGP_UPC_READ_EXCLUSIVE) << "\n";
00102 std::cout << "[" << pe << "] BGP_TORUS_ZM_NO_VCD0_TOKENS=" << BGP_UPC_Read_Counter_Value(BGP_TORUS_ZM_NO_VCD0_TOKENS, BGP_UPC_READ_EXCLUSIVE) << "\n";
00103 std::cout << "[" << pe << "] BGP_TORUS_XP_NO_VCBN_TOKENS=" << BGP_UPC_Read_Counter_Value(BGP_TORUS_XP_NO_VCBN_TOKENS, BGP_UPC_READ_EXCLUSIVE) << "\n";
00104 std::cout << "[" << pe << "] BGP_TORUS_XM_NO_VCBN_TOKENS=" << BGP_UPC_Read_Counter_Value(BGP_TORUS_XM_NO_VCBN_TOKENS, BGP_UPC_READ_EXCLUSIVE) << "\n";
00105 std::cout << "[" << pe << "] BGP_TORUS_YP_NO_VCBN_TOKENS=" << BGP_UPC_Read_Counter_Value(BGP_TORUS_YP_NO_VCBN_TOKENS, BGP_UPC_READ_EXCLUSIVE) << "\n";
00106 std::cout << "[" << pe << "] BGP_TORUS_YM_NO_VCBN_TOKENS=" << BGP_UPC_Read_Counter_Value(BGP_TORUS_YM_NO_VCBN_TOKENS, BGP_UPC_READ_EXCLUSIVE) << "\n";
00107 std::cout << "[" << pe << "] BGP_TORUS_ZP_NO_VCBN_TOKENS=" << BGP_UPC_Read_Counter_Value(BGP_TORUS_ZP_NO_VCBN_TOKENS, BGP_UPC_READ_EXCLUSIVE) << "\n";
00108 
00109 std::cout << "[" << pe << "] BGP_TORUS_XP_NO_VCBP_TOKENS=" << BGP_UPC_Read_Counter_Value(BGP_TORUS_XP_NO_VCBP_TOKENS, BGP_UPC_READ_EXCLUSIVE) << "\n";
00110 std::cout << "[" << pe << "] BGP_TORUS_XM_NO_VCBP_TOKENS=" << BGP_UPC_Read_Counter_Value(BGP_TORUS_XM_NO_VCBP_TOKENS, BGP_UPC_READ_EXCLUSIVE) << "\n";
00111 std::cout << "[" << pe << "] BGP_TORUS_YP_NO_VCBP_TOKENS=" << BGP_UPC_Read_Counter_Value(BGP_TORUS_YP_NO_VCBP_TOKENS, BGP_UPC_READ_EXCLUSIVE) << "\n";
00112 std::cout << "[" << pe << "] BGP_TORUS_YM_NO_VCBP_TOKENS=" << BGP_UPC_Read_Counter_Value(BGP_TORUS_YM_NO_VCBP_TOKENS, BGP_UPC_READ_EXCLUSIVE) << "\n";
00113 std::cout << "[" << pe << "] BGP_TORUS_ZP_NO_VCBP_TOKENS=" << BGP_UPC_Read_Counter_Value(BGP_TORUS_ZP_NO_VCBP_TOKENS, BGP_UPC_READ_EXCLUSIVE) << "\n";
00114 
00115 
00116 #endif
00117 
00118     
00119     BGP_UPC_Start(0);
00120     
00121 }
00122