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

17 {
18  double c, a = 0.999, b = 1.001;
19  int n = 1000;
20  int EventSet = PAPI_NULL;
21  int retval;
22  int i, j = 0;
23  long long g1[2];
24 
25  tests_quiet( argc, argv ); /* Set TESTS_QUIET variable */
26 
27  if ( ( retval =
29  test_fail( __FILE__, __LINE__, "PAPI_library_init", retval );
30 
31 
32  if ( ( retval = PAPI_create_eventset( &EventSet ) ) != PAPI_OK )
33  test_fail( __FILE__, __LINE__, "PAPI_create_eventset", retval );
34 
36  j++;
37 
38  if ( j == 1 &&
39  ( retval = PAPI_add_event( EventSet, PAPI_L2_TCM ) ) != PAPI_OK ) {
40  if ( retval != PAPI_ECNFLCT )
41  test_fail( __FILE__, __LINE__, "PAPI_add_event", retval );
42  j--; /* The event was not added */
43  }
44 
45  i = j;
47  j++;
48 
49  if ( j == ( i + 1 ) &&
50  ( retval = PAPI_add_event( EventSet, PAPI_L2_DCM ) ) != PAPI_OK ) {
51  if ( retval != PAPI_ECNFLCT )
52  test_fail( __FILE__, __LINE__, "PAPI_add_event", retval );
53  j--; /* The event was not added */
54  }
55 
56  if ( j ) {
57  if ( ( retval = PAPI_start( EventSet ) ) != PAPI_OK )
58  test_fail( __FILE__, __LINE__, "PAPI_start", retval );
59  for ( i = 0; i < n; i++ ) {
60  c = a * b;
61  }
62  if (!TESTS_QUIET) fprintf(stdout,"c=%lf\n",c);
63 
64  if ( ( retval = PAPI_stop( EventSet, g1 ) ) != PAPI_OK )
65  test_fail( __FILE__, __LINE__, "PAPI_stop", retval );
66  }
67  test_pass( __FILE__, NULL, 0 );
68  exit( 1 );
69 }
int PAPI_stop(int EventSet, long long *values)
Definition: papi.c:2232
#define PAPI_L2_TCM
Definition: fpapi.h:142
int PAPI_add_event(int EventSet, int EventCode)
Definition: papi.c:1604
#define PAPI_NULL
Definition: fpapi.h:13
return PAPI_OK
Definition: linux-nvml.c:458
tests_quiet(argc, argv)
double c
Definition: multiplex.c:22
test_pass(__FILE__, NULL, 0)
int int argc
Definition: iozone.c:1609
static double a[MATRIX_SIZE][MATRIX_SIZE]
Definition: rapl_basic.c:37
#define PAPI_ECNFLCT
Definition: fpapi.h:113
int TESTS_QUIET
Definition: test_utils.c:11
char ** argv
Definition: iozone.c:1610
test_fail(__FILE__, __LINE__,"PAPI_library_init", retval)
int PAPI_library_init(int version)
Definition: papi.c:495
int i
Definition: fileop.c:140
#define PAPI_L2_DCM
Definition: fpapi.h:137
#define PAPI_VER_CURRENT
Definition: fpapi.h:14
int PAPI_create_eventset(int *EventSet)
Definition: papi.c:1406
int PAPI_query_event(int EventCode)
Definition: papi.c:696
int EventSet
static double b[MATRIX_SIZE][MATRIX_SIZE]
Definition: rapl_basic.c:38
int PAPI_start(int EventSet)
Definition: papi.c:2026
long j
Definition: iozone.c:19135
ssize_t retval
Definition: libasync.c:338
void exit()
int n
Definition: mendes-alt.c:164

Here is the call graph for this function:

Variable Documentation

int TESTS_QUIET

Definition at line 11 of file test_utils.c.