PAPI 7.1.0.0
Loading...
Searching...
No Matches
mx_elapsed.c File Reference
Include dependency graph for mx_elapsed.c:

Go to the source code of this file.

Macros

#define NUM_EVENTS   3
 Tests basic mx myrinet functionality.
 

Functions

int main (int argc, char **argv)
 

Macro Definition Documentation

◆ NUM_EVENTS

#define NUM_EVENTS   3
Author
Vince Weaver

test case for mx myrinet component

Definition at line 18 of file mx_elapsed.c.

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 20 of file mx_elapsed.c.

21{
22
23 int retval,cid,numcmp,our_cmp;
24 int EventSet = PAPI_NULL;
25 long long values[NUM_EVENTS];
26 int code;
27 const PAPI_component_info_t *cmpinfo = NULL;
28 int quiet=0;
29
30 /* Set quiet variable */
31 quiet=tests_quiet( argc, argv );
32
33 /* PAPI Initialization */
35 if ( retval != PAPI_VER_CURRENT ) {
36 test_fail(__FILE__, __LINE__,"PAPI_library_init failed\n",retval);
37 }
38
39 if (!quiet) {
40 printf("Trying mutiple reads in MX component\n");
41 }
42
43 numcmp = PAPI_num_components();
44 our_cmp=-1;
45
46 for(cid=0; cid<numcmp; cid++) {
47
48 if ( (cmpinfo = PAPI_get_component_info(cid)) == NULL) {
49 test_fail(__FILE__, __LINE__,"PAPI_get_component_info failed\n", 0);
50 }
51
52 if (strstr(cmpinfo->name,"mx")) {
53 if (!quiet) printf("\tFound Myrinet component %d - %s\n", cid, cmpinfo->name);
54 our_cmp=cid;
55 break;
56 }
57
58 }
59
60 if (our_cmp<0) {
61 test_skip(__FILE__, __LINE__,"MX component not found\n", 0);
62 }
63
64 if (cmpinfo->num_native_events<=0) {
65 test_skip(__FILE__, __LINE__,"MX component not found\n", 0);
66 }
67
68
70
72 if (retval != PAPI_OK) {
73 test_fail(__FILE__, __LINE__,
74 "PAPI_create_eventset()",retval);
75 }
76
77 retval=PAPI_event_name_to_code("mx:::COUNTERS_UPTIME",&code);
78 if (retval!=PAPI_OK) {
79 test_fail(__FILE__, __LINE__,
80 "could not add event COUNTERS_UPTIME",retval);
81 }
82
84 if (retval != PAPI_OK) {
85 test_fail(__FILE__, __LINE__,
86 "PAPI_add_event()",retval);
87 }
88
89 retval=PAPI_event_name_to_code("mx:::PUSH_OBSOLETE",&code);
90 if (retval!=PAPI_OK) {
91 test_fail(__FILE__, __LINE__,
92 "could not add event PUSH_OBSOLETE",retval);
93 }
94
96 if (retval != PAPI_OK) {
97 test_fail(__FILE__, __LINE__,
98 "PAPI_add_event()",retval);
99 }
100
101 retval=PAPI_event_name_to_code("mx:::PKT_MISROUTED",&code);
102 if (retval!=PAPI_OK) {
103 test_fail(__FILE__, __LINE__,
104 "could not add event PKT_MISROUTED",retval);
105 }
106
107 retval = PAPI_add_event( EventSet, code );
108 if (retval != PAPI_OK) {
109 test_fail(__FILE__, __LINE__,
110 "PAPI_add_event()",retval);
111 }
112
114 if (retval != PAPI_OK) {
115 test_fail(__FILE__, __LINE__, "PAPI_start()",retval);
116 }
117
119 if (retval != PAPI_OK) {
120 test_fail(__FILE__, __LINE__, "PAPI_read()",retval);
121 }
122
123 if (!quiet) printf("%lld %lld %lld\n",values[0],values[1],values[2]);
124
126 if (retval != PAPI_OK) {
127 test_fail(__FILE__, __LINE__, "PAPI_start()",retval);
128 }
129
130 if (!quiet) printf("%lld %lld %lld\n",values[0],values[1],values[2]);
131
132
133
134 test_pass( __FILE__ );
135
136 return 0;
137}
add PAPI preset or native hardware event to an event set
Create a new empty PAPI EventSet.
Convert a name to a numeric hardware event code.
get information about a specific software component
initialize the PAPI library.
Get the number of components available on the system.
Read hardware counters from an event set.
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
static int EventSet
Definition: init_fini.c:8
static long long values[NUM_EVENTS]
Definition: init_fini.c:10
#define NUM_EVENTS
Tests basic mx myrinet functionality.
Definition: mx_elapsed.c:18
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
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
char name[PAPI_MAX_STR_LEN]
Definition: papi.h:627
int retval
Definition: zero_fork.c:53
Here is the call graph for this function: