PAPI  5.4.0.0
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
linux-infiniband.c
Go to the documentation of this file.
1 
21 /* Headers required by infiniband */
22 #include <stdio.h>
23 #include <stdlib.h>
24 #include <unistd.h>
25 #include <errno.h>
26 #include <ctype.h>
27 #include <string.h>
28 #include <dirent.h>
29 #include <error.h>
30 #include <time.h>
31 #include "pscanf.h"
32 
33 /* Headers required by PAPI */
34 #include "papi.h"
35 #include "papi_internal.h"
36 #include "papi_vector.h"
37 #include "papi_memory.h"
38 
39 /************************* DEFINES SECTION ***********************************
40  *******************************************************************************/
41 /* this number assumes that there will never be more events than indicated */
42 #define INFINIBAND_MAX_COUNTERS 128
43 
45 typedef struct infiniband_register
46 {
47  /* This is used by the framework.It likes it to be !=0 to do somehting */
48  unsigned int selector;
50 
51 /*
52  * The following structures mimic the ones used by other components. It is more
53  * convenient to use them like that as programming with PAPI makes specific
54  * assumptions for them.
55  */
56 
57 typedef struct _ib_device_type
58 {
59  char* dev_name;
60  int dev_port;
61  struct _ib_device_type *next;
62 } ib_device_t;
63 
64 typedef struct _ib_counter_type
65 {
66  char* ev_name;
67  char* ev_file_name;
69  int extended; // if this is an extended (64-bit) counter
70  struct _ib_counter_type *next;
71 } ib_counter_t;
72 
73 static const char *ib_dir_path = "/sys/class/infiniband";
74 
76 typedef struct _infiniband_native_event_entry
77 {
79  char *name;
80  char *description;
81  char* file_name;
83  int extended; /* if this is an extended (64-bit) counter */
85 
86 
87 typedef struct _infiniband_control_state
88 {
89  long long counts[INFINIBAND_MAX_COUNTERS];
90  int being_measured[INFINIBAND_MAX_COUNTERS];
91  /* all IB counters need difference, but use a flag for generality */
92  int need_difference[INFINIBAND_MAX_COUNTERS];
93  long long lastupdate;
95 
96 
97 typedef struct _infiniband_context
98 {
100  long long start_value[INFINIBAND_MAX_COUNTERS];
102 
103 
104 
105 /************************* GLOBALS SECTION ***********************************
106  *******************************************************************************/
107 /* This table contains the component native events */
109 /* number of events in the table*/
110 static int num_events = 0;
111 
112 
114 
115 /******************************************************************************
116  ******** BEGIN FUNCTIONS USED INTERNALLY SPECIFIC TO THIS COMPONENT ********
117  *****************************************************************************/
118 
121 
122 static char*
123 make_ib_event_description(const char* input_str, int extended)
124 {
125  int i, len;
126  char *desc = 0;
127  if (! input_str)
128  return (0);
129 
130  desc = (char*) papi_calloc(PAPI_MAX_STR_LEN, 1);
131  if (desc == 0) {
132  PAPIERROR("cannot allocate memory for event description");
133  return (0);
134  }
135  len = strlen(input_str);
136 
137  snprintf(desc, PAPI_MAX_STR_LEN, "%s (%s).",
138  input_str, (extended ? "free-running 64bit counter" :
139  "overflowing, auto-resetting counter"));
140  desc[0] = toupper(desc[0]);
141  for (i=0 ; i<len ; ++i)
142  if (desc[i] == '_')
143  desc[i] = ' ';
144 
145  return (desc);
146 }
147 
148 static ib_device_t*
149 add_ib_device(const char* name, int port)
150 {
151  ib_device_t *new_dev = (ib_device_t*) papi_calloc(sizeof(ib_device_t), 1);
152  if (new_dev == 0) {
153  PAPIERROR("cannot allocate memory for new IB device structure");
154  return (0);
155  }
156 
157  new_dev->dev_name = strdup(name);
158  new_dev->dev_port = port;
159  if (new_dev->dev_name==0)
160  {
161  PAPIERROR("cannot allocate memory for device internal fields");
162  papi_free(new_dev);
163  return (0);
164  }
165 
166  // prepend the new device to the device list
167  new_dev->next = root_device;
168  root_device = new_dev;
169 
170  return (new_dev);
171 }
172 
173 static ib_counter_t*
174 add_ib_counter(const char* name, const char* file_name, int extended, ib_device_t *device)
175 {
176  ib_counter_t *new_cnt = (ib_counter_t*) papi_calloc(sizeof(ib_counter_t), 1);
177  if (new_cnt == 0) {
178  PAPIERROR("cannot allocate memory for new IB counter structure");
179  return (0);
180  }
181 
182  new_cnt->ev_name = strdup(name);
183  new_cnt->ev_file_name = strdup(file_name);
184  new_cnt->extended = extended;
185  new_cnt->ev_device = device;
186  if (new_cnt->ev_name==0 || new_cnt->ev_file_name==0)
187  {
188  PAPIERROR("cannot allocate memory for counter internal fields");
189  papi_free(new_cnt);
190  return (0);
191  }
192 
193  // prepend the new counter to the counter list
194  new_cnt->next = root_counter;
195  root_counter = new_cnt;
196 
197  return (new_cnt);
198 }
199 
200 
201 static int
203 {
204  int nevents = 0;
205  DIR *cnt_dir = NULL;
206  char counters_path[128];
207  snprintf(counters_path, sizeof(counters_path), "%s/%s/ports/%d/counters%s",
208  ib_dir_path, dev->dev_name, dev->dev_port, (extended?"_ext":""));
209 
210  cnt_dir = opendir(counters_path);
211  if (cnt_dir == NULL) {
212  SUBDBG("cannot open counters directory `%s'\n", counters_path);
213  goto out;
214  }
215 
216  struct dirent *ev_ent;
217  /* iterate over all the events */
218  while ((ev_ent = readdir(cnt_dir)) != NULL) {
219  char *ev_name = ev_ent->d_name;
220  long long value = -1;
221  char event_path[160];
222  char counter_name[80];
223 
224  if (ev_name[0] == '.')
225  continue;
226 
227  /* Check that we can read an integer from the counter file */
228  snprintf(event_path, sizeof(event_path), "%s/%s", counters_path, ev_name);
229  if (pscanf(event_path, "%lld", &value) != 1) {
230  SUBDBG("cannot read value for event '%s'\n", ev_name);
231  continue;
232  }
233 
234  /* Create new counter */
235  snprintf(counter_name, sizeof(counter_name), "%s_%d%s:%s",
236  dev->dev_name, dev->dev_port, (extended?"_ext":""), ev_name);
237  if (add_ib_counter(counter_name, ev_name, extended, dev))
238  {
239  SUBDBG("Added new counter `%s'\n", counter_name);
240  nevents += 1;
241  }
242  }
243 
244  out:
245  if (cnt_dir != NULL)
246  closedir(cnt_dir);
247 
248  return (nevents);
249 }
250 
251 static int
253 {
254  DIR *ib_dir = NULL;
255  int result = PAPI_OK;
256  num_events = 0;
257 
258  ib_dir = opendir(ib_dir_path);
259  if (ib_dir == NULL) {
260  SUBDBG("cannot open `%s'\n", ib_dir_path);
261  strncpy(_infiniband_vector.cmp_info.disabled_reason,
262  "Infiniband sysfs interface not found", PAPI_MAX_STR_LEN);
263  result = PAPI_ENOSUPP;
264  goto out;
265  }
266 
267  struct dirent *hca_ent;
268  while ((hca_ent = readdir(ib_dir)) != NULL) {
269  char *hca = hca_ent->d_name;
270  char ports_path[80];
271  DIR *ports_dir = NULL;
272 
273  if (hca[0] == '.')
274  goto next_hca;
275 
276  snprintf(ports_path, sizeof(ports_path), "%s/%s/ports", ib_dir_path, hca);
277  ports_dir = opendir(ports_path);
278  if (ports_dir == NULL) {
279  SUBDBG("cannot open `%s'\n", ports_path);
280  goto next_hca;
281  }
282 
283  struct dirent *port_ent;
284  while ((port_ent = readdir(ports_dir)) != NULL) {
285  int port = atoi(port_ent->d_name);
286  if (port <= 0)
287  continue;
288 
289  /* Check that port is active. .../HCA/ports/PORT/state should read "4: ACTIVE." */
290  int state = -1;
291  char state_path[80];
292  snprintf(state_path, sizeof(state_path), "%s/%s/ports/%d/state", ib_dir_path, hca, port);
293  if (pscanf(state_path, "%d", &state) != 1) {
294  SUBDBG("cannot read state of IB HCA `%s' port %d\n", hca, port);
295  continue;
296  }
297 
298  if (state != 4) {
299  SUBDBG("skipping inactive IB HCA `%s', port %d, state %d\n", hca, port, state);
300  continue;
301  }
302 
303  /* Create dev name (HCA/PORT) and get stats for dev. */
304  SUBDBG("Found IB device `%s', port %d\n", hca, port);
305  ib_device_t *dev = add_ib_device(hca, port);
306  if (!dev)
307  continue;
308  // do we want to check for short counters only if no extended counters found?
309  num_events += find_ib_device_events(dev, 1); // check if we have extended (64bit) counters
310  num_events += find_ib_device_events(dev, 0); // check also for short counters
311  }
312 
313  next_hca:
314  if (ports_dir != NULL)
315  closedir(ports_dir);
316  }
317 
318  if (root_device == 0) // no active devices found
319  {
320  strncpy(_infiniband_vector.cmp_info.disabled_reason,
321  "No active Infiniband ports found", PAPI_MAX_STR_LEN);
322  result = PAPI_ENOIMPL;
323  } else if (num_events == 0)
324  {
325  strncpy(_infiniband_vector.cmp_info.disabled_reason,
326  "No supported Infiniband events found", PAPI_MAX_STR_LEN);
327  result = PAPI_ENOIMPL;
328  } else
329  {
330  // Events are stored in a linked list, in reverse order than how I found them
331  // Revert them again, so that they are in finding order, not that it matters.
332  int i = num_events - 1;
333  // now allocate memory to store the counters into the native table
334  infiniband_native_events = (infiniband_native_event_entry_t*)
337  while (iter != 0)
338  {
339  infiniband_native_events[i].name = iter->ev_name;
340  infiniband_native_events[i].file_name = iter->ev_file_name;
341  infiniband_native_events[i].device = iter->ev_device;
342  infiniband_native_events[i].extended = iter->extended;
343  infiniband_native_events[i].resources.selector = i + 1;
344  infiniband_native_events[i].description =
346 
347  ib_counter_t *tmp = iter;
348  iter = iter->next;
349  papi_free(tmp);
350  -- i;
351  }
352  root_counter = 0;
353  }
354 
355  out:
356  if (ib_dir != NULL)
357  closedir(ib_dir);
358 
359  return (result);
360 }
361 
362 static long long
364 {
365  char ev_file[128];
366  long long value = 0ll;
367  infiniband_native_event_entry_t *iter = &infiniband_native_events[index];
368  snprintf(ev_file, sizeof(ev_file), "%s/%s/ports/%d/counters%s/%s",
369  ib_dir_path, iter->device->dev_name,
370  iter->device->dev_port, (iter->extended?"_ext":""),
371  iter->file_name);
372 
373  if (pscanf(ev_file, "%lld", &value) != 1) {
374  PAPIERROR("cannot read value for counter '%s'\n", iter->name);
375  } else
376  {
377  SUBDBG("Counter '%s': %lld\n", iter->name, value);
378  }
379  return (value);
380 }
381 
382 static void
384 {
385  int i;
386 
387  if (infiniband_native_events)
388  {
389  for (i=0 ; i<num_events ; ++i) {
390  if (infiniband_native_events[i].name)
391  free(infiniband_native_events[i].name);
392  if (infiniband_native_events[i].file_name)
393  free(infiniband_native_events[i].file_name);
394  if (infiniband_native_events[i].description)
395  papi_free(infiniband_native_events[i].description);
396  }
397  papi_free(infiniband_native_events);
398  }
399 
401  while (iter != 0)
402  {
403  if (iter->dev_name)
404  free(iter->dev_name);
405 
406  ib_device_t *tmp = iter;
407  iter = iter->next;
408  papi_free(tmp);
409  }
410  root_device = 0;
411 }
412 
413 /*****************************************************************************
414  ******************* BEGIN PAPI's COMPONENT REQUIRED FUNCTIONS *************
415  *****************************************************************************/
416 
417 /*
418  * This is called whenever a thread is initialized
419  */
420 int
422 {
423  (void) ctx;
424  return PAPI_OK;
425 }
426 
427 
428 /* Initialize hardware counters, setup the function vector table
429  * and get hardware information, this routine is called when the
430  * PAPI process is initialized (IE PAPI_library_init)
431  */
432 int
434 {
435  /* discover Infiniband devices and available events */
436  int result = find_ib_devices();
437 
438  if (result != PAPI_OK) // we couldn't initialize the component
439  {
440  // deallocate any eventually allocated memory
442  }
443 
444  _infiniband_vector.cmp_info.num_native_events = num_events;
445 
446  _infiniband_vector.cmp_info.num_cntrs = num_events;
447  _infiniband_vector.cmp_info.num_mpx_cntrs = num_events;
448 
449 
450  /* Export the component id */
451  _infiniband_vector.cmp_info.CmpIdx = cidx;
452 
453  return (result);
454 }
455 
456 
457 /*
458  * Control of counters (Reading/Writing/Starting/Stopping/Setup)
459  * functions
460  */
461 int
463 {
465  int i;
466 
467  for (i=0 ; i<INFINIBAND_MAX_COUNTERS ; ++i) {
468  control->being_measured[i] = 0;
469  }
470 
471  return PAPI_OK;
472 }
473 
474 /*
475  *
476  */
477 int
479 {
480  infiniband_context_t* context = (infiniband_context_t*) ctx;
482  long long now = PAPI_get_real_usec();
483  int i;
484 
485  for (i=0 ; i<INFINIBAND_MAX_COUNTERS ; ++i) {
486  if (control->being_measured[i] && control->need_difference[i]) {
487  context->start_value[i] = read_ib_counter_value(i);
488  }
489  }
490  control->lastupdate = now;
491 
492  return PAPI_OK;
493 }
494 
495 
496 /*
497  *
498  */
499 int
501 {
502  infiniband_context_t* context = (infiniband_context_t*) ctx;
504  long long now = PAPI_get_real_usec();
505  int i;
506  long long temp;
507 
508  for (i=0 ; i<INFINIBAND_MAX_COUNTERS ; ++i) {
509  if (control->being_measured[i])
510  {
511  temp = read_ib_counter_value(i);
512  if (context->start_value[i] && control->need_difference[i]) {
513  /* Must subtract values, but check for wraparound.
514  * We cannot even detect all wraparound cases. Using the short,
515  * auto-resetting IB counters is error prone.
516  */
517  if (temp < context->start_value[i]) {
518  SUBDBG("Wraparound!\nstart:\t%#016x\ttemp:\t%#016x",
519  (unsigned)context->start_value[i], (unsigned)temp);
520  /* The counters auto-reset. I cannot even adjust them to
521  * account for a simple wraparound.
522  * Just use the current reading of the counter, which is useless.
523  */
524  } else
525  temp -= context->start_value[i];
526  }
527  control->counts[i] = temp;
528  }
529  }
530  control->lastupdate = now;
531 
532  return PAPI_OK;
533 }
534 
535 
536 /*
537  *
538  */
539 int
541  long_long ** events, int flags )
542 {
543  ( void ) flags;
544 
545  _infiniband_stop(ctx, ctl); /* we cannot actually stop the counters */
546  /* Pass back a pointer to our results */
547  *events = ((infiniband_control_state_t*) ctl)->counts;
548 
549  return PAPI_OK;
550 }
551 
552 
553 int
555 {
556  /* Cleanup resources used by this component before leaving */
558 
559  return PAPI_OK;
560 }
561 
562 int
564 {
565  ( void ) ctx;
566 
567  return PAPI_OK;
568 }
569 
570 
571 
572 /* This function sets various options in the component
573  * The valid codes being passed in are PAPI_SET_DEFDOM,
574  * PAPI_SET_DOMAIN, PAPI_SETDEFGRN, PAPI_SET_GRANUL * and PAPI_SET_INHERIT
575  */
576 int
578 {
579  ( void ) ctx;
580  ( void ) code;
581  ( void ) option;
582  return PAPI_OK;
583 }
584 
585 
586 int
588  NativeInfo_t * native,
589  int count,
590  hwd_context_t *ctx )
591 {
592  int i, index;
593  ( void ) ctx;
594 
596 
597  for (i=0 ; i<INFINIBAND_MAX_COUNTERS ; ++i) {
598  control->being_measured[i] = 0;
599  }
600 
601  for (i=0 ; i<count ; ++i) {
602  index = native[i].ni_event & PAPI_NATIVE_AND_MASK;
603  native[i].ni_position =
604  infiniband_native_events[index].resources.selector - 1;
605  control->being_measured[index] = 1;
606  control->need_difference[index] = 1;
607  }
608  return PAPI_OK;
609 }
610 
611 
612 /*
613  * This function has to set the bits needed to count different domains
614  * In particular: PAPI_DOM_USER, PAPI_DOM_KERNEL PAPI_DOM_OTHER
615  * By default return PAPI_EINVAL if none of those are specified
616  * and PAPI_OK with success
617  * PAPI_DOM_USER is only user context is counted
618  * PAPI_DOM_KERNEL is only the Kernel/OS context is counted
619  * PAPI_DOM_OTHER is Exception/transient mode (like user TLB misses)
620  * PAPI_DOM_ALL is all of the domains
621  */
622 int
624 {
625  int found = 0;
626  (void) ctl;
627 
628  if (PAPI_DOM_USER & domain)
629  found = 1;
630 
631  if (PAPI_DOM_KERNEL & domain)
632  found = 1;
633 
634  if (PAPI_DOM_OTHER & domain)
635  found = 1;
636 
637  if (!found)
638  return (PAPI_EINVAL);
639 
640  return (PAPI_OK);
641 }
642 
643 
644 /*
645  * Cannot reset the counters using the sysfs interface.
646  */
647 int
649 {
650  (void) ctx;
651  (void) ctl;
652  return PAPI_OK;
653 }
654 
655 
656 /*
657  * Native Event functions
658  */
659 int
660 _infiniband_ntv_enum_events( unsigned int *EventCode, int modifier )
661 {
662  switch (modifier) {
663  case PAPI_ENUM_FIRST:
664  if (num_events == 0)
665  return (PAPI_ENOEVNT);
666 
667  *EventCode = 0;
668  return PAPI_OK;
669 
670  case PAPI_ENUM_EVENTS:
671  {
672  int index = *EventCode & PAPI_NATIVE_AND_MASK;
673 
674  if (index < num_events - 1) {
675  *EventCode = *EventCode + 1;
676  return PAPI_OK;
677  } else
678  return PAPI_ENOEVNT;
679 
680  break;
681  }
682  default:
683  return PAPI_EINVAL;
684  }
685  return PAPI_EINVAL;
686 }
687 
688 /*
689  *
690  */
691 int
692 _infiniband_ntv_code_to_name( unsigned int EventCode, char *name, int len )
693 {
694  int index = EventCode;
695 
696  if (index>=0 && index<num_events) {
697  strncpy( name, infiniband_native_events[index].name, len );
698  }
699 
700  return PAPI_OK;
701 }
702 
703 /*
704  *
705  */
706 int
707 _infiniband_ntv_code_to_descr( unsigned int EventCode, char *name, int len )
708 {
709  int index = EventCode;
710 
711  if (index>=0 && index<num_events) {
712  strncpy(name, infiniband_native_events[index].description, len);
713  }
714  return PAPI_OK;
715 }
716 
717 int
718 _infiniband_ntv_code_to_info(unsigned int EventCode, PAPI_event_info_t *info)
719 {
720  int index = EventCode;
721 
722  if ( ( index < 0) || (index >= num_events )) return PAPI_ENOEVNT;
723 
724  if (infiniband_native_events[index].name)
725  {
726  unsigned int len = strlen(infiniband_native_events[index].name);
727  if (len > sizeof(info->symbol)-1) len = sizeof(info->symbol)-1;
728  strncpy(info->symbol, infiniband_native_events[index].name, len);
729  info->symbol[len] = '\0';
730  }
731  if (infiniband_native_events[index].description)
732  {
733  unsigned int len = strlen(infiniband_native_events[index].description);
734  if (len > sizeof(info->long_descr)-1) len = sizeof(info->long_descr)-1;
735  strncpy(info->long_descr, infiniband_native_events[index].description, len);
736  info->long_descr[len] = '\0';
737  }
738 
739  strncpy(info->units, "\0", 1);
740  /* infiniband_native_events[index].units, sizeof(info->units)); */
741 
742 /* info->data_type = infiniband_native_events[index].return_type;
743  */
744  return PAPI_OK;
745 }
746 
747 
748 /*
749  *
750  */
751 papi_vector_t _infiniband_vector = {
752  .cmp_info = {
753  /* component information (unspecified values are initialized to 0) */
754  .name = "infiniband",
755  .short_name = "infiniband",
756  .version = "5.3.0",
757  .description = "Linux Infiniband statistics using the sysfs interface",
758  .num_mpx_cntrs = INFINIBAND_MAX_COUNTERS,
759  .num_cntrs = INFINIBAND_MAX_COUNTERS,
760  .default_domain = PAPI_DOM_USER | PAPI_DOM_KERNEL,
761  .available_domains = PAPI_DOM_USER | PAPI_DOM_KERNEL,
762  .default_granularity = PAPI_GRN_SYS,
763  .available_granularities = PAPI_GRN_SYS,
764  .hardware_intr_sig = PAPI_INT_SIGNAL,
765 
766  /* component specific cmp_info initializations */
767  .fast_real_timer = 0,
768  .fast_virtual_timer = 0,
769  .attach = 0,
770  .attach_must_ptrace = 0,
771  },
772 
773  /* sizes of framework-opaque component-private structures */
774  .size = {
775  .context = sizeof (infiniband_context_t),
776  .control_state = sizeof (infiniband_control_state_t),
777  .reg_value = sizeof (infiniband_register_t),
778  /* .reg_alloc = sizeof (infiniband_reg_alloc_t), */
779  },
780  /* function pointers in this component */
781  .init_thread = _infiniband_init_thread,
782  .init_component = _infiniband_init_component,
783  .init_control_state = _infiniband_init_control_state,
787  .shutdown_thread = _infiniband_shutdown_thread,
788  .shutdown_component = _infiniband_shutdown_component,
789  .ctl = _infiniband_ctl,
790  .update_control_state = _infiniband_update_control_state,
792  .reset = _infiniband_reset,
793 
794  .ntv_enum_events = _infiniband_ntv_enum_events,
795  .ntv_code_to_name = _infiniband_ntv_code_to_name,
796  .ntv_code_to_descr = _infiniband_ntv_code_to_descr,
797  .ntv_code_to_info = _infiniband_ntv_code_to_info,
798 };
int _infiniband_stop(hwd_context_t *ctx, hwd_control_state_t *ctl)
char name[PAPI_MAX_STR_LEN]
Definition: papi.h:626
#define PAPI_ENOEVNT
Definition: papi.h:258
int atoi()
ssize_t read(int fd, void *buf, size_t count)
Definition: appio.c:225
static infiniband_native_event_entry_t * infiniband_native_events
int _infiniband_ntv_code_to_descr(unsigned int EventCode, char *name, int len)
static void deallocate_infiniband_resources()
long long flags
Definition: iozone.c:12330
#define papi_free(a)
Definition: papi_memory.h:35
char * name
start
Definition: iozone.c:22736
static long long read_ib_counter_value(int index)
int _infiniband_ntv_enum_events(unsigned int *EventCode, int modifier)
#define PAPI_ENOSUPP
Definition: papi.h:269
static int num_events
#define PAPI_DOM_KERNEL
Definition: papi.h:298
char long_descr[PAPI_HUGE_STR_LEN]
Definition: papi.h:966
int _infiniband_shutdown_component(void)
infiniband_control_state_t state
static const char * ib_dir_path
char symbol[PAPI_HUGE_STR_LEN]
Definition: papi.h:963
int _infiniband_set_domain(hwd_control_state_t *ctl, int domain)
infiniband_register_t resources
int _infiniband_ntv_code_to_name(unsigned int EventCode, char *name, int len)
return PAPI_OK
Definition: linux-nvml.c:458
int count
Definition: iozone.c:22422
#define PAPI_DOM_USER
Definition: papi.h:296
int _infiniband_start(hwd_context_t *ctx, hwd_control_state_t *ctl)
void
Definition: iozone.c:18627
return PAPI_EINVAL
Definition: linux-nvml.c:408
PAPI_component_info_t cmp_info
Definition: papi_vector.h:20
int _infiniband_read(hwd_context_t *ctx, hwd_control_state_t *ctl, long_long **events, int flags)
char * description
ib_device_t * device
int _infiniband_shutdown_thread(hwd_context_t *ctx)
void double value
Definition: iozone.c:18781
static int find_ib_device_events(ib_device_t *dev, int extended)
Return codes and api definitions.
char events[MAX_EVENTS][BUFSIZ]
static ib_counter_t * add_ib_counter(const char *name, const char *file_name, int extended, ib_device_t *device)
int extended
char disabled_reason[PAPI_MAX_STR_LEN]
Definition: papi.h:633
int _infiniband_init_thread(hwd_context_t *ctx)
long iter[MAX_THREADS]
int i
Definition: fileop.c:140
int _infiniband_reset(hwd_context_t *ctx, hwd_control_state_t *ctl)
static int set_domain(hwd_control_state_t *cntrl, unsigned int domain)
int _infiniband_ctl(hwd_context_t *ctx, int code, _papi_int_option_t *option)
int _infiniband_init_component(int cidx)
static ib_device_t * root_device
static char * make_ib_event_description(const char *input_str, int extended)
long long found
Definition: libasync.c:735
free(dummyfile[xx])
static int cidx
Definition: event_info.c:40
static int native
Definition: event_info.c:39
stop
Definition: iozone.c:22741
#define SUBDBG(format, args...)
Definition: papi_debug.h:63
char * port
Definition: iozone.c:1620
void PAPIERROR(char *format,...)
#define PAPI_INT_SIGNAL
Definition: papi_internal.h:53
char * file_name
int _infiniband_update_control_state(hwd_control_state_t *ctl, NativeInfo_t *native, int count, hwd_context_t *ctx)
#define PAPI_ENOIMPL
Definition: papi.h:270
struct _ib_counter_type * next
goto out
Definition: pscanf.h:20
long long counts[INFINIBAND_MAX_COUNTERS]
long long PAPI_get_real_usec(void)
Definition: papi.c:6190
static DeviceData_t * device
Definition: linux-cuda.h:155
char * name
Definition: iozone.c:23648
static int find_ib_devices()
static ib_counter_t * root_counter
int temp
Definition: iozone.c:22158
#define long_long
Definition: papi.h:550
child_idents[x-1] state
Definition: iozone.c:21341
#define PAPI_NATIVE_AND_MASK
static ib_device_t * add_ib_device(const char *name, int port)
int being_measured[INFINIBAND_MAX_COUNTERS]
ib_device_t * ev_device
#define PAPI_MAX_STR_LEN
Definition: papi.h:463
#define PAPI_DOM_OTHER
Definition: papi.h:299
struct _ib_device_type * next
int need_difference[INFINIBAND_MAX_COUNTERS]
#define PAPI_GRN_SYS
Definition: papi.h:364
long long tmp
Definition: iozone.c:12031
papi_vector_t _infiniband_vector
long long start_value[INFINIBAND_MAX_COUNTERS]
int _infiniband_ntv_code_to_info(unsigned int EventCode, PAPI_event_info_t *info)
char units[PAPI_MIN_STR_LEN]
Definition: papi.h:972
int _infiniband_init_control_state(hwd_control_state_t *ctl)
#define papi_calloc(a, b)
Definition: papi_memory.h:37
#define INFINIBAND_MAX_COUNTERS