PAPI  5.3.2.0
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
linux-L2unit.c File Reference

This file has the source code for a component that enables PAPI-C to access hardware monitoring counters for BG/Q through the bgpm library. More...

Include dependency graph for linux-L2unit.c:

Go to the source code of this file.

Functions

void user_signal_handler_L2UNIT (int hEvtSet, uint64_t address, uint64_t ovfVector, const ucontext_t *pContext)
 
int L2UNIT_init_thread (hwd_context_t *ctx)
 
int L2UNIT_init_component (int cidx)
 
int L2UNIT_init_control_state (hwd_control_state_t *ptr)
 
int L2UNIT_start (hwd_context_t *ctx, hwd_control_state_t *ptr)
 
int L2UNIT_stop (hwd_context_t *ctx, hwd_control_state_t *ptr)
 
int L2UNIT_read (hwd_context_t *ctx, hwd_control_state_t *ptr, long_long **events, int flags)
 
int L2UNIT_shutdown_thread (hwd_context_t *ctx)
 
int L2UNIT_set_overflow (EventSetInfo_t *ESI, int EventIndex, int threshold)
 
int L2UNIT_ctl (hwd_context_t *ctx, int code, _papi_int_option_t *option)
 
int L2UNIT_cleanup_eventset (hwd_control_state_t *ctrl)
 
int L2UNIT_update_control_state (hwd_control_state_t *ptr, NativeInfo_t *native, int count, hwd_context_t *ctx)
 
int L2UNIT_set_domain (hwd_control_state_t *cntrl, int domain)
 
int L2UNIT_reset (hwd_context_t *ctx, hwd_control_state_t *ptr)
 
int L2UNIT_ntv_enum_events (unsigned int *EventCode, int modifier)
 
int L2UNIT_ntv_name_to_code (char *name, unsigned int *event_code)
 
int L2UNIT_ntv_code_to_name (unsigned int EventCode, char *name, int len)
 
int L2UNIT_ntv_code_to_descr (unsigned int EventCode, char *name, int len)
 
int L2UNIT_ntv_code_to_bits (unsigned int EventCode, hwd_register_t *bits)
 

Variables

papi_vector_t _L2unit_vector
 

Detailed Description

Author
Heike Jagode jagod.nosp@m.e@ee.nosp@m.cs.ut.nosp@m.k.ed.nosp@m.u Mods: < your name here > < your email address > BGPM / L2unit component

Tested version of bgpm (early access)

Definition in file linux-L2unit.c.

Function Documentation

int L2UNIT_cleanup_eventset ( hwd_control_state_t ctrl)

Definition at line 386 of file linux-L2unit.c.

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 }
int _common_deleteRecreate(int *EventGroup_ptr)
return PAPI_OK
Definition: linux-nvml.c:458
#define printf
Definition: papi_test.h:125
ssize_t retval
Definition: libasync.c:338

Here is the call graph for this function:

int L2UNIT_ctl ( hwd_context_t ctx,
int  code,
_papi_int_option_t option 
)

Definition at line 368 of file linux-L2unit.c.

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 }
return PAPI_OK
Definition: linux-nvml.c:458
void
Definition: iozone.c:18627
#define printf
Definition: papi_test.h:125
int L2UNIT_init_component ( int  cidx)

Definition at line 52 of file linux-L2unit.c.

53 {
54 #ifdef DEBUG_BGQ
55  printf( "L2UNIT_init_component\n" );
56 #endif
57 
59 #ifdef DEBUG_BGQ
60  printf( "L2UNIT_init_component cidx = %d\n", cidx );
61 #endif
62 
63  return ( PAPI_OK );
64 }
return PAPI_OK
Definition: linux-nvml.c:458
PAPI_component_info_t cmp_info
Definition: papi_vector.h:20
#define printf
Definition: papi_test.h:125
static int cidx
Definition: event_info.c:40
papi_vector_t _L2unit_vector
Definition: linux-L2unit.c:23
int L2UNIT_init_control_state ( hwd_control_state_t ptr)

Definition at line 72 of file linux-L2unit.c.

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 }
int _check_BGPM_error(int err, char *bgpmfunc)
return PAPI_OK
Definition: linux-nvml.c:458
#define printf
Definition: papi_test.h:125
ssize_t retval
Definition: libasync.c:338

Here is the call graph for this function:

int L2UNIT_init_thread ( hwd_context_t ctx)

Definition at line 36 of file linux-L2unit.c.

37 {
38 #ifdef DEBUG_BGQ
39  printf( "L2UNIT_init_thread\n" );
40 #endif
41 
42  ( void ) ctx;
43  return PAPI_OK;
44 }
return PAPI_OK
Definition: linux-nvml.c:458
void
Definition: iozone.c:18627
#define printf
Definition: papi_test.h:125
int L2UNIT_ntv_code_to_bits ( unsigned int  EventCode,
hwd_register_t bits 
)

Definition at line 659 of file linux-L2unit.c.

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 }
return PAPI_OK
Definition: linux-nvml.c:458
void
Definition: iozone.c:18627
#define printf
Definition: papi_test.h:125
int L2UNIT_ntv_code_to_descr ( unsigned int  EventCode,
char *  name,
int  len 
)

Definition at line 638 of file linux-L2unit.c.

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 }
int _check_BGPM_error(int err, char *bgpmfunc)
return PAPI_OK
Definition: linux-nvml.c:458
#define OFFSET
Definition: linux-CNKunit.h:36
char * name
Definition: iozone.c:23648
ssize_t retval
Definition: libasync.c:338

Here is the call graph for this function:

int L2UNIT_ntv_code_to_name ( unsigned int  EventCode,
char *  name,
int  len 
)

Definition at line 609 of file linux-L2unit.c.

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 }
#define PAPI_ENOEVNT
Definition: fpapi.h:112
#define MAX_COUNTERS
Definition: perfctr-x86.h:8
return PAPI_OK
Definition: linux-nvml.c:458
#define printf
Definition: papi_test.h:125
#define OFFSET
Definition: linux-CNKunit.h:36
char * name
Definition: iozone.c:23648
int L2UNIT_ntv_enum_events ( unsigned int EventCode,
int  modifier 
)

Definition at line 543 of file linux-L2unit.c.

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_COUNTERS ) {
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 }
#define L2UNIT_MAX_COUNTERS
Definition: linux-L2unit.h:35
#define PAPI_ENOEVNT
Definition: fpapi.h:112
return PAPI_OK
Definition: linux-nvml.c:458
return PAPI_EINVAL
Definition: linux-nvml.c:408
#define OFFSET
Definition: linux-CNKunit.h:36
int L2UNIT_ntv_name_to_code ( char *  name,
unsigned int event_code 
)

Definition at line 579 of file linux-L2unit.c.

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_COUNTERS ) // not a L2Unit event
597  return PAPI_ENOEVNT;
598  else
599  *event_code = ( ret - OFFSET );
600 
601  return PAPI_OK;
602 }
#define L2UNIT_MAX_COUNTERS
Definition: linux-L2unit.h:35
#define PAPI_ENOEVNT
Definition: fpapi.h:112
return PAPI_OK
Definition: linux-nvml.c:458
#define printf
Definition: papi_test.h:125
long long ret
Definition: iozone.c:1346
#define OFFSET
Definition: linux-CNKunit.h:36
char * name
Definition: iozone.c:23648
int L2UNIT_read ( hwd_context_t ctx,
hwd_control_state_t ptr,
long_long **  events,
int  flags 
)

Definition at line 150 of file linux-L2unit.c.

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 }
long long flags
Definition: iozone.c:12330
return PAPI_OK
Definition: linux-nvml.c:458
void
Definition: iozone.c:18627
#define printf
Definition: papi_test.h:125
int i
Definition: fileop.c:140
char events[MAX_EVENTS][BUFSIZ]
long_long _common_getEventValue(unsigned event_id, int EventGroup)
long long counters[L2UNIT_MAX_COUNTERS]
Definition: linux-L2unit.h:65

Here is the call graph for this function:

int L2UNIT_reset ( hwd_context_t ctx,
hwd_control_state_t ptr 
)

Definition at line 514 of file linux-L2unit.c.

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 }
int _check_BGPM_error(int err, char *bgpmfunc)
return PAPI_OK
Definition: linux-nvml.c:458
void
Definition: iozone.c:18627
#define printf
Definition: papi_test.h:125
ssize_t retval
Definition: libasync.c:338

Here is the call graph for this function:

int L2UNIT_set_domain ( hwd_control_state_t cntrl,
int  domain 
)

Definition at line 486 of file linux-L2unit.c.

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 }
return PAPI_OK
Definition: linux-nvml.c:458
#define PAPI_DOM_OTHER
Definition: fpapi.h:23
#define PAPI_DOM_KERNEL
Definition: fpapi.h:22
void
Definition: iozone.c:18627
return PAPI_EINVAL
Definition: linux-nvml.c:408
#define printf
Definition: papi_test.h:125
long long found
Definition: libasync.c:735
#define PAPI_DOM_USER
Definition: fpapi.h:21
int L2UNIT_set_overflow ( EventSetInfo_t ESI,
int  EventIndex,
int  threshold 
)

