mx_elapsed.c File Reference

Include dependency graph for mx_elapsed.c:

Go to the source code of this file.

Defines

#define NUM_EVENTS   3
 Tests basic mx myrinet functionality.

Functions

int main (int argc, char **argv)

Define Documentation

#define NUM_EVENTS   3
Author:
Vince Weaver

test case for mx myrinet component

Definition at line 15 of file mx_elapsed.c.


Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 17 of file mx_elapsed.c.

00018 {
00019 
00020   int retval,cid,numcmp,our_cmp;
00021     int EventSet = PAPI_NULL;
00022     long long values[NUM_EVENTS];
00023     int code;
00024     const PAPI_component_info_t *cmpinfo = NULL;
00025 
00026         /* Set TESTS_QUIET variable */
00027         tests_quiet( argc, argv );      
00028 
00029     /* PAPI Initialization */
00030     retval = PAPI_library_init( PAPI_VER_CURRENT );
00031     if ( retval != PAPI_VER_CURRENT ) {
00032        test_fail(__FILE__, __LINE__,"PAPI_library_init failed\n",retval);
00033     }
00034 
00035     if (!TESTS_QUIET) {
00036        printf("Trying mutiple reads in MX component\n");
00037     }
00038 
00039         numcmp = PAPI_num_components();
00040     our_cmp=-1;
00041 
00042     for(cid=0; cid<numcmp; cid++) {
00043 
00044        if ( (cmpinfo = PAPI_get_component_info(cid)) == NULL) {
00045           test_fail(__FILE__, __LINE__,"PAPI_get_component_info failed\n", 0);
00046        }
00047 
00048        if (strstr(cmpinfo->name,"mx")) {
00049          if (!TESTS_QUIET) printf("\tFound Myrinet component %d - %s\n", cid, cmpinfo->name);
00050          our_cmp=cid;
00051          break;
00052        }
00053 
00054     }
00055 
00056     if (our_cmp<0) {
00057        test_skip(__FILE__, __LINE__,"MX component not found\n", 0);
00058     }
00059 
00060     if (cmpinfo->num_native_events<=0) {
00061        test_skip(__FILE__, __LINE__,"MX component not found\n", 0);
00062     }
00063   
00064      
00065     EventSet = PAPI_NULL;
00066 
00067     retval = PAPI_create_eventset( &EventSet );
00068     if (retval != PAPI_OK) {
00069        test_fail(__FILE__, __LINE__, 
00070                               "PAPI_create_eventset()",retval);
00071     }
00072 
00073     retval=PAPI_event_name_to_code("mx:::COUNTERS_UPTIME",&code);
00074     if (retval!=PAPI_OK) {
00075            test_fail(__FILE__, __LINE__, 
00076                               "could not add event COUNTERS_UPTIME",retval);
00077     }
00078 
00079     retval = PAPI_add_event( EventSet, code );
00080     if (retval != PAPI_OK) {
00081        test_fail(__FILE__, __LINE__, 
00082                                  "PAPI_add_event()",retval);
00083     }
00084 
00085     retval=PAPI_event_name_to_code("mx:::PUSH_OBSOLETE",&code);
00086     if (retval!=PAPI_OK) {
00087            test_fail(__FILE__, __LINE__, 
00088                               "could not add event PUSH_OBSOLETE",retval);
00089     }
00090 
00091     retval = PAPI_add_event( EventSet, code );
00092     if (retval != PAPI_OK) {
00093        test_fail(__FILE__, __LINE__, 
00094                                  "PAPI_add_event()",retval);
00095     }
00096 
00097     retval=PAPI_event_name_to_code("mx:::PKT_MISROUTED",&code);
00098     if (retval!=PAPI_OK) {
00099            test_fail(__FILE__, __LINE__, 
00100                               "could not add event PKT_MISROUTED",retval);
00101     }
00102 
00103     retval = PAPI_add_event( EventSet, code );
00104     if (retval != PAPI_OK) {
00105        test_fail(__FILE__, __LINE__, 
00106                                  "PAPI_add_event()",retval);
00107     }
00108 
00109     retval = PAPI_start( EventSet);
00110     if (retval != PAPI_OK) {
00111        test_fail(__FILE__, __LINE__, "PAPI_start()",retval);
00112     }
00113 
00114     retval = PAPI_read( EventSet, values);
00115     if (retval != PAPI_OK) {
00116        test_fail(__FILE__, __LINE__, "PAPI_read()",retval);
00117     }
00118 
00119     if (!TESTS_QUIET) printf("%lld %lld %lld\n",values[0],values[1],values[2]);
00120 
00121     retval = PAPI_stop( EventSet, values);
00122     if (retval != PAPI_OK) {
00123        test_fail(__FILE__, __LINE__, "PAPI_start()",retval);
00124     }
00125 
00126     if (!TESTS_QUIET) printf("%lld %lld %lld\n",values[0],values[1],values[2]);
00127 
00128 
00129 
00130     test_pass( __FILE__, NULL, 0 );
00131         
00132     return 0;
00133 }

Here is the call graph for this function:


Generated on 8 Sep 2016 for PAPI by  doxygen 1.6.1