case1.c File Reference

Include dependency graph for case1.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 16 of file case1.c.

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

Here is the call graph for this function:


Variable Documentation

Definition at line 11 of file test_utils.c.


Generated on 26 Jan 2016 for PAPI by  doxygen 1.6.1