PAPI  5.0.1.0
case2.c File Reference
Include dependency graph for case2.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 18 of file case2.c.

{
    double c, a = 0.999, b = 1.001;
    int n = 1000;
    int EventSet = PAPI_NULL;
    int retval;
    int j = 0, i;
    long long g1[3];

    tests_quiet( argc, argv );  /* Set TESTS_QUIET variable */

    if ( ( retval =
           PAPI_library_init( PAPI_VER_CURRENT ) ) != PAPI_VER_CURRENT )
        test_fail( __FILE__, __LINE__, "PAPI_library_init", retval );

    if ( ( retval = PAPI_create_eventset( &EventSet ) ) != PAPI_OK )
        test_fail( __FILE__, __LINE__, "PAPI_create_eventset", retval );

    if ( PAPI_query_event( PAPI_BR_CN ) == PAPI_OK )
        j++;

    if ( j == 1 &&
         ( retval = PAPI_add_event( EventSet, PAPI_BR_CN ) ) != PAPI_OK ) {
        if ( retval != PAPI_ECNFLCT )
            test_fail( __FILE__, __LINE__, "PAPI_add_event", retval );
    }

    i = j;
    if ( PAPI_query_event( PAPI_TOT_CYC ) == PAPI_OK )
        j++;

    if ( j == ( i + 1 ) &&
         ( retval = PAPI_add_event( EventSet, PAPI_TOT_CYC ) ) != PAPI_OK ) {
        if ( retval != PAPI_ECNFLCT )
            test_fail( __FILE__, __LINE__, "PAPI_add_event", retval );
    }

    i = j;
    if ( PAPI_query_event( PAPI_TOT_INS ) == PAPI_OK )
        j++;

    if ( j == ( i + 1 ) &&
         ( retval = PAPI_add_event( EventSet, PAPI_TOT_INS ) ) != PAPI_OK ) {
        if ( retval != PAPI_ECNFLCT )
            test_fail( __FILE__, __LINE__, "PAPI_add_event", retval );
    }

    if ( j ) {
        if ( ( retval = PAPI_start( EventSet ) ) != PAPI_OK )
            test_fail( __FILE__, __LINE__, "PAPI_start", retval );

        for ( i = 0; i < n; i++ ) {
            c = a * b;
        }
        if (!TESTS_QUIET) fprintf(stdout,"c=%lf\n",c);
        if ( ( retval = PAPI_stop( EventSet, g1 ) ) != PAPI_OK )
            test_fail( __FILE__, __LINE__, "PAPI_stop", retval );
    }
    test_pass( __FILE__, NULL, 0 );
    exit( 1 );
}

Here is the call graph for this function:


Variable Documentation

Definition at line 11 of file test_utils.c.

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines