PAPI  5.7.0.0
linux-bgq-common.c File Reference

This file is part of 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-bgq-common.c:

Go to the source code of this file.

Functions

int _check_BGPM_error (int err, char *bgpmfunc)
 
long_long _common_getEventValue (unsigned event_id, int EventGroup)
 
int _common_deleteRecreate (int *EventGroup_ptr)
 
int _common_rebuildEventgroup (int count, int *EventGroup_local, int *EventGroup_ptr)
 
int _common_set_overflow_BGPM (int EventGroup, int evt_idx, int threshold, void(*handler)(int, uint64_t, uint64_t, const ucontext_t *))
 

Detailed Description

CVS: $Id$

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 component

Tested version of bgpm (early access)

Definition in file linux-bgq-common.c.

Function Documentation

◆ _check_BGPM_error()

int _check_BGPM_error ( int  err,
char *  bgpmfunc 
)

Definition at line 27 of file linux-bgq-common.c.

28 {
30  int retval;
31 
32  if ( err < 0 ) {
33  sprintf( buffer, "Error: ret value is %d for BGPM API function '%s'.",
34  err, bgpmfunc);
36  return retval;
37  }
38 
39  return PAPI_OK;
40 }
#define PAPI_OK
Definition: fpapi.h:105
int retval
Definition: zero_fork.c:53
char * buffer
Definition: iozone.c:1366
int _papi_hwi_publish_error(char *error)
#define PAPI_MAX_STR_LEN
Definition: fpapi.h:43
Here is the call graph for this function:

◆ _common_deleteRecreate()

int _common_deleteRecreate ( int *  EventGroup_ptr)

Definition at line 64 of file linux-bgq-common.c.

65 {
66 #ifdef DEBUG_BGQ
67  printf( _AT_ " _common_deleteRecreate: *EventGroup_ptr=%d\n", *EventGroup_ptr);
68 #endif
69  int retval;
70 
71  // delete previous bgpm eventset
72  retval = Bgpm_DeleteEventSet( *EventGroup_ptr );
73  retval = _check_BGPM_error( retval, "Bgpm_DeleteEventSet" );
74  if ( retval < 0 ) return retval;
75 
76  // create a new empty bgpm eventset
77  *EventGroup_ptr = Bgpm_CreateEventSet();
78  retval = _check_BGPM_error( *EventGroup_ptr, "Bgpm_CreateEventSet" );
79  if ( retval < 0 ) return retval;
80 
81 #ifdef DEBUG_BGQ
82  printf( _AT_ " _common_deleteRecreate: *EventGroup_ptr=%d\n", *EventGroup_ptr);
83 #endif
84  return PAPI_OK;
85 }
#define PAPI_OK
Definition: fpapi.h:105
int _check_BGPM_error(int err, char *bgpmfunc)
int retval
Definition: zero_fork.c:53
#define _AT_
Here is the call graph for this function:

◆ _common_getEventValue()

long_long _common_getEventValue ( unsigned  event_id,
int  EventGroup 
)

Definition at line 47 of file linux-bgq-common.c.

48 {
49  uint64_t value;
50  int retval;
51 
52  retval = Bgpm_ReadEvent( EventGroup, event_id, &value );
53  retval = _check_BGPM_error( retval, "Bgpm_ReadEvent" );
54  if ( retval < 0 ) return retval;
55 
56  return ( ( long_long ) value );
57 }
int _check_BGPM_error(int err, char *bgpmfunc)
int retval
Definition: zero_fork.c:53
#define long_long
Definition: papi.h:553
Here is the call graph for this function:

◆ _common_rebuildEventgroup()

int _common_rebuildEventgroup ( int  count,
int *  EventGroup_local,
int *  EventGroup_ptr 
)

Definition at line 92 of file linux-bgq-common.c.

93 {
94 #ifdef DEBUG_BGQ
95  printf( "_common_rebuildEventgroup\n" );
96 #endif
97  int i, retval;
98 
99  // rebuild BGPM EventGroup
100  for ( i = 0; i < count; i++ ) {
101  retval = Bgpm_AddEvent( *EventGroup_ptr, EventGroup_local[i] );
102  retval = _check_BGPM_error( retval, "Bgpm_AddEvent" );
103  if ( retval < 0 ) return retval;
104 
105 #ifdef DEBUG_BGQ
106  printf( "_common_rebuildEventgroup: After emptying EventGroup, event re-added: %d\n",
107  EventGroup_local[i] );
108 #endif
109  }
110  return PAPI_OK;
111 }
#define PAPI_OK
Definition: fpapi.h:105
int _check_BGPM_error(int err, char *bgpmfunc)
int retval
Definition: zero_fork.c:53
static long count
int i
Definition: fileop.c:140
Here is the call graph for this function:

◆ _common_set_overflow_BGPM()

int _common_set_overflow_BGPM ( int  EventGroup,
int  evt_idx,
int  threshold,
void(*)(int, uint64_t, uint64_t, const ucontext_t *)  handler 
)

Definition at line 121 of file linux-bgq-common.c.

125 {
126  int retval;
127  uint64_t threshold_for_bgpm;
128 
129  /* convert threadhold value assigned by PAPI user to value that is
130  * programmed into the counter. This value is required by Bgpm_SetOverflow() */
131  threshold_for_bgpm = BGPM_PERIOD2THRES( threshold );
132 
133 #ifdef DEBUG_BGQ
134  printf("_common_set_overflow_BGPM\n");
135 
136  int i;
137  int numEvts = Bgpm_NumEvents( EventGroup );
138  for ( i = 0; i < numEvts; i++ ) {
139  printf("_common_set_overflow_BGPM: %d = %s\n", i, Bgpm_GetEventLabel( EventGroup, i) );
140  }
141 #endif
142 
143 
144  retval = Bgpm_SetOverflow( EventGroup,
145  evt_idx,
146  threshold_for_bgpm );
147  retval = _check_BGPM_error( retval, "Bgpm_SetOverflow" );
148  if ( retval < 0 ) return retval;
149 
150  retval = Bgpm_SetEventUser1( EventGroup,
151  evt_idx,
152  1024 );
153  retval = _check_BGPM_error( retval, "Bgpm_SetEventUser1" );
154  if ( retval < 0 ) return retval;
155 
156  /* user signal handler for overflow case */
157  retval = Bgpm_SetOverflowHandler( EventGroup,
158  handler );
159  retval = _check_BGPM_error( retval, "Bgpm_SetOverflowHandler" );
160  if ( retval < 0 ) return retval;
161 
162  return PAPI_OK;
163 }
#define PAPI_OK
Definition: fpapi.h:105
int _check_BGPM_error(int err, char *bgpmfunc)
int retval
Definition: zero_fork.c:53
void handler(int EventSet, void *address, long long overflow_vector, void *context)
Definition: rapl_overflow.c:20
static int threshold
int i
Definition: fileop.c:140
Here is the call graph for this function: