|
PAPI
5.3.0.0
|

Go to the source code of this file.
Functions | |
| int | main (int argc, char **argv) |
| int main | ( | int | argc, |
| char ** | argv | ||
| ) |
Definition at line 9 of file perf_event_offcore_response.c.
{
char *offcore_event=NULL;
char event_name[BUFSIZ];
int retval;
int EventSet1 = PAPI_NULL;
long long total_values[1];
/* Set TESTS_QUIET variable */
tests_quiet( argc, argv );
/* Init the PAPI library */
retval = PAPI_library_init( PAPI_VER_CURRENT );
if ( retval != PAPI_VER_CURRENT ) {
test_fail( __FILE__, __LINE__, "PAPI_library_init", retval );
}
retval = PAPI_create_eventset(&EventSet1);
if (retval != PAPI_OK) {
test_fail(__FILE__, __LINE__, "PAPI_create_eventset",retval);
}
/* Get a relevant event name */
offcore_event=get_offcore_event(event_name, BUFSIZ);
if (offcore_event==NULL) {
test_skip( __FILE__, __LINE__,
"PAPI does not support offcore on this processor", PAPI_ENOSUPP );
}
retval = PAPI_add_named_event(EventSet1, offcore_event);
if (retval != PAPI_OK) {
if ( !TESTS_QUIET ) {
fprintf(stderr,"Error trying to add %s\n",offcore_event);
}
test_fail(__FILE__, __LINE__, "adding offcore event ",retval);
}
retval = PAPI_start( EventSet1 );
if ( retval != PAPI_OK ) {
test_fail( __FILE__, __LINE__, "PAPI_start", retval );
}
do_flops( NUM_FLOPS );
retval = PAPI_stop( EventSet1, total_values );
if ( retval != PAPI_OK ) {
test_fail( __FILE__, __LINE__, "PAPI_stop", retval );
}
if ( !TESTS_QUIET ) {
printf("\t%s count = %lld\n",offcore_event,total_values[0]);
}
test_pass( __FILE__, NULL, 0 );
return 0;
}
