PAPI  5.4.0.0
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
linux-L2unit.c
Go to the documentation of this file.
1 /****************************/
2 /* THIS IS OPEN SOURCE CODE */
3 /****************************/
4 
20 #include "linux-L2unit.h"
21 
22 /* Declare our vector in advance */
24 
25 /* prototypes */
26 void user_signal_handler_L2UNIT( int hEvtSet, uint64_t address, uint64_t ovfVector, const ucontext_t *pContext );
27 
28 /*****************************************************************************
29  ******************* BEGIN PAPI's COMPONENT REQUIRED FUNCTIONS *************
30  *****************************************************************************/
31 
32 /*
33  * This is called whenever a thread is initialized
34  */
35 int
37 {
38 #ifdef DEBUG_BGQ
39  printf( "L2UNIT_init_thread\n" );
40 #endif
41 
42  ( void ) ctx;
43  return PAPI_OK;
44 }
45 
46 
47 /* Initialize hardware counters, setup the function vector table
48  * and get hardware information, this routine is called when the
49  * PAPI process is initialized (IE PAPI_library_init)
50  */
51 int
53 {
54 #ifdef DEBUG_BGQ
55  printf( "L2UNIT_init_component\n" );
56 #endif
57 
58  _L2unit_vector.cmp_info.CmpIdx = cidx;
59 #ifdef DEBUG_BGQ
60  printf( "L2UNIT_init_component cidx = %d\n", cidx );
61 #endif
62 
63  return ( PAPI_OK );
64 }
65 
66 
67 /*
68  * Control of counters (Reading/Writing/Starting/Stopping/Setup)
69  * functions
70  */
71 int
73 {
74 #ifdef DEBUG_BGQ
75  printf( "L2UNIT_init_control_state\n" );
76 #endif
77  int retval;
78 
79  L2UNIT_control_state_t * this_state = ( L2UNIT_control_state_t * ) ptr;
80 
81  this_state->EventGroup = Bgpm_CreateEventSet();
82  retval = _check_BGPM_error( this_state->EventGroup, "Bgpm_CreateEventSet" );
83  if ( retval < 0 ) return retval;
84 
85  // initialize overflow flag to OFF (0)
86  this_state->overflow = 0;
87  this_state->overflow_count = 0;
88  // initialized BGPM eventGroup flag to NOT applied yet (0)
89  this_state->bgpm_eventset_applied = 0;
90 
91  return PAPI_OK;
92 }
93 
94 
95 /*
96  *
97  */
98 int
100 {
101 #ifdef DEBUG_BGQ
102  printf( "L2UNIT_start\n" );
103 #endif
104  ( void ) ctx;
105  int retval;
106  L2UNIT_control_state_t * this_state = ( L2UNIT_control_state_t * ) ptr;
107 
108  retval = Bgpm_Apply( this_state->EventGroup );
109  retval = _check_BGPM_error( retval, "Bgpm_Apply" );
110  if ( retval < 0 ) return retval;
111 
112  // set flag to 1: BGPM eventGroup HAS BEEN applied
113  this_state->bgpm_eventset_applied = 1;
114 
115  /* Bgpm_Apply() does an implicit reset;
116  hence no need to use Bgpm_ResetStart */
117  retval = Bgpm_Start( this_state->EventGroup );
118  retval = _check_BGPM_error( retval, "Bgpm_Start" );
119  if ( retval < 0 ) return retval;
120 
121  return ( PAPI_OK );
122 }
123 
124 
125 /*
126  *
127  */
128 int
130 {
131 #ifdef DEBUG_BGQ
132  printf( "L2UNIT_stop\n" );
133 #endif
134  ( void ) ctx;
135  int retval;
136  L2UNIT_control_state_t * this_state = ( L2UNIT_control_state_t * ) ptr;
137 
138  retval = Bgpm_Stop( this_state->EventGroup );
139  retval = _check_BGPM_error( retval, "Bgpm_Stop" );
140  if ( retval < 0 ) return retval;
141 
142  return ( PAPI_OK );
143 }
144 
145 
146 /*
147  *
148  */
149 int
151  long_long ** events, int flags )
152 {
153 #ifdef DEBUG_BGQ
154  printf( "L2UNIT_read\n" );
155 #endif
156  ( void ) ctx;
157  ( void ) flags;
158  int i, numEvts;
159  L2UNIT_control_state_t * this_state = ( L2UNIT_control_state_t * ) ptr;
160 
161  numEvts = Bgpm_NumEvents( this_state->EventGroup );
162  if ( numEvts == 0 ) {
163 #ifdef DEBUG_BGPM
164  printf ("Error: ret value is %d for BGPM API function Bgpm_NumEvents.\n", numEvts );
165 #endif
166  //return ( EXIT_FAILURE );
167  }
168 
169  for ( i = 0; i < numEvts; i++ )
170  this_state->counters[i] = _common_getEventValue( i, this_state->EventGroup );
171 
172  *events = this_state->counters;
173 
174  return ( PAPI_OK );
175 }
176 
177 
178 /*
179  *
180  */
181 int
183 {
184 #ifdef DEBUG_BGQ
185  printf( "L2UNIT_shutdown_thread\n" );
186 #endif
187 
188  ( void ) ctx;
189  return ( PAPI_OK );
190 }
191 
192 
193 
194 
195 /*
196  * user_signal_handler
197  *
198  * This function is used when hardware overflows are working or when
199  * software overflows are forced
200  */
201 void
202 user_signal_handler_L2UNIT( int hEvtSet, uint64_t address, uint64_t ovfVector, const ucontext_t *pContext )
203 {
204 #ifdef DEBUG_BGQ
205  printf( "user_signal_handler_L2UNIT\n" );
206 #endif
207  ( void ) address;
208  int retval;
209  unsigned i;
210  int isHardware = 1;
211  int cidx = _L2unit_vector.cmp_info.CmpIdx;
212  long_long overflow_bit = 0;
213  caddr_t address1;
215  ctx.ucontext = ( hwd_ucontext_t * ) pContext;
217  EventSetInfo_t *ESI;
218  ESI = thread->running_eventset[cidx];
219  // Get the indices of all events which have overflowed.
220  unsigned ovfIdxs[BGPM_MAX_OVERFLOW_EVENTS];
221  unsigned len = BGPM_MAX_OVERFLOW_EVENTS;
222 
223  retval = Bgpm_GetOverflowEventIndices( hEvtSet, ovfVector, ovfIdxs, &len );
224  if ( retval < 0 ) {
225 #ifdef DEBUG_BGPM
226  printf ( "Error: ret value is %d for BGPM API function Bgpm_GetOverflowEventIndices.\n",
227  retval );
228 #endif
229  return;
230  }
231 
232  if ( thread == NULL ) {
233  PAPIERROR( "thread == NULL in user_signal_handler!" );
234  return;
235  }
236 
237  if ( ESI == NULL ) {
238  PAPIERROR( "ESI == NULL in user_signal_handler!");
239  return;
240  }
241 
242  if ( ESI->overflow.flags == 0 ) {
243  PAPIERROR( "ESI->overflow.flags == 0 in user_signal_handler!");
244  return;
245  }
246 
247  for ( i = 0; i < len; i++ ) {
248  uint64_t hProf;
249  Bgpm_GetEventUser1( hEvtSet, ovfIdxs[i], &hProf );
250  if ( hProf ) {
251  overflow_bit ^= 1 << ovfIdxs[i];
252  break;
253  }
254 
255  }
256 
257  if ( ESI->overflow.flags & PAPI_OVERFLOW_FORCE_SW ) {
258 #ifdef DEBUG_BGQ
259  printf("OVERFLOW_SOFTWARE\n");
260 #endif
261  address1 = GET_OVERFLOW_ADDRESS( ctx );
262  _papi_hwi_dispatch_overflow_signal( ( void * ) &ctx, address1, NULL, 0, 0, &thread, cidx );
263  return;
264  }
265  else if ( ESI->overflow.flags & PAPI_OVERFLOW_HARDWARE ) {
266 #ifdef DEBUG_BGQ
267  printf("OVERFLOW_HARDWARE\n");
268 #endif
269  address1 = GET_OVERFLOW_ADDRESS( ctx );
270  _papi_hwi_dispatch_overflow_signal( ( void * ) &ctx, address1, &isHardware, overflow_bit, 0, &thread, cidx );
271  }
272  else {
273 #ifdef DEBUG_BGQ
274  printf("OVERFLOW_NONE\n");
275 #endif
276  PAPIERROR( "ESI->overflow.flags is set to something other than PAPI_OVERFLOW_HARDWARE or PAPI_OVERFLOW_FORCE_SW (%#x)", thread->running_eventset[cidx]->overflow.flags);
277  }
278 }
279 
280 
281 /*
282  * Set Overflow
283  *
284  * This is commented out in BG/L/P - need to explore and complete...
285  * However, with true 64-bit counters in BG/Q and all counters for PAPI
286  * always starting from a true zero (we don't allow write...), the possibility
287  * for overflow is remote at best...
288  */
289 int
290 L2UNIT_set_overflow( EventSetInfo_t * ESI, int EventIndex, int threshold )
291 {
292 #ifdef DEBUG_BGQ
293  printf("BEGIN L2UNIT_set_overflow\n");
294 #endif
295  L2UNIT_control_state_t * this_state = ( L2UNIT_control_state_t * ) ESI->ctl_state;
296  int retval;
297  int evt_idx;
298 
299  /*
300  * In case an BGPM eventGroup HAS BEEN applied or attached before
301  * overflow is set, delete the eventGroup and create an new empty one,
302  * and rebuild as it was prior to deletion
303  */
304 #ifdef DEBUG_BGQ
305  printf( "L2UNIT_set_overflow: bgpm_eventset_applied = %d, threshold = %d\n",
306  this_state->bgpm_eventset_applied, threshold );
307 #endif
308  if ( 1 == this_state->bgpm_eventset_applied && 0 != threshold ) {
309  retval = _common_deleteRecreate( &this_state->EventGroup );
310  if ( retval < 0 ) return retval;
311  retval = _common_rebuildEventgroup( this_state->count,
312  this_state->EventGroup_local,
313  &this_state->EventGroup );
314  if ( retval < 0 ) return retval;
315 
316  /* set BGPM eventGroup flag back to NOT applied yet (0)
317  * because the eventGroup has been recreated from scratch */
318  this_state->bgpm_eventset_applied = 0;
319  }
320 
321  evt_idx = ESI->EventInfoArray[EventIndex].pos[0];
322  SUBDBG( "Hardware counter %d (vs %d) used in overflow, threshold %d\n",
323  evt_idx, EventIndex, threshold );
324 #ifdef DEBUG_BGQ
325  printf( "Hardware counter %d (vs %d) used in overflow, threshold %d\n",
326  evt_idx, EventIndex, threshold );
327 #endif
328  /* If this counter isn't set to overflow, it's an error */
329  if ( threshold == 0 ) {
330  /* Remove the signal handler */
332  if ( retval != PAPI_OK )
333  return ( retval );
334  }
335  else {
336  this_state->overflow = 1;
337  this_state->overflow_count++;
338  this_state->overflow_list[this_state->overflow_count-1].threshold = threshold;
339  this_state->overflow_list[this_state->overflow_count-1].EventIndex = evt_idx;
340 
341 #ifdef DEBUG_BGQ
342  printf( "L2UNIT_set_overflow: Enable the signal handler\n" );
343 #endif
344  /* Enable the signal handler */
346  NEED_CONTEXT,
347  _L2unit_vector.cmp_info.CmpIdx );
348  if ( retval != PAPI_OK )
349  return ( retval );
350 
352  this_state->overflow_list[this_state->overflow_count-1].EventIndex,
353  this_state->overflow_list[this_state->overflow_count-1].threshold,
355  if ( retval < 0 ) return retval;
356  }
357 
358  return ( PAPI_OK );
359 }
360 
361 
362 
363 /* This function sets various options in the component
364  * The valid codes being passed in are PAPI_SET_DEFDOM,
365  * PAPI_SET_DOMAIN, PAPI_SETDEFGRN, PAPI_SET_GRANUL * and PAPI_SET_INHERIT
366  */
367 int
368 L2UNIT_ctl( hwd_context_t * ctx, int code, _papi_int_option_t * option )
369 {
370 #ifdef DEBUG_BGQ
371  printf( "L2UNIT_ctl\n" );
372 #endif
373 
374  ( void ) ctx;
375  ( void ) code;
376  ( void ) option;
377  return ( PAPI_OK );
378 }
379 
380 
381 /*
382  * PAPI Cleanup Eventset
383  * Destroy and re-create the BGPM / L2unit EventSet
384  */
385 int
387 {
388 #ifdef DEBUG_BGQ
389  printf( "L2UNIT_cleanup_eventset\n" );
390 #endif
391  int retval;
392 
393  L2UNIT_control_state_t * this_state = ( L2UNIT_control_state_t * ) ctrl;
394 
395  // create a new empty bgpm eventset
396  // reason: bgpm doesn't permit to remove events from an eventset;
397  // hence we delete the old eventset and create a new one
398  retval = _common_deleteRecreate( &this_state->EventGroup );
399  if ( retval < 0 ) return retval;
400 
401  // set overflow flag to OFF (0)
402  this_state->overflow = 0;
403  this_state->overflow_count = 0;
404  // set BGPM eventGroup flag back to NOT applied yet (0)
405  this_state->bgpm_eventset_applied = 0;
406 
407  return ( PAPI_OK );
408 }
409 
410 
411 /*
412  *
413  */
414 int
416  NativeInfo_t * native, int count,
417  hwd_context_t * ctx )
418 {
419 #ifdef DEBUG_BGQ
420  printf( "L2UNIT_update_control_state: count = %d\n", count );
421 #endif
422 
423  ( void ) ctx;
424  int retval, index, i, k;
425  L2UNIT_control_state_t * this_state = ( L2UNIT_control_state_t * ) ptr;
426 
427  // Delete and re-create BGPM eventset
428  retval = _common_deleteRecreate( &this_state->EventGroup );
429  if ( retval < 0 ) return retval;
430 
431 #ifdef DEBUG_BGQ
432  printf( "L2UNIT_update_control_state: EventGroup=%d, overflow = %d\n",
433  this_state->EventGroup, this_state->overflow );
434 #endif
435 
436 
437  // otherwise, add the events to the eventset
438  for ( i = 0; i < count; i++ ) {
439  index = ( native[i].ni_event ) + OFFSET;
440 
441  native[i].ni_position = i;
442 
443 #ifdef DEBUG_BGQ
444  printf("L2UNIT_update_control_state: ADD event: i = %d, index = %d\n", i, index );
445 #endif
446 
447  this_state->EventGroup_local[i] = index;
448 
449 
450  /* Add events to the BGPM eventGroup */
451  retval = Bgpm_AddEvent( this_state->EventGroup, index );
452  retval = _check_BGPM_error( retval, "Bgpm_AddEvent" );
453  if ( retval < 0 ) return retval;
454  }
455 
456  // store how many events we added to an EventSet
457  this_state->count = count;
458 
459  // since update_control_state trashes overflow settings, this puts things
460  // back into balance for BGPM
461  if ( 1 == this_state->overflow ) {
462  for ( k = 0; k < this_state->overflow_count; k++ ) {
463  retval = _common_set_overflow_BGPM( this_state->EventGroup,
464  this_state->overflow_list[k].EventIndex,
465  this_state->overflow_list[k].threshold,
467  if ( retval < 0 ) return retval;
468  }
469  }
470 
471  return ( PAPI_OK );
472 }
473 
474 
475 /*
476  * This function has to set the bits needed to count different domains
477  * In particular: PAPI_DOM_USER, PAPI_DOM_KERNEL PAPI_DOM_OTHER
478  * By default return PAPI_EINVAL if none of those are specified
479  * and PAPI_OK with success
480  * PAPI_DOM_USER is only user context is counted
481  * PAPI_DOM_KERNEL is only the Kernel/OS context is counted
482  * PAPI_DOM_OTHER is Exception/transient mode (like user TLB misses)
483  * PAPI_DOM_ALL is all of the domains
484  */
485 int
487 {
488 #ifdef DEBUG_BGQ
489  printf( "L2UNIT_set_domain\n" );
490 #endif
491  int found = 0;
492  ( void ) cntrl;
493 
494  if ( PAPI_DOM_USER & domain )
495  found = 1;
496 
497  if ( PAPI_DOM_KERNEL & domain )
498  found = 1;
499 
500  if ( PAPI_DOM_OTHER & domain )
501  found = 1;
502 
503  if ( !found )
504  return ( PAPI_EINVAL );
505 
506  return ( PAPI_OK );
507 }
508 
509 
510 /*
511  *
512  */
513 int
515 {
516 #ifdef DEBUG_BGQ
517  printf( "L2UNIT_reset\n" );
518 #endif
519  ( void ) ctx;
520  int retval;
521  L2UNIT_control_state_t * this_state = ( L2UNIT_control_state_t * ) ptr;
522 
523  /* we can't simply call Bgpm_Reset() since PAPI doesn't have the
524  restriction that an EventSet has to be stopped before resetting is
525  possible. However, BGPM does have this restriction.
526  Hence we need to stop, reset and start */
527  retval = Bgpm_Stop( this_state->EventGroup );
528  retval = _check_BGPM_error( retval, "Bgpm_Stop" );
529  if ( retval < 0 ) return retval;
530 
531  retval = Bgpm_ResetStart( this_state->EventGroup );
532  retval = _check_BGPM_error( retval, "Bgpm_ResetStart" );
533  if ( retval < 0 ) return retval;
534 
535  return ( PAPI_OK );
536 }
537 
538 
539 /*
540  * Native Event functions
541  */
542 int
543 L2UNIT_ntv_enum_events( unsigned int *EventCode, int modifier )
544 {
545 #ifdef DEBUG_BGQ
546  //printf( "L2UNIT_ntv_enum_events, EventCode = %#x\n", *EventCode );
547 #endif
548 
549  switch ( modifier ) {
550  case PAPI_ENUM_FIRST:
551  *EventCode = 0;
552 
553  return ( PAPI_OK );
554  break;
555 
556  case PAPI_ENUM_EVENTS:
557  {
558  int index = ( *EventCode ) + OFFSET;
559 
560  if ( index < L2UNIT_MAX_EVENTS ) {
561  *EventCode = *EventCode + 1;
562  return ( PAPI_OK );
563  } else
564  return ( PAPI_ENOEVNT );
565 
566  break;
567  }
568  default:
569  return ( PAPI_EINVAL );
570  }
571  return ( PAPI_EINVAL );
572 }
573 
574 
575 /*
576  *
577  */
578 int
579 L2UNIT_ntv_name_to_code( char *name, unsigned int *event_code )
580 {
581 #ifdef DEBUG_BGQ
582  printf( "L2UNIT_ntv_name_to_code\n" );
583 #endif
584  int ret;
585 
586  /* Return event id matching a given event label string */
587  ret = Bgpm_GetEventIdFromLabel ( name );
588 
589  if ( ret <= 0 ) {
590 #ifdef DEBUG_BGPM
591  printf ("Error: ret value is %d for BGPM API function '%s'.\n",
592  ret, "Bgpm_GetEventIdFromLabel" );
593 #endif
594  return PAPI_ENOEVNT;
595  }
596  else if ( ret < OFFSET || ret > L2UNIT_MAX_EVENTS ) // not a L2Unit event
597  return PAPI_ENOEVNT;
598  else
599  *event_code = ( ret - OFFSET );
600 
601  return PAPI_OK;
602 }
603 
604 
605 /*
606  *
607  */
608 int
609 L2UNIT_ntv_code_to_name( unsigned int EventCode, char *name, int len )
610 {
611 #ifdef DEBUG_BGQ
612  //printf( "L2UNIT_ntv_code_to_name\n" );
613 #endif
614  int index;
615 
616  index = ( EventCode ) + OFFSET;
617 
618  if ( index >= MAX_COUNTERS )
619  return PAPI_ENOEVNT;
620 
621  strncpy( name, Bgpm_GetEventIdLabel( index ), len );
622 
623  if ( name == NULL ) {
624 #ifdef DEBUG_BGPM
625  printf ("Error: ret value is NULL for BGPM API function Bgpm_GetEventIdLabel.\n" );
626 #endif
627  return PAPI_ENOEVNT;
628  }
629 
630  return ( PAPI_OK );
631 }
632 
633 
634 /*
635  *
636  */
637 int
638 L2UNIT_ntv_code_to_descr( unsigned int EventCode, char *name, int len )
639 {
640 #ifdef DEBUG_BGQ
641  //printf( "L2UNIT_ntv_code_to_descr\n" );
642 #endif
643  int retval, index;
644 
645  index = ( EventCode ) + OFFSET;
646 
647  retval = Bgpm_GetLongDesc( index, name, &len );
648  retval = _check_BGPM_error( retval, "Bgpm_GetLongDesc" );
649  if ( retval < 0 ) return retval;
650 
651  return ( PAPI_OK );
652 }
653 
654 
655 /*
656  *
657  */
658 int
659 L2UNIT_ntv_code_to_bits( unsigned int EventCode, hwd_register_t * bits )
660 {
661 #ifdef DEBUG_BGQ
662  printf( "L2UNIT_ntv_code_to_bits\n" );
663 #endif
664  ( void ) EventCode;
665  ( void ) bits;
666  return ( PAPI_OK );
667 }
668 
669 
670 /*
671  *
672  */
673 papi_vector_t _L2unit_vector = {
674  .cmp_info = {
675  /* default component information (unspecified values are initialized to 0) */
676  .name = "bgpm/L2Unit",
677  .short_name = "L2Unit",
678  .description = "Blue Gene/Q L2Unit component",
679  .num_cntrs = L2UNIT_MAX_COUNTERS,
680  .num_native_events = L2UNIT_MAX_EVENTS-OFFSET+1,
681  .num_mpx_cntrs = L2UNIT_MAX_COUNTERS,
682  .default_domain = PAPI_DOM_USER,
683  .available_domains = PAPI_DOM_USER | PAPI_DOM_KERNEL,
684  .default_granularity = PAPI_GRN_THR,
685  .available_granularities = PAPI_GRN_THR,
686 
687  .hardware_intr_sig = PAPI_INT_SIGNAL,
688  .hardware_intr = 1,
689 
690  .kernel_multiplex = 0,
691 
692  /* component specific cmp_info initializations */
693  .fast_real_timer = 0,
694  .fast_virtual_timer = 0,
695  .attach = 0,
696  .attach_must_ptrace = 0,
697  }
698  ,
699 
700  /* sizes of framework-opaque component-private structures */
701  .size = {
702  .context = sizeof ( L2UNIT_context_t ),
703  .control_state = sizeof ( L2UNIT_control_state_t ),
704  .reg_value = sizeof ( L2UNIT_register_t ),
705  .reg_alloc = sizeof ( L2UNIT_reg_alloc_t ),
706  }
707  ,
708  /* function pointers in this component */
709  .init_thread = L2UNIT_init_thread,
710  .init_component = L2UNIT_init_component,
711  .init_control_state = L2UNIT_init_control_state,
712  .start = L2UNIT_start,
713  .stop = L2UNIT_stop,
714  .read = L2UNIT_read,
715  .shutdown_thread = L2UNIT_shutdown_thread,
716  .set_overflow = L2UNIT_set_overflow,
717  .cleanup_eventset = L2UNIT_cleanup_eventset,
718  .ctl = L2UNIT_ctl,
719 
720  .update_control_state = L2UNIT_update_control_state,
721  .set_domain = L2UNIT_set_domain,
722  .reset = L2UNIT_reset,
723 
724  .ntv_name_to_code = L2UNIT_ntv_name_to_code,
725  .ntv_enum_events = L2UNIT_ntv_enum_events,
726  .ntv_code_to_name = L2UNIT_ntv_code_to_name,
727  .ntv_code_to_descr = L2UNIT_ntv_code_to_descr,
728  .ntv_code_to_bits = L2UNIT_ntv_code_to_bits
729 };
char name[PAPI_MAX_STR_LEN]
Definition: papi.h:626
#define PAPI_ENOEVNT
Definition: papi.h:258
int L2UNIT_init_control_state(hwd_control_state_t *ptr)
Definition: linux-L2unit.c:72
int L2UNIT_ctl(hwd_context_t *ctx, int code, _papi_int_option_t *option)
Definition: linux-L2unit.c:368
L2UNIT_overflow_t overflow_list[512]
Definition: linux-L2unit.h:69
#define L2UNIT_MAX_COUNTERS
Definition: linux-L2unit.h:35
long long flags
Definition: iozone.c:12330
int L2UNIT_ntv_name_to_code(char *name, unsigned int *event_code)
Definition: linux-L2unit.c:579
#define PAPI_DOM_KERNEL
Definition: papi.h:298
int _common_deleteRecreate(int *EventGroup_ptr)
int _check_BGPM_error(int err, char *bgpmfunc)
#define MAX_COUNTERS
Definition: perfctr-x86.h:8
return PAPI_OK
Definition: linux-nvml.c:458
int count
Definition: iozone.c:22422
int L2UNIT_shutdown_thread(hwd_context_t *ctx)
Definition: linux-L2unit.c:182
int L2UNIT_update_control_state(hwd_control_state_t *ptr, NativeInfo_t *native, int count, hwd_context_t *ctx)
Definition: linux-L2unit.c:415
#define PAPI_DOM_USER
Definition: papi.h:296
void
Definition: iozone.c:18627
int L2UNIT_init_thread(hwd_context_t *ctx)
Definition: linux-L2unit.c:36
return PAPI_EINVAL
Definition: linux-nvml.c:408
PAPI_component_info_t cmp_info
Definition: papi_vector.h:20
#define printf
Definition: papi_test.h:125
This file has the source code for a component that enables PAPI-C to access hardware monitoring count...
int L2UNIT_start(hwd_context_t *ctx, hwd_control_state_t *ptr)
Definition: linux-L2unit.c:99
int L2UNIT_init_component(int cidx)
Definition: linux-L2unit.c:52
char events[MAX_EVENTS][BUFSIZ]
long long ret
Definition: iozone.c:1346
int L2UNIT_ntv_code_to_bits(unsigned int EventCode, hwd_register_t *bits)
Definition: linux-L2unit.c:659
int L2UNIT_ntv_code_to_descr(unsigned int EventCode, char *name, int len)
Definition: linux-L2unit.c:638
int i
Definition: fileop.c:140
EventSetOverflowInfo_t overflow
#define PAPI_OVERFLOW_HARDWARE
Definition: papi.h:410
int L2UNIT_set_domain(hwd_control_state_t *cntrl, int domain)
Definition: linux-L2unit.c:486
int L2UNIT_reset(hwd_context_t *ctx, hwd_control_state_t *ptr)
Definition: linux-L2unit.c:514
long long found
Definition: libasync.c:735
int k
Definition: iozone.c:19136
static int cidx
Definition: event_info.c:40
int _common_rebuildEventgroup(int count, int *EventGroup_local, int *EventGroup_ptr)
papi_vector_t _L2unit_vector
Definition: linux-L2unit.c:23
hwd_ucontext_t * ucontext
static int native
Definition: event_info.c:39
void * thread(void *arg)
Definition: kufrin.c:31
#define OFFSET
Definition: linux-CNKunit.h:36
#define SUBDBG(format, args...)
Definition: papi_debug.h:63
void PAPIERROR(char *format,...)
int _papi_hwi_start_signal(int signal, int need_context, int cidx)
Definition: extras.c:401
long_long _common_getEventValue(unsigned event_id, int EventGroup)
#define PAPI_INT_SIGNAL
Definition: papi_internal.h:53
int _papi_hwi_stop_signal(int signal)
Definition: extras.c:441
int L2UNIT_ntv_code_to_name(unsigned int EventCode, char *name, int len)
Definition: linux-L2unit.c:609
#define PAPI_GRN_THR
Definition: papi.h:360
EventInfo_t * EventInfoArray
long long counters[L2UNIT_MAX_COUNTERS]
Definition: linux-L2unit.h:66
int threshold
int _common_set_overflow_BGPM(int EventGroup, int evt_idx, int threshold, void(*handler)(int, uint64_t, uint64_t, const ucontext_t *))
int pos[PAPI_EVENTS_IN_DERIVED_EVENT]
struct sigcontext hwd_ucontext_t
Definition: aix-context.h:10
#define PAPI_OVERFLOW_FORCE_SW
Definition: papi.h:409
#define L2UNIT_MAX_EVENTS
Definition: linux-L2unit.h:36
EventSetInfo_t ** running_eventset
Definition: threads.h:30
char * name
Definition: iozone.c:23648
#define NEED_CONTEXT
Definition: papi_internal.h:97
int L2UNIT_stop(hwd_context_t *ctx, hwd_control_state_t *ptr)
Definition: linux-L2unit.c:129
#define long_long
Definition: papi.h:550
inline_static ThreadInfo_t * _papi_hwi_lookup_thread(int custom_tid)
Definition: threads.h:92
int L2UNIT_set_overflow(EventSetInfo_t *ESI, int EventIndex, int threshold)
Definition: linux-L2unit.c:290
int L2UNIT_read(hwd_context_t *ctx, hwd_control_state_t *ptr, long_long **events, int flags)
Definition: linux-L2unit.c:150
void user_signal_handler_L2UNIT(int hEvtSet, uint64_t address, uint64_t ovfVector, const ucontext_t *pContext)
Definition: linux-L2unit.c:202
#define PAPI_DOM_OTHER
Definition: papi.h:299
int L2UNIT_cleanup_eventset(hwd_control_state_t *ctrl)
Definition: linux-L2unit.c:386
int _papi_hwi_dispatch_overflow_signal(void *papiContext, caddr_t address, int *isHardware, long long overflow_bit, int genOverflowBit, ThreadInfo_t **t, int cidx)
Definition: extras.c:214
int L2UNIT_ntv_enum_events(unsigned int *EventCode, int modifier)
Definition: linux-L2unit.c:543
hwd_control_state_t * ctl_state
ssize_t retval
Definition: libasync.c:338
#define GET_OVERFLOW_ADDRESS(ctx)
Definition: aix-context.h:12
char * ptr
Definition: iozone.c:23586