Definition at line 290 of file linux-L2unit.c.

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,
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 }
L2UNIT_overflow_t overflow_list[512]
Definition: linux-L2unit.h:68
int _common_deleteRecreate(int *EventGroup_ptr)
return PAPI_OK
Definition: linux-nvml.c:458
PAPI_component_info_t cmp_info
Definition: papi_vector.h:20
#define printf
Definition: papi_test.h:125
int _common_rebuildEventgroup(int count, int *EventGroup_local, int *EventGroup_ptr)
papi_vector_t _L2unit_vector
Definition: linux-L2unit.c:23
#define SUBDBG(format, args...)
Definition: papi_debug.h:63
int _papi_hwi_start_signal(int signal, int need_context, int cidx)
Definition: extras.c:401
int _papi_hwi_stop_signal(int signal)
Definition: extras.c:441
EventInfo_t * EventInfoArray
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]
#define NEED_CONTEXT
Definition: papi_internal.h:97
void user_signal_handler_L2UNIT(int hEvtSet, uint64_t address, uint64_t ovfVector, const ucontext_t *pContext)
Definition: linux-L2unit.c:202
hwd_control_state_t * ctl_state
ssize_t retval
Definition: libasync.c:338

Here is the call graph for this function:

int L2UNIT_shutdown_thread ( hwd_context_t ctx)

Definition at line 182 of file linux-L2unit.c.

183 {
184 #ifdef DEBUG_BGQ
185  printf( "L2UNIT_shutdown_thread\n" );
186 #endif
187 
188  ( void ) ctx;
189  return ( PAPI_OK );
190 }
return PAPI_OK
Definition: linux-nvml.c:458
void
Definition: iozone.c:18627
#define printf
Definition: papi_test.h:125
int L2UNIT_start ( hwd_context_t ctx,
hwd_control_state_t ptr 
)

Definition at line 99 of file linux-L2unit.c.

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 }
int _check_BGPM_error(int err, char *bgpmfunc)
return PAPI_OK
Definition: linux-nvml.c:458
void
Definition: iozone.c:18627
#define printf
Definition: papi_test.h:125
ssize_t retval
Definition: libasync.c:338

Here is the call graph for this function:

int L2UNIT_stop ( hwd_context_t ctx,
hwd_control_state_t ptr 
)

Definition at line 129 of file linux-L2unit.c.

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 }
int _check_BGPM_error(int err, char *bgpmfunc)
return PAPI_OK
Definition: linux-nvml.c:458
void
Definition: iozone.c:18627
#define printf
Definition: papi_test.h:125
ssize_t retval
Definition: libasync.c:338

Here is the call graph for this function:

int L2UNIT_update_control_state ( hwd_control_state_t ptr,
NativeInfo_t native,
int  count,
hwd_context_t ctx 
)

Definition at line 415 of file linux-L2unit.c.

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 }
L2UNIT_overflow_t overflow_list[512]
Definition: linux-L2unit.h:68
int _common_deleteRecreate(int *EventGroup_ptr)
int _check_BGPM_error(int err, char *bgpmfunc)
return PAPI_OK
Definition: linux-nvml.c:458
int count
Definition: iozone.c:22422
void
Definition: iozone.c:18627
#define printf
Definition: papi_test.h:125
int i
Definition: fileop.c:140
int k
Definition: iozone.c:19136
#define OFFSET
Definition: linux-CNKunit.h:36
int _common_set_overflow_BGPM(int EventGroup, int evt_idx, int threshold, void(*handler)(int, uint64_t, uint64_t, const ucontext_t *))
void user_signal_handler_L2UNIT(int hEvtSet, uint64_t address, uint64_t ovfVector, const ucontext_t *pContext)
Definition: linux-L2unit.c:202
ssize_t retval
Definition: libasync.c:338

Here is the call graph for this function:

void user_signal_handler_L2UNIT ( int  hEvtSet,
uint64_t  address,
uint64_t  ovfVector,
const ucontext_t *  pContext 
)

Definition at line 202 of file linux-L2unit.c.

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;
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 }
void
Definition: iozone.c:18627
PAPI_component_info_t cmp_info
Definition: papi_vector.h:20
#define printf
Definition: papi_test.h:125
int i
Definition: fileop.c:140
EventSetOverflowInfo_t overflow
#define PAPI_OVERFLOW_HARDWARE
Definition: papi.h:410
static int cidx
Definition: event_info.c:40
papi_vector_t _L2unit_vector
Definition: linux-L2unit.c:23
hwd_ucontext_t * ucontext
void * thread(void *arg)
Definition: kufrin.c:31
void PAPIERROR(char *format,...)
struct sigcontext hwd_ucontext_t
Definition: aix-context.h:10
#define PAPI_OVERFLOW_FORCE_SW
Definition: papi.h:409
EventSetInfo_t ** running_eventset
Definition: threads.h:30
#define long_long
Definition: papi.h:549
inline_static ThreadInfo_t * _papi_hwi_lookup_thread(int custom_tid)
Definition: threads.h:92
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
ssize_t retval
Definition: libasync.c:338
#define GET_OVERFLOW_ADDRESS(ctx)
Definition: aix-context.h:12

Here is the call graph for this function:

Here is the caller graph for this function:

Variable Documentation

papi_vector_t _L2unit_vector

Definition at line 23 of file linux-L2unit.c.