src/components/pcp/linux-pcp.c
//-----------------------------------------------------------------------------
// cbPopulateNameOnly: This is a callback routine, called by pmTraversePMNS.  That
// routine iterates through the PM name space and calls this routine once per
// name. We increment sEventCount as we go, this will be the final count of valid
// array entries. sEventInfoSize will be >= sEventCount.
// WARNING: May realloc() pcp_event_info[], invalidating pointers into it.
//-----------------------------------------------------------------------------
This is a callback routine, called by pmTraversePMNS.  That
routine iterates through the PM name space and calls this routine once per
name. We increment sEventCount as we go, this will be the final count of valid
array entries.
This is a callback routine called by pmTraversePMNS . That routine iterates through the PM name space and calls this routine once per name . We increment sEventCount as we go this will be the final count of valid array entries .
static void cbPopulateNameOnly(const char *name) 
{
   if (sEventCount >= sEventInfoSize) {                                 
      sEventInfoSize += sEventInfoBlock;                                
      pcp_event_info = realloc(pcp_event_info,                          
                        sEventInfoSize*sizeof(_pcp_event_info_t));      
      memset(&pcp_event_info[sEventCount], 0,                            clear to zeros.
             sEventInfoBlock*sizeof(_pcp_event_info_t));                 
   }
   strncpy(pcp_event_info[sEventCount].name, name, PAPI_MAX_STR_LEN-1); 
   sEventCount++;                                                       
}
static void cbPopulateNameOnly ( const char * name ) { if ( sEventCount >= sEventInfoSize ) { sEventInfoSize += sEventInfoBlock ; pcp_event_info = realloc ( pcp_event_info , sEventInfoSize * sizeof ( _pcp_event_info_t ) ) ; memset ( & pcp_event_info [ sEventCount ] , 0 , sEventInfoBlock * sizeof ( _pcp_event_info_t ) ) ; } strncpy ( pcp_event_info [ sEventCount ] . name , name , PAPI_MAX_STR_LEN - 1 ) ; sEventCount ++ ; }
cbPopulateNameOnly: This is a callback routine, called by pmTraversePMNS.
cbPopulateNameOnly : This is a callback routine called by pmTraversePMNS .
// If we must realloc,  // .. Add another page. // .. do realloc. // .. // .. clear to zeros. // ..  // copy name. // increment our count of events.