PAPI 7.1.0.0
Loading...
Searching...
No Matches
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

◆ main()

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
35 test_fail( __FILE__, __LINE__, "PAPI_create_eventset", retval );
36
38 j++;
39
40 if ( j == 1 &&
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 ) &&
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 i
add PAPI preset or native hardware event to an event set
Create a new empty PAPI EventSet.
initialize the PAPI library.
Query if PAPI event exists.
Start counting hardware events in an event set.
Stop counting hardware events in an event set.
#define PAPI_VER_CURRENT
Definition: f90papi.h:54
#define PAPI_OK
Definition: f90papi.h:73
#define PAPI_NULL
Definition: f90papi.h:78
#define PAPI_ECNFLCT
Definition: f90papi.h:234
#define PAPI_L2_TCM
Definition: f90papi.h:320
#define PAPI_L2_DCM
Definition: f90papi.h:331
static int EventSet
Definition: init_fini.c:8
static double a[MATRIX_SIZE][MATRIX_SIZE]
Definition: libmsr_basic.c:38
static double b[MATRIX_SIZE][MATRIX_SIZE]
Definition: libmsr_basic.c:39
static double c[MATRIX_SIZE][MATRIX_SIZE]
Definition: libmsr_basic.c:40
int TESTS_QUIET
Definition: test_utils.c:18
FILE * stdout
int tests_quiet(int argc, char **argv)
Definition: test_utils.c:376
void PAPI_NORETURN test_fail(const char *file, int line, const char *call, int retval)
Definition: test_utils.c:491
void PAPI_NORETURN test_pass(const char *filename)
Definition: test_utils.c:432
int retval
Definition: zero_fork.c:53
Here is the call graph for this function: