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.

00019 {
00020     double c, a = 0.999, b = 1.001;
00021     int n = 1000;
00022     int EventSet = PAPI_NULL;
00023     int retval;
00024     int j = 0, i;
00025     long long g1[3];
00026 
00027     tests_quiet( argc, argv );  /* Set TESTS_QUIET variable */
00028 
00029     if ( ( retval =
00030            PAPI_library_init( PAPI_VER_CURRENT ) ) != PAPI_VER_CURRENT )
00031         test_fail( __FILE__, __LINE__, "PAPI_library_init", retval );
00032 
00033     if ( ( retval = PAPI_create_eventset( &EventSet ) ) != PAPI_OK )
00034         test_fail( __FILE__, __LINE__, "PAPI_create_eventset", retval );
00035 
00036     if ( PAPI_query_event( PAPI_BR_CN ) == PAPI_OK )
00037         j++;
00038 
00039     if ( j == 1 &&
00040          ( retval = PAPI_add_event( EventSet, PAPI_BR_CN ) ) != PAPI_OK ) {
00041         if ( retval != PAPI_ECNFLCT )
00042             test_fail( __FILE__, __LINE__, "PAPI_add_event", retval );
00043     }
00044 
00045     i = j;
00046     if ( PAPI_query_event( PAPI_TOT_CYC ) == PAPI_OK )
00047         j++;
00048 
00049     if ( j == ( i + 1 ) &&
00050          ( retval = PAPI_add_event( EventSet, PAPI_TOT_CYC ) ) != PAPI_OK ) {
00051         if ( retval != PAPI_ECNFLCT )
00052             test_fail( __FILE__, __LINE__, "PAPI_add_event", retval );
00053     }
00054 
00055     i = j;
00056     if ( PAPI_query_event( PAPI_TOT_INS ) == PAPI_OK )
00057         j++;
00058 
00059     if ( j == ( i + 1 ) &&
00060          ( retval = PAPI_add_event( EventSet, PAPI_TOT_INS ) ) != PAPI_OK ) {
00061         if ( retval != PAPI_ECNFLCT )
00062             test_fail( __FILE__, __LINE__, "PAPI_add_event", retval );
00063     }
00064 
00065     if ( j ) {
00066         if ( ( retval = PAPI_start( EventSet ) ) != PAPI_OK )
00067             test_fail( __FILE__, __LINE__, "PAPI_start", retval );
00068 
00069         for ( i = 0; i < n; i++ ) {
00070             c = a * b;
00071         }
00072         if (!TESTS_QUIET) fprintf(stdout,"c=%lf\n",c);
00073         if ( ( retval = PAPI_stop( EventSet, g1 ) ) != PAPI_OK )
00074             test_fail( __FILE__, __LINE__, "PAPI_stop", retval );
00075     }
00076     test_pass( __FILE__, NULL, 0 );
00077     exit( 1 );
00078 }

Here is the call graph for this function:


Variable Documentation

Definition at line 11 of file test_utils.c.


Generated on 17 Nov 2016 for PAPI by  doxygen 1.6.1