PAPI  5.4.0.0
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
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.

9  {
10 
11 
12  char *offcore_event=NULL;
13  char event_name[BUFSIZ];
14 
15  int retval;
16  int EventSet1 = PAPI_NULL;
17 
18  long long total_values[1];
19 
20  /* Set TESTS_QUIET variable */
21  tests_quiet( argc, argv );
22 
23  /* Init the PAPI library */
25  if ( retval != PAPI_VER_CURRENT ) {
26  test_fail( __FILE__, __LINE__, "PAPI_library_init", retval );
27  }
28 
29  retval = PAPI_create_eventset(&EventSet1);
30  if (retval != PAPI_OK) {
31  test_fail(__FILE__, __LINE__, "PAPI_create_eventset",retval);
32  }
33 
34  /* Get a relevant event name */
35  offcore_event=get_offcore_event(event_name, BUFSIZ);
36  if (offcore_event==NULL) {
37  test_skip( __FILE__, __LINE__,
38  "PAPI does not support offcore on this processor", PAPI_ENOSUPP );
39  }
40 
41  retval = PAPI_add_named_event(EventSet1, offcore_event);
42  if (retval != PAPI_OK) {
43  if ( !TESTS_QUIET ) {
44  fprintf(stderr,"Error trying to add %s\n",offcore_event);
45  }
46  test_fail(__FILE__, __LINE__, "adding offcore event ",retval);
47  }
48 
49  retval = PAPI_start( EventSet1 );
50  if ( retval != PAPI_OK ) {
51  test_fail( __FILE__, __LINE__, "PAPI_start", retval );
52  }
53 
55 
56  retval = PAPI_stop( EventSet1, total_values );
57  if ( retval != PAPI_OK ) {
58  test_fail( __FILE__, __LINE__, "PAPI_stop", retval );
59  }
60 
61  if ( !TESTS_QUIET ) {
62  printf("\t%s count = %lld\n",offcore_event,total_values[0]);
63  }
64 
65  test_pass( __FILE__, NULL, 0 );
66 
67  return 0;
68 }
char event_name[2][PAPI_MAX_STR_LEN]
Definition: data_range.c:23
int PAPI_stop(int EventSet, long long *values)
Definition: papi.c:2258
#define NUM_FLOPS
int PAPI_add_named_event(int EventSet, char *EventName)
Definition: papi.c:1835
void test_skip(char *file, int line, char *call, int retval)
Definition: test_utils.c:614
#define PAPI_ENOSUPP
Definition: papi.h:269
#define PAPI_NULL
Definition: papi.h:290
return PAPI_OK
Definition: linux-nvml.c:458
tests_quiet(argc, argv)
#define printf
Definition: papi_test.h:125
test_pass(__FILE__, NULL, 0)
int int argc
Definition: iozone.c:1609
int TESTS_QUIET
Definition: test_utils.c:11
char ** argv
Definition: iozone.c:1610
char * get_offcore_event(char *event, int size)
Definition: event_name_lib.c:7
test_fail(__FILE__, __LINE__,"PAPI_library_init", retval)
int PAPI_library_init(int version)
Definition: papi.c:497
int PAPI_create_eventset(int *EventSet)
Definition: papi.c:1424
void do_flops(int n)
Definition: multiplex.c:23
int PAPI_start(int EventSet)
Definition: papi.c:2053
ssize_t retval
Definition: libasync.c:338
#define PAPI_VER_CURRENT
Definition: papi.h:223
int EventSet1
Definition: zero_fork.c:40

Here is the call graph for this function: