PAPI  5.6.0.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)
 

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 18 of file case1.c.

19 {
20  double c, a = 0.999, b = 1.001;
21  int n = 1000;
22  int EventSet = PAPI_NULL;
23  int retval;
24  int i, j = 0;
25  long long g1[2];
26 
27  tests_quiet( argc, argv ); /* Set TESTS_QUIET variable */
28 
29  if ( ( retval =
31  test_fail( __FILE__, __LINE__, "PAPI_library_init", retval );
32 
33 
34  if ( ( retval = PAPI_create_eventset( &EventSet ) ) != PAPI_OK )
35  test_fail( __FILE__, __LINE__, "PAPI_create_eventset", retval );
36 
38  j++;
39 
40  if ( j == 1 &&
41  ( retval = PAPI_add_event( EventSet, PAPI_L2_TCM ) ) != PAPI_OK ) {
42  if ( retval != PAPI_ECNFLCT )
43  test_fail( __FILE__, __LINE__, "PAPI_add_event", retval );
44  j--; /* The event was not added */
45  }
46 
47  i = j;
49  j++;
50 
51  if ( j == ( i + 1 ) &&
52  ( retval = PAPI_add_event( EventSet, PAPI_L2_DCM ) ) != PAPI_OK ) {
53  if ( retval != PAPI_ECNFLCT )
54  test_fail( __FILE__, __LINE__, "PAPI_add_event", retval );
55  j--; /* The event was not added */
56  }
57 
58  if ( j ) {
59  if ( ( retval = PAPI_start( EventSet ) ) != PAPI_OK )
60  test_fail( __FILE__, __LINE__, "PAPI_start", retval );
61  for ( i = 0; i < n; i++ ) {
62  c = a * b;
63  }
64  if (!TESTS_QUIET) fprintf(stdout,"c=%lf\n",c);
65 
66  if ( ( retval = PAPI_stop( EventSet, g1 ) ) != PAPI_OK )
67  test_fail( __FILE__, __LINE__, "PAPI_stop", retval );
68  }
69 
70  test_pass( __FILE__ );
71 
72  return 0;
73 }
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_L2_TCM
int PAPI_add_event(int EventSet, int EventCode)
Definition: papi.c:1663
#define PAPI_NULL
Definition: papi.h:292
int EventSet
return PAPI_OK
Definition: linux-nvml.c:497
double c
Definition: multiplex.c:22
int int argc
Definition: iozone.c:1609
char ** argv
Definition: iozone.c:1610
int PAPI_library_init(int version)
Definition: papi.c:500
int i
Definition: fileop.c:140
#define PAPI_ECNFLCT
Definition: papi.h:261
int PAPI_create_eventset(int *EventSet)
Definition: papi.c:1464
#define PAPI_L2_DCM
int PAPI_query_event(int EventCode)
Definition: papi.c:684
int TESTS_QUIET
Definition: test_utils.c:18
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
long j
Definition: iozone.c:19135
ssize_t retval
Definition: libasync.c:338
#define PAPI_VER_CURRENT
Definition: papi.h:225
static double b[MATRIX_SIZE][MATRIX_SIZE]
Definition: libmsr_basic.c:39
static double a[MATRIX_SIZE][MATRIX_SIZE]
Definition: libmsr_basic.c:38

Here is the call graph for this function: