perf_event_offcore_response.c File Reference

Include dependency graph for perf_event_offcore_response.c:

Go to the source code of this file.

Functions

int main (int argc, char **argv)

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 9 of file perf_event_offcore_response.c.

00009                                   {
00010 
00011 
00012    char *offcore_event=NULL;
00013    char event_name[BUFSIZ];
00014 
00015    int retval;
00016    int EventSet1 = PAPI_NULL;
00017 
00018    long long total_values[1];
00019 
00020    /* Set TESTS_QUIET variable */
00021    tests_quiet( argc, argv );
00022 
00023    /* Init the PAPI library */
00024    retval = PAPI_library_init( PAPI_VER_CURRENT );
00025    if ( retval != PAPI_VER_CURRENT ) {
00026       test_fail( __FILE__, __LINE__, "PAPI_library_init", retval );
00027    }
00028 
00029    retval = PAPI_create_eventset(&EventSet1);
00030    if (retval != PAPI_OK) {
00031       test_fail(__FILE__, __LINE__, "PAPI_create_eventset",retval);
00032    }
00033 
00034    /* Get a relevant event name */
00035    offcore_event=get_offcore_event(event_name, BUFSIZ);
00036    if (offcore_event==NULL) {
00037      test_skip( __FILE__, __LINE__,
00038                 "PAPI does not support offcore on this processor", PAPI_ENOSUPP );
00039    }
00040 
00041    retval = PAPI_add_named_event(EventSet1, offcore_event);
00042    if (retval != PAPI_OK) {
00043       if ( !TESTS_QUIET ) {
00044     fprintf(stderr,"Error trying to add %s\n",offcore_event);
00045       }
00046       test_fail(__FILE__, __LINE__, "adding offcore event ",retval);
00047    }
00048 
00049    retval = PAPI_start( EventSet1 );
00050    if ( retval != PAPI_OK ) {
00051       test_fail( __FILE__, __LINE__, "PAPI_start", retval );
00052    }
00053 
00054    do_flops( NUM_FLOPS );
00055 
00056    retval = PAPI_stop( EventSet1, total_values );
00057    if ( retval != PAPI_OK ) {
00058       test_fail( __FILE__, __LINE__, "PAPI_stop", retval );
00059    }
00060 
00061    if ( !TESTS_QUIET ) {
00062      printf("\t%s count = %lld\n",offcore_event,total_values[0]);
00063    }
00064 
00065    test_pass( __FILE__, NULL, 0 );
00066 
00067    return 0;
00068 }

Here is the call graph for this function:


Generated on 26 Jan 2016 for PAPI by  doxygen 1.6.1