describe.c File Reference

Include dependency graph for describe.c:

Go to the source code of this file.

Functions

int main (int argc, char **argv)

Variables

int TESTS_QUIET

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 22 of file describe.c.

00023 {
00024     int EventSet = PAPI_NULL;
00025     int retval;
00026     long long g1[2];
00027     int eventcode = PAPI_TOT_INS;
00028     PAPI_event_info_t info, info1, info2;
00029 
00030     tests_quiet( argc, argv );  /* Set TESTS_QUIET variable */
00031 
00032     if ( ( retval =
00033            PAPI_library_init( PAPI_VER_CURRENT ) ) != PAPI_VER_CURRENT )
00034         test_fail( __FILE__, __LINE__, "PAPI_library_init", retval );
00035 
00036 
00037     if ( ( retval = PAPI_create_eventset( &EventSet ) ) != PAPI_OK )
00038         test_fail( __FILE__, __LINE__, "PAPI_create_eventset", retval );
00039 
00040     if ( ( retval = PAPI_query_event( eventcode ) ) != PAPI_OK )
00041         test_fail( __FILE__, __LINE__, "PAPI_query_event(PAPI_TOT_INS)",
00042                    retval );
00043 
00044     if ( ( retval = PAPI_add_event( EventSet, eventcode ) ) != PAPI_OK )
00045         test_fail( __FILE__, __LINE__, "PAPI_add_event(PAPI_TOT_INS)", retval );
00046 
00047     if ( ( retval = PAPI_start( EventSet ) ) != PAPI_OK )
00048         test_fail( __FILE__, __LINE__, "PAPI_start", retval );
00049 
00050     if ( ( retval = PAPI_stop( EventSet, g1 ) ) != PAPI_OK )
00051         test_fail( __FILE__, __LINE__, "PAPI_stop", retval );
00052 
00053     /* Case 0, no info, should fail */
00054     eventcode = 0;
00055 /*
00056    if ( ( retval = PAPI_describe_event(eventname,(int *)&eventcode,eventdesc) ) == PAPI_OK)
00057      test_fail(__FILE__,__LINE__,"PAPI_describe_event",retval);    
00058 */
00059     if (!TESTS_QUIET) {
00060         printf("This test expects a 'PAPI Error' to be returned from this PAPI call.\n");
00061     }
00062     if ( ( retval = PAPI_get_event_info( eventcode, &info ) ) == PAPI_OK )
00063         test_fail( __FILE__, __LINE__, "PAPI_get_event_info", retval );
00064 
00065     /* Case 1, fill in name field. */
00066     eventcode = PAPI_TOT_INS;
00067 /*
00068    if ( ( retval = PAPI_describe_event(eventname,(int *)&eventcode,eventdesc) ) != PAPI_OK)
00069      test_fail(__FILE__,__LINE__,"PAPI_describe_event",retval);    
00070 */
00071     if ( ( retval = PAPI_get_event_info( eventcode, &info1 ) ) != PAPI_OK )
00072         test_fail( __FILE__, __LINE__, "PAPI_get_event_info", retval );
00073 
00074     if ( strcmp( info1.symbol, "PAPI_TOT_INS" ) != 0 )
00075         test_fail( __FILE__, __LINE__,
00076                    "PAPI_get_event_info symbol value is bogus", retval );
00077     if ( strlen( info1.long_descr ) == 0 )
00078         test_fail( __FILE__, __LINE__,
00079                    "PAPI_get_event_info long_descr value is bogus", retval );
00080 
00081     eventcode = 0;
00082 
00083     /* Case 2, fill in code field. */
00084 /*
00085    if ( ( retval = PAPI_describe_event(eventname,(int *)&eventcode,eventdesc) ) != PAPI_OK)
00086      test_fail(__FILE__,__LINE__,"PAPI_describe_event",retval);    
00087 */
00088     if ( ( retval = PAPI_event_name_to_code( info1.symbol, ( int * ) &eventcode ) ) != PAPI_OK ) {
00089         test_fail( __FILE__, __LINE__, "PAPI_event_name_to_code", retval );
00090     }
00091 
00092     if ( eventcode != PAPI_TOT_INS )
00093         test_fail( __FILE__, __LINE__,
00094                    "PAPI_event_name_to_code code value is bogus", retval );
00095 
00096     if ( ( retval = PAPI_get_event_info( eventcode, &info2 ) ) != PAPI_OK )
00097         test_fail( __FILE__, __LINE__, "PAPI_get_event_info", retval );
00098 
00099     if ( strcmp( info2.symbol, "PAPI_TOT_INS" ) != 0 )
00100         test_fail( __FILE__, __LINE__,
00101                    "PAPI_get_event_info symbol value is bogus", retval );
00102     if ( strlen( info2.long_descr ) == 0 )
00103         test_fail( __FILE__, __LINE__,
00104                    "PAPI_get_event_info long_descr value is bogus", retval );
00105 
00106     test_pass( __FILE__, NULL, 0 );
00107     exit( 1 );
00108 }

Here is the call graph for this function:


Variable Documentation

Definition at line 11 of file test_utils.c.


Generated on 8 Sep 2016 for PAPI by  doxygen 1.6.1