lustre_basic.c File Reference

Include dependency graph for lustre_basic.c:

Go to the source code of this file.

Defines

#define NUM_EVENTS   1
 Tests basic lustre functionality.

Functions

int main (int argc, char **argv)

Define Documentation

#define NUM_EVENTS   1
Author:
Vince Weaver

test case for lustre component

Definition at line 15 of file lustre_basic.c.


Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 17 of file lustre_basic.c.

00018 {
00019 
00020         int retval,cid,numcmp;
00021     int EventSet = PAPI_NULL;
00022     long long values[NUM_EVENTS];
00023     int code;
00024     char event_name[PAPI_MAX_STR_LEN];
00025     int total_events=0;
00026     int r;
00027     const PAPI_component_info_t *cmpinfo = NULL;
00028 
00029         /* Set TESTS_QUIET variable */
00030         tests_quiet( argc, argv );      
00031 
00032     /* PAPI Initialization */
00033     retval = PAPI_library_init( PAPI_VER_CURRENT );
00034     if ( retval != PAPI_VER_CURRENT ) {
00035        test_fail(__FILE__, __LINE__,"PAPI_library_init failed\n",retval);
00036     }
00037 
00038     if (!TESTS_QUIET) {
00039        printf("Trying all lustre events\n");
00040     }
00041 
00042         numcmp = PAPI_num_components();
00043 
00044     for(cid=0; cid<numcmp; cid++) {
00045 
00046        if ( (cmpinfo = PAPI_get_component_info(cid)) == NULL) {
00047           test_fail(__FILE__, __LINE__,"PAPI_get_component_info failed\n", 0);
00048        }
00049 
00050        if (strstr(cmpinfo->name,"lustre")) {
00051          if (!TESTS_QUIET) printf("\tFound lustre component %d - %s\n", cid, cmpinfo->name);
00052        }
00053        else {
00054          continue;
00055        }
00056 
00057        code = PAPI_NATIVE_MASK;
00058 
00059            r = PAPI_enum_cmp_event( &code, PAPI_ENUM_FIRST, cid );
00060 
00061        while ( r == PAPI_OK ) {
00062           retval = PAPI_event_code_to_name( code, event_name );
00063           if ( retval != PAPI_OK ) {
00064          printf("Error translating %#x\n",code);
00065              test_fail( __FILE__, __LINE__, 
00066                             "PAPI_event_code_to_name", retval );
00067           }
00068 
00069           if (!TESTS_QUIET) printf("  %s ",event_name);
00070          
00071           EventSet = PAPI_NULL;
00072 
00073           retval = PAPI_create_eventset( &EventSet );
00074           if (retval != PAPI_OK) {
00075              test_fail(__FILE__, __LINE__, 
00076                               "PAPI_create_eventset()",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_start( EventSet);
00086           if (retval != PAPI_OK) {
00087                 test_fail(__FILE__, __LINE__, "PAPI_start()",retval);
00088           }
00089 
00090           retval = PAPI_stop( EventSet, values);
00091           if (retval != PAPI_OK) {
00092                 test_fail(__FILE__, __LINE__, "PAPI_start()",retval);
00093           }
00094 
00095           if (!TESTS_QUIET) printf(" value: %lld\n",values[0]);
00096 
00097           retval = PAPI_cleanup_eventset( EventSet );
00098           if (retval != PAPI_OK) {
00099                 test_fail(__FILE__, __LINE__, 
00100                               "PAPI_cleanup_eventset()",retval);
00101           }
00102 
00103           retval = PAPI_destroy_eventset( &EventSet );
00104           if (retval != PAPI_OK) {
00105                 test_fail(__FILE__, __LINE__, 
00106                               "PAPI_destroy_eventset()",retval);
00107           }
00108 
00109           total_events++;
00110           
00111           r = PAPI_enum_cmp_event( &code, PAPI_ENUM_EVENTS, cid );
00112        }
00113         }
00114 
00115     if (total_events==0) {
00116        test_skip(__FILE__,__LINE__,"No lustre events found",0);
00117     }
00118 
00119     if (!TESTS_QUIET) {
00120       printf("Note: for this test the values are expected to all be 0 as no I/O happens during the test.\n");
00121     }
00122 
00123     test_pass( __FILE__, NULL, 0 );
00124         
00125     return 0;
00126 }

Here is the call graph for this function:


Generated on 8 Sep 2016 for PAPI by  doxygen 1.6.1