PAPI 7.1.0.0
Loading...
Searching...
No Matches
serial_hl_ll_comb.c File Reference
Include dependency graph for serial_hl_ll_comb.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 8 of file serial_hl_ll_comb.c.

9{
10 int retval, i;
11 int quiet = 0;
12 char* region_name;
13
14 /* Set TESTS_QUIET variable */
15 quiet = tests_quiet( argc, argv );
16
17 region_name = "do_flops";
18
19 /* three iterations with high-level API */
20 if ( !quiet ) {
21 printf("\nTesting high-level API: do_flops\n");
22 }
23
24 for ( i = 1; i < 4; ++i ) {
25
26 retval = PAPI_hl_region_begin(region_name);
27 if ( retval != PAPI_OK ) {
28 test_fail( __FILE__, __LINE__, "PAPI_hl_region_begin", retval );
29 }
30
32
33 retval = PAPI_hl_region_end(region_name);
34 if ( retval != PAPI_OK ) {
35 test_fail( __FILE__, __LINE__, "PAPI_hl_region_end", retval );
36 }
37 }
38
39 if ( !quiet ) {
40 printf("\nTesting low-level API: do_flops\n");
41 }
42
43 long long values[2];
44 int EventSet = PAPI_NULL;
45 char event_name1[]="appio:::READ_BYTES";
46 char event_name2[]="appio:::WRITE_BYTES";
47
48 /* create the eventset */
50 if ( retval != PAPI_OK ) {
51 test_fail( __FILE__, __LINE__, "PAPI_create_eventset", retval );
52 }
53
54 retval = PAPI_add_named_event( EventSet, event_name1);
55 if ( retval != PAPI_OK ) {
56 if (!quiet) printf("Couldn't add %s\n",event_name1);
57 test_skip(__FILE__,__LINE__,"Couldn't add appio:::READ_BYTES",0);
58 }
59
60 retval = PAPI_add_named_event( EventSet, event_name2);
61 if ( retval != PAPI_OK ) {
62 if (!quiet) printf("Couldn't add %s\n",event_name2);
63 test_skip(__FILE__,__LINE__,"Couldn't add appio:::WRITE_BYTES",0);
64 }
65
66 /* Start PAPI */
68 if ( retval != PAPI_OK ) {
69 test_fail( __FILE__, __LINE__, "PAPI_start", retval );
70 }
71
73
74 /* Read results */
76 if ( retval != PAPI_OK ) {
77 test_fail( __FILE__, __LINE__, "PAPI_stop", retval );
78 }
79
80 if ( !quiet ) {
81 printf("%s: %lld\n", event_name1, values[0]);
82 printf("%s: %lld\n", event_name2, values[1]);
83 }
84
85 /* remove results. */
88
89 test_hl_pass( __FILE__ );
90
91 return 0;
92}
int i
add PAPI preset or native hardware event by name to an EventSet
Create a new empty PAPI EventSet.
Read performance events at the beginning of a region.
Read performance events at the end of a region and store the difference to the corresponding beginnin...
removes a named hardware event from a PAPI event set.
Start counting hardware events in an event set.
Stop counting hardware events in an event set.
#define PAPI_OK
Definition: f90papi.h:73
#define PAPI_NULL
Definition: f90papi.h:78
static int EventSet
Definition: init_fini.c:8
static long long values[NUM_EVENTS]
Definition: init_fini.c:10
void do_flops(int n)
Definition: multiplex.c:23
int tests_quiet(int argc, char **argv)
Definition: test_utils.c:376
void PAPI_NORETURN test_hl_pass(const char *filename)
Definition: test_utils.c:467
void PAPI_NORETURN test_fail(const char *file, int line, const char *call, int retval)
Definition: test_utils.c:491
void PAPI_NORETURN test_skip(const char *file, int line, const char *call, int retval)
Definition: test_utils.c:584
int quiet
Definition: rapl_overflow.c:19
#define NUM_FLOPS
Definition: sdsc-mpx.c:24
int retval
Definition: zero_fork.c:53
Here is the call graph for this function: