PAPI  5.6.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 15 of file perf_event_offcore_response.c.

15  {
16 
17  int quiet;
18 
19  char *offcore_event=NULL;
20  char event_name[BUFSIZ];
21 
22  int retval;
23  int EventSet1 = PAPI_NULL;
24 
25  long long total_values[1];
26 
27  /* Set TESTS_QUIET variable */
28  quiet = tests_quiet( argc, argv );
29 
30  /* Init the PAPI library */
32  if ( retval != PAPI_VER_CURRENT ) {
33  test_fail( __FILE__, __LINE__, "PAPI_library_init", retval );
34  }
35 
36  retval = PAPI_create_eventset(&EventSet1);
37  if (retval != PAPI_OK) {
38  test_fail(__FILE__, __LINE__, "PAPI_create_eventset",retval);
39  }
40 
41  /* Get a relevant event name */
42  offcore_event=get_offcore_event(event_name, BUFSIZ);
43  if (offcore_event==NULL) {
44  if (!quiet) {
45  printf("No test event available on this processor\n");
46  }
47  test_skip( __FILE__, __LINE__,
48  "PAPI does not support offcore on this processor",
49  PAPI_ENOSUPP );
50  }
51 
52  retval = PAPI_add_named_event(EventSet1, offcore_event);
53  if (retval != PAPI_OK) {
54  if ( !quiet ) {
55  fprintf(stderr,"Error trying to add %s\n",offcore_event);
56  }
57  test_fail(__FILE__, __LINE__, "adding offcore event ",retval);
58  }
59 
60  retval = PAPI_start( EventSet1 );
61  if ( retval != PAPI_OK ) {
62  test_fail( __FILE__, __LINE__, "PAPI_start", retval );
63  }
64 
66 
67  retval = PAPI_stop( EventSet1, total_values );
68  if ( retval != PAPI_OK ) {
69  test_fail( __FILE__, __LINE__, "PAPI_stop", retval );
70  }
71 
72  if ( !quiet ) {
73  printf("\t%s count = %lld\n",offcore_event,total_values[0]);
74  }
75 
76  test_pass( __FILE__ );
77 
78  return 0;
79 }
char event_name[2][PAPI_MAX_STR_LEN]
Definition: data_range.c:29
int PAPI_stop(int EventSet, long long *values)
Definition: papi.c:2314
void test_pass(const char *filename)
Definition: test_utils.c:432
#define PAPI_ENOSUPP
Definition: papi.h:271
#define PAPI_NULL
Definition: papi.h:292
return PAPI_OK
Definition: linux-nvml.c:497
#define NUM_FLOPS
Definition: sdsc-mpx.c:24
int int argc
Definition: iozone.c:1609
void test_skip(const char *file, int line, const char *call, int retval)
Definition: test_utils.c:559
int PAPI_add_named_event(int EventSet, const char *EventName)
Definition: papi.c:1876
char ** argv
Definition: iozone.c:1610
char * get_offcore_event(char *event, int size)
Definition: event_name_lib.c:7
int PAPI_library_init(int version)
Definition: papi.c:500
int quiet
Definition: rapl_overflow.c:18
int PAPI_create_eventset(int *EventSet)
Definition: papi.c:1464
void do_flops(int n)
Definition: multiplex.c:23
printf("\tTry: -i 0 -i 1 \n\n")
int tests_quiet(int argc, char **argv)
Definition: test_utils.c:376
void test_fail(const char *file, int line, const char *call, int retval)
Definition: test_utils.c:468
int PAPI_start(int EventSet)
Definition: papi.c:2096
ssize_t retval
Definition: libasync.c:338
#define PAPI_VER_CURRENT
Definition: papi.h:225
int EventSet1
Definition: zero_fork.c:47

Here is the call graph for this function: