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

Functions

int main (int argc, char **argv)
 

Macro Definition Documentation

#define NUM_EVENTS   3
Author
Vince Weaver

test case for mx myrinet component

Definition at line 15 of file mx_elapsed.c.

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 17 of file mx_elapsed.c.

18 {
19 
20  int retval,cid,numcmp,our_cmp;
21  int EventSet = PAPI_NULL;
22  long long values[NUM_EVENTS];
23  int code;
24  const PAPI_component_info_t *cmpinfo = NULL;
25 
26  /* Set TESTS_QUIET variable */
27  tests_quiet( argc, argv );
28 
29  /* PAPI Initialization */
31  if ( retval != PAPI_VER_CURRENT ) {
32  test_fail(__FILE__, __LINE__,"PAPI_library_init failed\n",retval);
33  }
34 
35  if (!TESTS_QUIET) {
36  printf("Trying mutiple reads in MX component\n");
37  }
38 
39  numcmp = PAPI_num_components();
40  our_cmp=-1;
41 
42  for(cid=0; cid<numcmp; cid++) {
43 
44  if ( (cmpinfo = PAPI_get_component_info(cid)) == NULL) {
45  test_fail(__FILE__, __LINE__,"PAPI_get_component_info failed\n", 0);
46  }
47 
48  if (strstr(cmpinfo->name,"mx")) {
49  if (!TESTS_QUIET) printf("\tFound Myrinet component %d - %s\n", cid, cmpinfo->name);
50  our_cmp=cid;
51  break;
52  }
53 
54  }
55 
56  if (our_cmp<0) {
57  test_skip(__FILE__, __LINE__,"MX component not found\n", 0);
58  }
59 
60  if (cmpinfo->num_native_events<=0) {
61  test_skip(__FILE__, __LINE__,"MX component not found\n", 0);
62  }
63 
64 
65  EventSet = PAPI_NULL;
66 
67  retval = PAPI_create_eventset( &EventSet );
68  if (retval != PAPI_OK) {
69  test_fail(__FILE__, __LINE__,
70  "PAPI_create_eventset()",retval);
71  }
72 
73  retval=PAPI_event_name_to_code("mx:::COUNTERS_UPTIME",&code);
74  if (retval!=PAPI_OK) {
75  test_fail(__FILE__, __LINE__,
76  "could not add event COUNTERS_UPTIME",retval);
77  }
78 
79  retval = PAPI_add_event( EventSet, code );
80  if (retval != PAPI_OK) {
81  test_fail(__FILE__, __LINE__,
82  "PAPI_add_event()",retval);
83  }
84 
85  retval=PAPI_event_name_to_code("mx:::PUSH_OBSOLETE",&code);
86  if (retval!=PAPI_OK) {
87  test_fail(__FILE__, __LINE__,
88  "could not add event PUSH_OBSOLETE",retval);
89  }
90 
91  retval = PAPI_add_event( EventSet, code );
92  if (retval != PAPI_OK) {
93  test_fail(__FILE__, __LINE__,
94  "PAPI_add_event()",retval);
95  }
96 
97  retval=PAPI_event_name_to_code("mx:::PKT_MISROUTED",&code);
98  if (retval!=PAPI_OK) {
99  test_fail(__FILE__, __LINE__,
100  "could not add event PKT_MISROUTED",retval);
101  }
102 
103  retval = PAPI_add_event( EventSet, code );
104  if (retval != PAPI_OK) {
105  test_fail(__FILE__, __LINE__,
106  "PAPI_add_event()",retval);
107  }
108 
109  retval = PAPI_start( EventSet);
110  if (retval != PAPI_OK) {
111  test_fail(__FILE__, __LINE__, "PAPI_start()",retval);
112  }
113 
114  retval = PAPI_read( EventSet, values);
115  if (retval != PAPI_OK) {
116  test_fail(__FILE__, __LINE__, "PAPI_read()",retval);
117  }
118 
119  if (!TESTS_QUIET) printf("%lld %lld %lld\n",values[0],values[1],values[2]);
120 
121  retval = PAPI_stop( EventSet, values);
122  if (retval != PAPI_OK) {
123  test_fail(__FILE__, __LINE__, "PAPI_start()",retval);
124  }
125 
126  if (!TESTS_QUIET) printf("%lld %lld %lld\n",values[0],values[1],values[2]);
127 
128 
129 
130  test_pass( __FILE__, NULL, 0 );
131 
132  return 0;
133 }
char name[PAPI_MAX_STR_LEN]
Definition: papi.h:625
int PAPI_stop(int EventSet, long long *values)
Definition: papi.c:2232
const PAPI_component_info_t * PAPI_get_component_info(int cidx)
Definition: papi.c:805
int PAPI_add_event(int EventSet, int EventCode)
Definition: papi.c:1604
#define PAPI_NULL
Definition: fpapi.h:13
void test_skip(char *file, int line, char *call, int retval)
Definition: test_utils.c:614
int PAPI_num_components(void)
Definition: papi.c:4285
return PAPI_OK
Definition: linux-nvml.c:458
tests_quiet(argc, argv)
#define printf
Definition: papi_test.h:125
test_pass(__FILE__, NULL, 0)
int int argc
Definition: iozone.c:1609
int TESTS_QUIET
Definition: test_utils.c:11
char ** argv
Definition: iozone.c:1610
#define NUM_EVENTS
Tests basic mx myrinet functionality.
Definition: mx_elapsed.c:15
test_fail(__FILE__, __LINE__,"PAPI_library_init", retval)
int PAPI_library_init(int version)
Definition: papi.c:495
#define PAPI_VER_CURRENT
Definition: fpapi.h:14
int PAPI_create_eventset(int *EventSet)
Definition: papi.c:1406
int PAPI_event_name_to_code(char *in, int *out)
Definition: papi.c:1008
int EventSet
int PAPI_read(int EventSet, long long *values)
Definition: papi.c:2476
int PAPI_start(int EventSet)
Definition: papi.c:2026
static long long values[NUM_EVENTS]
Definition: init_fini.c:10
ssize_t retval
Definition: libasync.c:338

Here is the call graph for this function: