PAPI  5.0.1.0
solaris-niagara2.c File Reference
Include dependency graph for solaris-niagara2.c:

Go to the source code of this file.

Data Structures

struct  __t2_store_t
struct  __sol_processor_information_t
struct  __t2_pst_table_t
struct  __int_syn_table_t

Defines

#define hwd_control_state_t   _niagara2_control_state_t
#define hwd_context_t   _niagara2_context_t
#define hwd_register_t   _niagara2_register_t
#define __CHECK_ERR_DFLT(retval)   if(retval != 0){ SUBDBG("RETVAL: %d\n", retval); return PAPI_ECMP;}
#define __CHECK_ERR_NULL(retval)   if(retval == NULL){ SUBDBG("RETVAL: NULL\n"); return PAPI_ECMP;}
#define __CHECK_ERR_PAPI(retval)   if(retval != PAPI_OK){ SUBDBG("RETVAL: %d\n", retval); return PAPI_ECMP;}
#define __CHECK_ERR_INVA(retval)   if(retval != 0){ SUBDBG("RETVAL: %d\n", retval); return PAPI_EINVAL;}
#define __CHECK_ERR_NEGV(retval)   if(retval < 0){ SUBDBG("RETVAL: %d\n", retval); return PAPI_ECMP;}
#define SYNTHETIC_EVENTS_SUPPORTED   1

Enumerations

enum  { SYNTHETIC_CYCLES_ELAPSED = 1, SYNTHETIC_RETURN_ONE, SYNTHETIC_RETURN_TWO }

Functions

int __int_setup_synthetic_event (int, _niagara2_control_state_t *, void *)
uint64_t __int_get_synthetic_event (int, _niagara2_control_state_t *, void *)
void __int_walk_synthetic_events_action_count (void)
void __int_walk_synthetic_events_action_store (void)
int _niagara2_set_domain (_niagara2_control_state_t *ctrl, int domain)
int _niagara2_ctl (_niagara2_context_t *ctx, int code, _papi_int_option_t *option)
void _niagara2_dispatch_timer (int signal, siginfo_t *si, void *info)
static void * _niagara2_get_overflow_address (void *context)
int _niagara2_init_control_state (_niagara2_control_state_t *ctrl)
int _niagara2_init_component (int cidx)
static void _niagara2_lock_init (void)
int _niagara2_ntv_code_to_bits (unsigned int EventCode, _niagara2_register_t *bits)
int _niagara2_ntv_code_to_descr (unsigned int EventCode, char *ntv_descr, int len)
int _niagara2_ntv_code_to_name (unsigned int EventCode, char *ntv_name, int len)
int _niagara2_ntv_enum_events (unsigned int *EventCode, int modifier)
int _niagara2_read (_niagara2_context_t *ctx, _niagara2_control_state_t *ctrl, long long **events, int flags)
int _niagara2_reset (_niagara2_context_t *ctx, _niagara2_control_state_t *ctrl)
int _niagara2_set_profile (EventSetInfo_t *ESI, int EventIndex, int threshold)
int _niagara2_set_overflow (EventSetInfo_t *ESI, int EventIndex, int threshold)
int _niagara2_shutdown (_niagara2_context_t *ctx)
int _niagara2_shutdown_global (void)
int _niagara2_start (_niagara2_context_t *ctx, _niagara2_control_state_t *ctrl)
int _niagara2_stop (_niagara2_context_t *ctx, _niagara2_control_state_t *ctrl)
int _niagara2_update_control_state (_niagara2_control_state_t *ctrl, NativeInfo_t *native, int count, _niagara2_context_t *ctx)
int _niagara2_update_shlib_info (papi_mdi_t *mdi)
static int __cpc_build_ntv_table (void)
static int __cpc_search_ntv_event (char *event_name, int *event_code)
static int __cpc_build_pst_table (void)
static int __cpc_recreate_set (_niagara2_control_state_t *ctrl)
static int __cpc_domain_translator (const int papi_domain)
void __cpc_error_handler (const char *fn, int subcode, const char *fmt, va_list ap)
static int __cpc_enable_sigemt (_niagara2_control_state_t *ctrl, int position)
void __cpc_walk_events_pic_action_count (void *arg, uint_t picno, const char *event)
void __cpc_walk_events_pic_action_store (void *arg, uint_t picno, const char *event)
static int __sol_get_processor_clock (void)
static int __sol_get_itimer_ns (int ns)
static lwpstatus_t * __sol_get_lwp_status (const pid_t pid, const lwpid_t lwpid)
static psinfo_t * __sol_get_proc_info (const pid_t pid)
static pstatus_t * __sol_get_proc_status (const pid_t pid)

Variables

caddr_t _start
caddr_t _end
caddr_t _etext
caddr_t _edata
papi_vector_t _niagara2_vector
papi_mdi_t _papi_hwi_system_info
static cpc_t * cpc = NULL
static __t2_store_t __t2_store
static char ** __t2_ntv_events
static int pid
static __t2_pst_table_t __t2_table []
hwi_search_tpreset_table
enum { ... }  __int_synthetic_enum
static __int_syn_table_t __int_syn_table []
papi_os_vector_t _papi_os_vector

Define Documentation

#define __CHECK_ERR_DFLT (   retval)    if(retval != 0){ SUBDBG("RETVAL: %d\n", retval); return PAPI_ECMP;}

Definition at line 78 of file solaris-niagara2.c.

#define __CHECK_ERR_INVA (   retval)    if(retval != 0){ SUBDBG("RETVAL: %d\n", retval); return PAPI_EINVAL;}

Definition at line 87 of file solaris-niagara2.c.

#define __CHECK_ERR_NEGV (   retval)    if(retval < 0){ SUBDBG("RETVAL: %d\n", retval); return PAPI_ECMP;}

Definition at line 90 of file solaris-niagara2.c.

#define __CHECK_ERR_NULL (   retval)    if(retval == NULL){ SUBDBG("RETVAL: NULL\n"); return PAPI_ECMP;}

Definition at line 81 of file solaris-niagara2.c.

#define __CHECK_ERR_PAPI (   retval)    if(retval != PAPI_OK){ SUBDBG("RETVAL: %d\n", retval); return PAPI_ECMP;}

Definition at line 84 of file solaris-niagara2.c.

Definition at line 65 of file solaris-niagara2.c.

Definition at line 64 of file solaris-niagara2.c.

Definition at line 66 of file solaris-niagara2.c.

Definition at line 129 of file solaris-niagara2.c.


Enumeration Type Documentation

anonymous enum
Enumerator:
SYNTHETIC_CYCLES_ELAPSED 
SYNTHETIC_RETURN_ONE 
SYNTHETIC_RETURN_TWO 

Definition at line 194 of file solaris-niagara2.c.


Function Documentation

static int __cpc_build_ntv_table ( void  ) [inline, static]

UTILITY FUNCTIONS FOR ACCESS TO LIBCPC AND SOLARIS /////////////////////////

< Not supported by component

< Not supported by component

< Not supported by component

< No error

Definition at line 1545 of file solaris-niagara2.c.

{
    int i, tmp;

#ifdef DEBUG
    SUBDBG( "ENTERING FUNCTION >>%s<< at %s:%d\n", __func__, __FILE__,
            __LINE__ );
#endif

    __t2_store.pic_ntv_count = papi_calloc( __t2_store.npic, sizeof ( int ) );
    __CHECK_ERR_NULL( __t2_store.pic_ntv_count );

#ifdef DEBUG
    SUBDBG( " -> %s: Checking PICs for functionality\n", __func__ );
#endif

    for ( i = 0; i < __t2_store.npic; i++ ) {
        cpc_walk_events_pic( cpc, i, NULL, __cpc_walk_events_pic_action_count );

#ifdef DEBUG
        SUBDBG( " -> %s: Found %d events on PIC#%d\n", __func__,
                __t2_store.pic_ntv_count[i], i );
#endif
    }

    tmp = __t2_store.pic_ntv_count[0];

    /* There should be at least one counter... */
    if ( tmp == 0 ) {
#ifdef DEBUG
        SUBDBG( " -> %s: PIC#0 has 0 events\n", __func__ );
#endif

        return PAPI_ECMP;
    }

    /* Check if all PICs have the same number of counters */
    for ( i = 0; i < __t2_store.npic; i++ ) {
        if ( __t2_store.pic_ntv_count[i] != tmp ) {
#ifdef DEBUG
            SUBDBG( " -> %s: PIC#%d has %d events, should have %d\n",
                    __func__, i, __t2_store.pic_ntv_count[i], tmp );
#endif

            return PAPI_ECMP;
        }
    }

    /* Count synthetic events which add functionality to libcpc */
#ifdef SYNTHETIC_EVENTS_SUPPORTED
    __t2_store.syn_evt_count = 0;
    __int_walk_synthetic_events_action_count(  );
#endif

    /* Store the count of events available in central data structure */
#ifndef SYNTHETIC_EVENTS_SUPPORTED
    _niagara2_vector.cmp_info.num_native_events = __t2_store.pic_ntv_count[0];
#else
    _niagara2_vector.cmp_info.num_native_events =
        __t2_store.pic_ntv_count[0] + __t2_store.syn_evt_count;
#endif


    /* Allocate memory for storing all events found, including the first empty
       slot */
    __t2_ntv_events =
        papi_calloc( _niagara2_vector.cmp_info.num_native_events + 1,
                     sizeof ( char * ) );

    __t2_ntv_events[0] = "THIS IS A BUG!";

    tmp = 1;
    cpc_walk_events_pic( cpc, 0, ( void * ) &tmp,
                         __cpc_walk_events_pic_action_store );

#ifdef SYNTHETIC_EVENTS_SUPPORTED
    __int_walk_synthetic_events_action_store(  );
#endif

#ifdef DEBUG
    for ( i = 1; i < __t2_store.pic_ntv_count[0]; i++ ) {
        SUBDBG( " -> %s: Event #%d: %s\n", __func__, i, __t2_ntv_events[i] );
    }
#endif

#ifdef DEBUG
    SUBDBG( "LEAVING FUNCTION  >>%s<< at %s:%d\n", __func__, __FILE__,
            __LINE__ );
#endif

    return PAPI_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static int __cpc_build_pst_table ( void  ) [inline, static]

< Not supported by component

<A nonexistent hardware event used as a placeholder

<A nonexistent hardware event used as a placeholder

< Add counters

< Sub all counters from counter with operand_index

< No error

< No error

Definition at line 1656 of file solaris-niagara2.c.

{
    int num_psts, i, j, event_code, pst_events;
    hwi_search_t tmp;

#ifdef DEBUG
    SUBDBG( "ENTERING FUNCTION >>%s<< at %s:%d\n", __func__, __FILE__,
            __LINE__ );
#endif

    num_psts = 0;

    while ( __t2_table[num_psts].papi_pst != 0 ) {
        num_psts++;
    }

#ifdef DEBUG
    SUBDBG( " -> %s: Found %d presets\n", __func__, num_psts );
#endif

    preset_table = papi_calloc( num_psts + 1, sizeof ( hwi_search_t ) );
    __CHECK_ERR_NULL( preset_table );

    pst_events = 0;

    for ( i = 0; i < num_psts; i++ ) {
        memset( &tmp, PAPI_NULL, sizeof ( tmp ) );

        /* Mark counters as unused. If they are needed, they will be overwritten
           later. See papi_preset.c:51 for more details. */
        for ( j = 0; j < PAPI_EVENTS_IN_DERIVED_EVENT; j++ ) {
            tmp.data.native[j] = PAPI_NULL;
        }

        tmp.event_code = __t2_table[i].papi_pst;
        tmp.data.derived = __t2_table[i].ntv_opcode;
        tmp.data.operation[0] = '\0';

        switch ( __t2_table[i].ntv_opcode ) {
        case DERIVED_ADD:
            tmp.data.operation[0] = '+';
            break;
        case DERIVED_SUB:
            tmp.data.operation[0] = '-';
            break;
        }

        for ( j = 0; j < __t2_table[i].ntv_ctrs; j++ ) {
            if ( __cpc_search_ntv_event
                 ( __t2_table[i].ntv_event[j], &event_code )
                 >= PAPI_OK ) {
                tmp.data.native[j] = event_code;
            } else {
                continue;
            }
        }

#ifdef DEBUG
        SUBDBG( " -> %s: pst row %d - event_code=%d\n",
                __func__, i, tmp.event_code );
        SUBDBG( " -> %s: pst row %d - data.derived=%d, data.operation=%c\n",
                __func__, i, tmp.data.derived, tmp.data.operation[0] );
        SUBDBG( " -> %s: pst row %d - native event codes:\n", __func__, i );
        {
            int d_i;

            for ( d_i = 0; d_i < PAPI_EVENTS_IN_DERIVED_EVENT; d_i++ ) {
                SUBDBG( " -> %s: pst row %d - +++ data.native[%d]=%d\n",
                        __func__, i, d_i, tmp.data.native[d_i] );
            }
        }
#endif

        memcpy( &preset_table[i], &tmp, sizeof ( tmp ) );

        pst_events++;
    }

    // Check!
    memset( &preset_table[num_psts], 0, sizeof ( hwi_search_t ) );

    _niagara2_vector.cmp_info.num_preset_events = pst_events;

#ifdef DEBUG
    SUBDBG( "LEAVING FUNCTION  >>%s<< at %s:%d\n", __func__, __FILE__,
            __LINE__ );
#endif

    return PAPI_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static int __cpc_domain_translator ( const int  papi_domain) [inline, static]

< User context counted

< Kernel/OS context counted

< Supervisor/hypervisor context counted

Definition at line 1822 of file solaris-niagara2.c.

{
    int domain = 0;

#ifdef DEBUG
    SUBDBG( "ENTERING FUNCTION >>%s<< at %s:%d\n", __func__, __FILE__,
            __LINE__ );
    SUBDBG( " -> %s: papi_domain=%d requested\n", __func__, papi_domain );
#endif

    if ( papi_domain & PAPI_DOM_USER ) {
#ifdef DEBUG
        SUBDBG( " -> %s: Domain PAPI_DOM_USER/CPC_COUNT_USER selected\n",
                __func__ );
#endif
        domain |= CPC_COUNT_USER;
    }

    if ( papi_domain & PAPI_DOM_KERNEL ) {
#ifdef DEBUG
        SUBDBG( " -> %s: Domain PAPI_DOM_KERNEL/CPC_COUNT_SYSTEM selected\n",
                __func__ );
#endif
        domain |= CPC_COUNT_SYSTEM;
    }

    if ( papi_domain & PAPI_DOM_SUPERVISOR ) {
#ifdef DEBUG
        SUBDBG( " -> %s: Domain PAPI_DOM_SUPERVISOR/CPC_COUNT_HV selected\n",
                __func__ );
#endif
        domain |= CPC_COUNT_HV;
    }
#ifdef DEBUG
    SUBDBG( " -> %s: domain=%d\n", __func__, domain );
#endif

    return domain;
}

Here is the caller graph for this function:

static int __cpc_enable_sigemt ( _niagara2_control_state_t ctrl,
int  position 
) [inline, static]

< Invalid argument

Definition at line 1881 of file solaris-niagara2.c.

{
#ifdef DEBUG
    SUBDBG( "ENTERING FUNCTION >>%s<< at %s:%d\n", __func__, __FILE__,
            __LINE__ );
#endif

    if ( position >= MAX_COUNTERS ) {
#ifdef DEBUG
        SUBDBG( " -> %s: Position of the counter does not exist\n", __func__ );
#endif

        return PAPI_EINVAL;
    }

    ctrl->flags[position] = ctrl->flags[position] | CPC_OVF_NOTIFY_EMT;

#ifdef DEBUG
    SUBDBG( "ENTERING FUNCTION >>%s<< at %s:%d\n", __func__, __FILE__,
            __LINE__ );
#endif

    return __cpc_recreate_set( ctrl );
}

Here is the call graph for this function:

Here is the caller graph for this function:

void __cpc_error_handler ( const char *  fn,
int  subcode,
const char *  fmt,
va_list  ap 
)

Definition at line 1863 of file solaris-niagara2.c.

{
#ifdef DEBUG
    SUBDBG( "ENTERING FUNCTION >>%s<< at %s:%d\n", __func__, __FILE__,
            __LINE__ );
#endif

    /* From the libcpc manpages */
    fprintf( stderr, "ERROR - libcpc error handler in %s() called!\n", fn );
    vfprintf( stderr, fmt, ap );

#ifdef DEBUG
    SUBDBG( "LEAVING FUNCTION  >>%s<< at %s:%d\n", __func__, __FILE__,
            __LINE__ );
#endif
}

Here is the caller graph for this function:

static int __cpc_recreate_set ( _niagara2_control_state_t ctrl) [inline, static]

< Not supported by component

< Not supported by component

< Not supported by component

< Not supported by component

< Not supported by component

< No error

Definition at line 1748 of file solaris-niagara2.c.

{
#ifdef SYNTHETIC_EVENTS_SUPPORTED
    const int syn_barrier = _niagara2_vector.cmp_info.num_native_events
        - __t2_store.syn_evt_count;
#endif

    int i;

#ifdef DEBUG
    SUBDBG( "ENTERING FUNCTION >>%s<< at %s:%d\n", __func__, __FILE__,
            __LINE__ );
#endif

    /* Destroy the old buffer and the old set if they exist, we need to do a full
       recreate as changing flags or events through libcpc is not possible */
    if ( ctrl->counter_buffer != NULL ) {
        __CHECK_ERR_DFLT( cpc_buf_destroy( cpc, ctrl->counter_buffer ) );
    }

    if ( ctrl->set != NULL ) {
        __CHECK_ERR_DFLT( cpc_set_destroy( cpc, ctrl->set ) );
    }

    /* Create a new set */
    ctrl->set = cpc_set_create( cpc );
    __CHECK_ERR_NULL( ctrl->set );

    for ( i = 0; i < ctrl->count; i++ ) {
#ifdef DEBUG
        SUBDBG( " -> %s: Adding native event 0x%x (%s) on position %d\n",
                __func__, ctrl->code[i].event_code,
                __t2_ntv_events[ctrl->code[i].event_code], i );
        SUBDBG( " -> %s: Event setup: ctrl->code[%d].event_code=0x%x\n",
                __func__, i, ctrl->code[i].event_code );
        SUBDBG( " -> %s: Event setup: ctrl->preset[%d]=%d\n",
                __func__, i, ctrl->preset[i] );
        SUBDBG( " -> %s: Event setup: ctrl->flags[%d]=0x%x\n",
                __func__, i, ctrl->flags[i] );
#endif

#ifdef SYNTHETIC_EVENTS_SUPPORTED
        /* Ensure that synthetic events are skipped */
        if ( ctrl->code[i].event_code >= syn_barrier ) {
#ifdef DEBUG
            SUBDBG( " -> %s: Skipping counter %d, synthetic event found\n",
                    __func__, i );
#endif

            /* Next iteration */
            continue;
        }
#endif

        ctrl->idx[i] = cpc_set_add_request( cpc, ctrl->set,
                                            __t2_ntv_events[ctrl->code[i].
                                                            event_code],
                                            ctrl->preset[i], ctrl->flags[i], 0,
                                            NULL );
        __CHECK_ERR_NEGV( ctrl->idx[i] );
    }

    ctrl->counter_buffer = cpc_buf_create( cpc, ctrl->set );
    __CHECK_ERR_NULL( ctrl->counter_buffer );

#ifdef DEBUG
    SUBDBG( "LEAVING FUNCTION  >>%s<< at %s:%d\n", __func__, __FILE__,
            __LINE__ );
#endif

    return PAPI_OK;
}

Here is the caller graph for this function:

static int __cpc_search_ntv_event ( char *  event_name,
int *  event_code 
) [inline, static]

< No error

< Event does not exist

Definition at line 1641 of file solaris-niagara2.c.

{
    int i;

    for ( i = 0; i < _niagara2_vector.cmp_info.num_native_events; i++ ) {
        if ( strcmp( event_name, __t2_ntv_events[i] ) == 0 ) {
            *event_code = i;
            return PAPI_OK;
        }
    }

    return PAPI_ENOEVNT;
}

Here is the caller graph for this function:

void __cpc_walk_events_pic_action_count ( void *  arg,
uint_t  picno,
const char *  event 
)

Definition at line 1907 of file solaris-niagara2.c.

{
#ifdef DEBUG
    SUBDBG( "ENTERING FUNCTION >>%s<< at %s:%d\n", __func__, __FILE__,
            __LINE__ );
#endif

    __t2_store.pic_ntv_count[picno]++;

#ifdef DEBUG
    SUBDBG
        ( " -> %s: Found one native event on PIC#%d (now totally %d events)\n",
          __func__, picno, __t2_store.pic_ntv_count[picno] );
#endif

#ifdef DEBUG
    SUBDBG( "LEAVING FUNCTION  >>%s<< at %s:%d\n", __func__, __FILE__,
            __LINE__ );
#endif
}

Here is the caller graph for this function:

void __cpc_walk_events_pic_action_store ( void *  arg,
uint_t  picno,
const char *  event 
)

Definition at line 1929 of file solaris-niagara2.c.

{
    int *tmp = ( int * ) arg;

#ifdef DEBUG
    SUBDBG( "ENTERING FUNCTION >>%s<< at %s:%d\n", __func__, __FILE__,
            __LINE__ );
#endif

    __t2_ntv_events[*tmp] = papi_strdup( event );

#ifdef DEBUG
    SUBDBG( " -> %s: Native event >>%s<< registered\n",
            __func__, __t2_ntv_events[*tmp] );
#endif

    *tmp = *tmp + 1;

#ifdef DEBUG
    SUBDBG( "LEAVING FUNCTION  >>%s<< at %s:%d\n", __func__, __FILE__,
            __LINE__ );
#endif
}

Here is the caller graph for this function:

uint64_t __int_get_synthetic_event ( int  code,
_niagara2_control_state_t ctrl,
void *  arg 
)

< Invalid argument

Definition at line 2099 of file solaris-niagara2.c.

{
#ifdef DEBUG
    SUBDBG( "ENTERING FUNCTION >>%s<< at %s:%d\n", __func__, __FILE__,
            __LINE__ );
#endif

    switch ( code ) {
    case SYNTHETIC_CYCLES_ELAPSED:
        /* Return the count of ticks this set was bound. If a reset of the set
           has been executed the last count will be subtracted. */
    {
        int *i = ( int * ) arg;
        return cpc_buf_tick( cpc,
                             ctrl->counter_buffer ) - ctrl->syn_hangover[*i];
    }
    case SYNTHETIC_RETURN_ONE:
        // The name says it - only for testing purposes.
#ifdef DEBUG
        SUBDBG( "LEAVING FUNCTION  >>%s<< at %s:%d\n", __func__, __FILE__,
                __LINE__ );
#endif
        return 1;
    case SYNTHETIC_RETURN_TWO:
        // The name says it - only for testing purposes.
#ifdef DEBUG
        SUBDBG( "LEAVING FUNCTION  >>%s<< at %s:%d\n", __func__, __FILE__,
                __LINE__ );
#endif
        return 2;
    default:

#ifdef DEBUG
        SUBDBG( "LEAVING FUNCTION  >>%s<< at %s:%d\n", __func__, __FILE__,
                __LINE__ );
#endif
        return PAPI_EINVAL;
    }
}

Here is the caller graph for this function:

int __int_setup_synthetic_event ( int  code,
_niagara2_control_state_t ctrl,
void *  arg 
)

< No error

< Invalid argument

Definition at line 2143 of file solaris-niagara2.c.

{
#ifdef DEBUG
    SUBDBG( "ENTERING FUNCTION >>%s<< at %s:%d\n", __func__, __FILE__,
            __LINE__ );
#endif

    switch ( code ) {
    case SYNTHETIC_CYCLES_ELAPSED:

#ifdef DEBUG
        SUBDBG( "LEAVING FUNCTION  >>%s<< at %s:%d\n", __func__, __FILE__,
                __LINE__ );
#endif
        return PAPI_OK;
    default:

#ifdef DEBUG
        SUBDBG( "LEAVING FUNCTION  >>%s<< at %s:%d\n", __func__, __FILE__,
                __LINE__ );
#endif
        return PAPI_EINVAL;
    }
#ifdef DEBUG
    SUBDBG( "LEAVING FUNCTION  >>%s<< at %s:%d\n", __func__, __FILE__,
            __LINE__ );
#endif
}

Here is the caller graph for this function:

Definition at line 2176 of file solaris-niagara2.c.

{
    int i = 0;

#ifdef DEBUG
    SUBDBG( "ENTERING FUNCTION >>%s<< at %s:%d\n", __func__, __FILE__,
            __LINE__ );
#endif

    /* Count all synthetic events in __int_syn_table, the last event is marked
       with an event code of -1. */
    while ( __int_syn_table[i].code != -1 ) {
        __t2_store.syn_evt_count++;
        i++;
    }

#ifdef DEBUG
    SUBDBG( "LEAVING FUNCTION  >>%s<< at %s:%d\n", __func__, __FILE__,
            __LINE__ );
#endif
}

Here is the caller graph for this function:

Definition at line 2202 of file solaris-niagara2.c.

{
    /* The first index of a synthetic event starts after last native event */
    int i = 0;
    int offset = _niagara2_vector.cmp_info.num_native_events + 1 -
        __t2_store.syn_evt_count;

#ifdef DEBUG
    SUBDBG( "ENTERING FUNCTION >>%s<< at %s:%d\n", __func__, __FILE__,
            __LINE__ );
#endif

    while ( i < __t2_store.syn_evt_count ) {
        __t2_ntv_events[i + offset] = papi_strdup( __int_syn_table[i].name );
        i++;
    }

#ifdef DEBUG
    SUBDBG( "LEAVING FUNCTION  >>%s<< at %s:%d\n", __func__, __FILE__,
            __LINE__ );
#endif
}

Here is the caller graph for this function:

static int __sol_get_itimer_ns ( int  ns) [inline, static]

Definition at line 1986 of file solaris-niagara2.c.

{
    if ( ns < _papi_os_info.itimer_res_ns ) {
        return _papi_os_info.itimer_res_ns;
    } else {
        int leftover_ns = ns % _papi_os_info.itimer_res_ns;
        return ns + leftover_ns;
    }
}

Here is the caller graph for this function:

static lwpstatus_t* __sol_get_lwp_status ( const pid_t  pid,
const lwpid_t  lwpid 
) [inline, static]

Definition at line 1997 of file solaris-niagara2.c.

{
    char *pattern = "/proc/%d/lwp/%d/lwpstatus";
    char filename[PAPI_MIN_STR_LEN];
    int fd;
    static lwpstatus_t lwp;

#ifdef DEBUG
    SUBDBG( "ENTERING FUNCTION >>%s<< at %s:%d\n", __func__, __FILE__,
            __LINE__ );
#endif

    memset( &lwp, 0, sizeof ( lwp ) );
    snprintf( filename, PAPI_MIN_STR_LEN, pattern, pid, lwpid );

    fd = open( filename, O_RDONLY );
    if ( fd == -1 )
        return NULL;

    read( fd, ( void * ) &lwp, sizeof ( lwp ) );

    close( fd );

#ifdef DEBUG
    SUBDBG( "LEAVING FUNCTION  >>%s<< at %s:%d\n", __func__, __FILE__,
            __LINE__ );
#endif

    return &lwp;
}

Here is the call graph for this function:

static psinfo_t* __sol_get_proc_info ( const pid_t  pid) [inline, static]

Definition at line 2029 of file solaris-niagara2.c.

{
    char *pattern = "/proc/%d/psinfo";
    char filename[PAPI_MIN_STR_LEN];
    int fd;
    static psinfo_t proc;

#ifdef DEBUG
    SUBDBG( "ENTERING FUNCTION >>%s<< at %s:%d\n", __func__, __FILE__,
            __LINE__ );
#endif

    memset( &proc, 0, sizeof ( proc ) );
    snprintf( filename, PAPI_MIN_STR_LEN, pattern, pid );

    fd = open( filename, O_RDONLY );
    if ( fd == -1 )
        return NULL;

    read( fd, ( void * ) &proc, sizeof ( proc ) );

    close( fd );

#ifdef DEBUG
    SUBDBG( "LEAVING FUNCTION  >>%s<< at %s:%d\n", __func__, __FILE__,
            __LINE__ );
#endif

    return &proc;
}

Here is the call graph for this function:

static pstatus_t* __sol_get_proc_status ( const pid_t  pid) [inline, static]

Definition at line 2061 of file solaris-niagara2.c.

{
    char *pattern = "/proc/%d/status";
    char filename[PAPI_MIN_STR_LEN];
    int fd;
    static pstatus_t proc;

#ifdef DEBUG
    SUBDBG( "ENTERING FUNCTION >>%s<< at %s:%d\n", __func__, __FILE__,
            __LINE__ );
#endif

    memset( &proc, 0, sizeof ( proc ) );
    snprintf( filename, PAPI_MIN_STR_LEN, pattern, pid );

    fd = open( filename, O_RDONLY );
    if ( fd == -1 )
        return NULL;

    read( fd, ( void * ) &proc, sizeof ( proc ) );

    close( fd );

#ifdef DEBUG
    SUBDBG( "LEAVING FUNCTION  >>%s<< at %s:%d\n", __func__, __FILE__,
            __LINE__ );
#endif

    return &proc;
}

Here is the call graph for this function:

static int __sol_get_processor_clock ( void  ) [inline, static]

< A System/C library call failed

Definition at line 1954 of file solaris-niagara2.c.

{
    processor_info_t pinfo;

#ifdef DEBUG
    SUBDBG( "ENTERING FUNCTION >>%s<< at %s:%d\n", __func__, __FILE__,
            __LINE__ );
#endif

    // Fetch information from the first processor in the system
    if ( processor_info( getcpuid(  ), &pinfo ) == 0 ) {

#ifdef DEBUG
        SUBDBG( " -> %s: Clock at %d MHz\n", __func__, pinfo.pi_clock );
#endif

        return pinfo.pi_clock;
    }
#ifdef DEBUG
    SUBDBG( "LEAVING FUNCTION  >>%s<< at %s:%d\n", __func__, __FILE__,
            __LINE__ );
#endif

    return PAPI_ESYS;
}
int _niagara2_ctl ( _niagara2_context_t ctx,
int  code,
_papi_int_option_t option 
)

< Domain for all new eventsets. Takes non-NULL option pointer.

< No error

< Domain for an eventset

< Granularity for all new eventsets

< No error

< Granularity for an eventset

< No error

< Multiplexing/overflowing interval in ns, same as PAPI_DEF_ITIMER_NS

< No error

< Option to set the type of itimer used in both software multiplexing, overflowing and profiling

< Invalid argument

< Invalid argument

< Invalid argument

< No error

< Multiplexing/overflowing interval in ns, same as PAPI_DEF_MPX_NS

< No error

< Invalid argument

Definition at line 275 of file solaris-niagara2.c.

{
#ifdef DEBUG
    SUBDBG( "ENTERING FUNCTION >>%s<< at %s:%d\n", __func__, __FILE__,
            __LINE__ );
    SUBDBG( " -> %s: Option #%d requested\n", __func__, code );
#endif

    /* Only these options are handled which are handled in PAPI_set_opt, as many
       of the left out options are not settable, like PAPI_MAX_CPUS. */

    switch ( code ) {
    case PAPI_DEFDOM:
        /* From papi.h: Domain for all new eventsets. Takes non-NULL option
           pointer. */

        _niagara2_vector.cmp_info.default_domain = option->domain.domain;

        return PAPI_OK;
    case PAPI_DOMAIN:
        /* From papi.h: Domain for an eventset */

        return _niagara2_set_domain( ctx, option->domain.domain );
    case PAPI_DEFGRN:
        /* From papi.h: Granularity for all new eventsets */

        _niagara2_vector.cmp_info.default_granularity =
            option->granularity.granularity;

        return PAPI_OK;
    case PAPI_GRANUL:
        /* From papi.h: Granularity for an eventset */

        /* Only supported granularity is PAPI_GRN_THREAD */

        return PAPI_OK;
    case PAPI_DEF_MPX_NS:
        /* From papi.h: Multiplexing/overflowing interval in ns, same as
           PAPI_DEF_ITIMER_NS */

        /* From the old component */
        option->itimer.ns = __sol_get_itimer_ns( option->itimer.ns );

#ifdef DEBUG
        SUBDBG( " -> %s: PAPI_DEF_MPX_NS, option->itimer.ns=%d\n",
                __func__, option->itimer.ns );
#endif

        return PAPI_OK;
    case PAPI_DEF_ITIMER:    // IN THE OLD COMPONENT // USED
        /* From papi.h: Option to set the type of itimer used in both software
           multiplexing, overflowing and profiling */

        /* These tests are taken from the old component. For Solaris 10 the
           same rules apply as documented in getitimer(2). */

        if ( ( option->itimer.itimer_num == ITIMER_REAL ) &&
             ( option->itimer.itimer_sig != SIGALRM ) ) {
#ifdef DEBUG
            SUBDBG( " -> %s: PAPI_DEF_ITIMER, ITIMER_REAL needs SIGALRM\n",
                    __func__ );
#endif

            return PAPI_EINVAL;
        }


        if ( ( option->itimer.itimer_num == ITIMER_VIRTUAL ) &&
             ( option->itimer.itimer_sig != SIGVTALRM ) ) {
#ifdef DEBUG
            SUBDBG( " -> %s: PAPI_DEF_ITIMER, ITIMER_VIRTUAL needs SIGVTALRM\n",
                    __func__ );
#endif

            return PAPI_EINVAL;
        }


        if ( ( option->itimer.itimer_num == ITIMER_PROF ) &&
             ( option->itimer.itimer_sig != SIGPROF ) ) {
#ifdef DEBUG
            SUBDBG( " -> %s: PAPI_DEF_ITIMER, ITIMER_PROF needs SIGPROF\n",
                    __func__ );
#endif

            return PAPI_EINVAL;
        }


        /* As in the old component defined, timer values below 0 are NOT
           filtered out, but timer values greater than 0 are rounded, either to
           a value which is at least itimer_res_ns or padded to a multiple of
           itimer_res_ns. */

        if ( option->itimer.ns > 0 ) {
            option->itimer.ns = __sol_get_itimer_ns( option->itimer.ns );

#ifdef DEBUG
            SUBDBG( " -> %s: PAPI_DEF_ITIMER, option->itimer.ns=%d\n",
                    __func__, option->itimer.ns );
#endif
        }

        return PAPI_OK;
    case PAPI_DEF_ITIMER_NS:    // IN THE OLD COMPONENT // USED
        /* From papi.h: Multiplexing/overflowing interval in ns, same as
           PAPI_DEF_MPX_NS */

        /* From the old component */
        option->itimer.ns = __sol_get_itimer_ns( option->itimer.ns );

#ifdef DEBUG
        SUBDBG( " -> %s: PAPI_DEF_ITIMER_NS, option->itimer.ns=%d\n",
                __func__, option->itimer.ns );
#endif

        return PAPI_OK;
    }

#ifdef DEBUG
    SUBDBG( " -> %s: Option not found\n", __func__ );
    SUBDBG( "LEAVING FUNCTION  >>%s<< at %s:%d\n", __func__, __FILE__,
            __LINE__ );
#endif

    /* This place should never be reached */
    return PAPI_EINVAL;
}

Here is the call graph for this function:

void _niagara2_dispatch_timer ( int  signal,
siginfo_t si,
void *  info 
)

< EventSet has overflowing enabled

< No error

Definition at line 405 of file solaris-niagara2.c.

{
    EventSetInfo_t *ESI = NULL;
    ThreadInfo_t *thread = NULL;
    int overflow_vector = 0;
    hwd_control_state_t *ctrl = NULL;
    long_long results[MAX_COUNTERS];
    int i;
    // Hint from perf_events.c
    int cidx = _niagara2_vector.cmp_info.CmpIdx;


#ifdef DEBUG
    SUBDBG( "ENTERING FUNCTION >>%s<< at %s:%d\n", __func__, __FILE__,
            __LINE__ );
    SUBDBG( " -> %s: Overflow handler called by signal #%d\n", __func__,
            signal );
#endif

    /* From the old component */
    thread = _papi_hwi_lookup_thread( 0 );
    ESI = ( EventSetInfo_t * ) thread->running_eventset[cidx];

    /* From the old component, modified */
    // 
    if ( ESI == NULL || ESI->master != thread || ESI->ctl_state == NULL ||
         ( ( ESI->state & PAPI_OVERFLOWING ) == 0 ) ) {
#ifdef DEBUG
        SUBDBG( " -> %s: Problems with ESI, not necessarily serious\n",
                __func__ );

        if ( ESI == NULL ) {
            SUBDBG( " -> %s: +++ ESI is NULL\n", __func__ );
        }

        if ( ESI->master != thread ) {
            SUBDBG( " -> %s: +++ Thread mismatch, ESI->master=%x thread=%x\n",
                    __func__, ESI->master, thread );
        }

        if ( ESI->ctl_state == NULL ) {
            SUBDBG( " -> %s: +++ Counter state invalid\n", __func__ );
        }

        if ( ( ( ESI->state & PAPI_OVERFLOWING ) == 0 ) ) {
            SUBDBG
                ( " -> %s: +++ Overflow flag missing, ESI->overflow.flags=%x\n",
                  __func__, ESI->overflow.flags );
        }
#endif

        return;
    }
#ifdef DEBUG
    printf( " -> %s: Preconditions valid, trying to read counters\n",
            __func__ );
#endif

    ctrl = ESI->ctl_state;

    if ( _niagara2_read
         ( ctrl, ctrl, ( long_long ** ) & results, NOT_A_PAPI_HWD_READ )
         != PAPI_OK ) {
        /* Failure */

#ifdef DEBUG
        printf( "%s: Failed to read counters\n", __func__ );
#endif

        return;
    } else {
        /* Success */

#ifdef DEBUG
        SUBDBG( " -> %s: Counters read\n", __func__ );
#endif

        /* Iterate over all available counters in order to detect which counter
           overflowed (counter value should be 0 if an hw overflow happened),
           store the position in the overflow_vector, calculte the offset and
           shift (value range signed long long vs. unsigned long long). */
        for ( i = 0; i < ctrl->count; i++ ) {
            if ( results[i] >= 0 ) {
#ifdef DEBUG
                SUBDBG( " -> %s: Overflow detected at PIC #%d\n", __func__, i );
#endif

                /* Set the bit in the overflow_vector */
                overflow_vector = overflow_vector | ( 1 << i );

                /* hoose which method to use depending on the overflow signal. */
                if ( signal == SIGEMT ) {
                    /* Store the counter value, but only if we have a real *
                       hardware overflow counting with libcpc/SIGEMT. */
                    ctrl->preset[i] = UINT64_MAX - ctrl->threshold[i];
                    ctrl->hangover[i] += ctrl->threshold[i];
                } else {
                    /* Push the value back, this time PAPI does the work. This is
                       software overflow handling. */
                    cpc_request_preset( cpc, ctrl->idx[i], ctrl->result[i] );
                }
            } else {
#ifdef DEBUG
                SUBDBG( " -> %s: No overflow detected at PIC #%d, value=%ld\n",
                        __func__, i, results[i] );
#endif

                /* Save the results read from the counter as we can not store the
                   temporary value in hardware or libcpc. */
                if ( signal == SIGEMT ) {
                    ctrl->preset[i] += results[i];
                    ctrl->hangover[i] = results[i];
                }
            }
        }

#ifdef DEBUG
        SUBDBG( " -> %s: Restarting set to push values back\n", __func__ );
#endif

        /* Push all values back to the counter as preset */
        cpc_set_restart( cpc, ctrl->set );
    }

#ifdef DEBUG
    SUBDBG( " -> %s: Passing overflow to PAPI with overflow_vector=%p\n",
            __func__, overflow_vector );
#endif

    {
        /* hw is used as pointer in the dispatching routine of PAPI and might be
           changed. For safety it is not a pseudo pointer to NULL. */
        int hw;

        if ( signal == SIGEMT ) {
            /* This is a hardware overflow */
            hw = 1;
            _papi_hwi_dispatch_overflow_signal( ctrl, ( caddr_t )
                                                _niagara2_get_overflow_address
                                                ( info ), &hw, overflow_vector,
                                                1, &thread, ESI->CmpIdx );
        } else {
            /* This is a software overflow */
            hw = 0;
            _papi_hwi_dispatch_overflow_signal( ctrl, ( caddr_t )
                                                _niagara2_get_overflow_address
                                                ( info ), &hw, overflow_vector,
                                                1, &thread, ESI->CmpIdx );
        }
    }

#ifdef DEBUG
    SUBDBG( "LEAVING FUNCTION  >>%s<< at %s:%d\n", __func__, __FILE__,
            __LINE__ );
#endif
}

Here is the call graph for this function:

static void* _niagara2_get_overflow_address ( void *  context) [inline, static]

Definition at line 563 of file solaris-niagara2.c.

{
    ucontext_t *ctx = ( ucontext_t * ) context;

#ifdef DEBUG
    SUBDBG( "ENTERING/LEAVING FUNCTION >>%s<< at %s:%d\n", __func__, __FILE__,
            __LINE__ );
#endif

    return ( void * ) ctx->uc_mcontext.gregs[REG_PC];
}

Here is the caller graph for this function:

int _niagara2_init_component ( int  cidx)

< Not supported by component

< No error

< Not supported by component

< No error

< Not supported by component

< No error

< Not supported by component

< No error

< Not supported by component

< No error

Definition at line 654 of file solaris-niagara2.c.

{
#ifdef DEBUG
    SUBDBG( "ENTERING FUNCTION >>%s<< at %s:%d\n", __func__, __FILE__,
            __LINE__ );
#endif

    /* Create an instance of libcpc */
#ifdef DEBUG
    SUBDBG( " -> %s: Trying to initalize libcpc\n", __func__ );
#endif
    cpc = cpc_open( CPC_VER_CURRENT );
    __CHECK_ERR_NULL( cpc );

#ifdef DEBUG
    SUBDBG( " -> %s: Registering libcpc error handler\n", __func__ );
#endif
    cpc_seterrhndlr( cpc, __cpc_error_handler );

#ifdef DEBUG
    SUBDBG( " -> %s: Detecting supported PICs", __func__ );
#endif
    __t2_store.npic = cpc_npic( cpc );

#ifdef DEBUG
    SUBDBG( " -> %s: Storing component index, cidx=%d\n", __func__, cidx );
#endif
    _niagara2_vector.cmp_info.CmpIdx = cidx;

#ifdef DEBUG
    SUBDBG( " -> %s: Gathering system information for PAPI\n", __func__ );
#endif
    /* Store system info in central data structure */
    __CHECK_ERR_PAPI( _niagara2_get_system_info( &_papi_hwi_system_info ) );

#ifdef DEBUG
    SUBDBG( " -> %s: Initializing locks\n", __func__ );
#endif
    /* Set up the lock after initialization */
    _niagara2_lock_init(  );

    // Copied from the old component, _papi_init_component()
    SUBDBG( "Found %d %s %s CPUs at %d Mhz.\n",
            _papi_hwi_system_info.hw_info.totalcpus,
            _papi_hwi_system_info.hw_info.vendor_string,
            _papi_hwi_system_info.hw_info.model_string,
            _papi_hwi_system_info.hw_info.cpu_max_mhz );

    /* Build native event table */
#ifdef DEBUG
    SUBDBG( " -> %s: Building native event table\n", __func__ );
#endif
    __CHECK_ERR_PAPI( __cpc_build_ntv_table(  ) );

    /* Build preset event table */
#ifdef DEBUG
    SUBDBG( " -> %s: Building PAPI preset table\n", __func__ );
#endif
    __CHECK_ERR_PAPI( __cpc_build_pst_table(  ) );

    /* Register presets and finish event related setup */
#ifdef DEBUG
    SUBDBG( " -> %s: Registering presets in PAPI\n", __func__ );
#endif
    __CHECK_ERR_PAPI( _papi_hwi_setup_all_presets( preset_table, NULL ) );

#ifdef DEBUG
    SUBDBG( "LEAVING FUNCTION  >>%s<< at %s:%d\n", __func__, __FILE__,
            __LINE__ );
#endif

    /* Everything is ok */
    return PAPI_OK;
}

Here is the call graph for this function:

Although the created set in this function will be destroyed by _papi_update_control_state later, at least the functionality of the underlying CPU driver will be tested completly.

< No error

Definition at line 582 of file solaris-niagara2.c.

{
    int i;

#ifdef DEBUG
    SUBDBG( "ENTERING FUNCTION >>%s<< at %s:%d\n", __func__, __FILE__,
            __LINE__ );
#endif

    // cpc_seterrhndlr(cpc, myapp_errfn);

    /* Clear the buffer */
    if ( ctrl->counter_buffer != NULL ) {
#ifdef DEBUG
        SUBDBG( " -> %s: Cleaning buffer\n", __func__ );
#endif

        cpc_buf_destroy( cpc, ctrl->counter_buffer );
        ctrl->counter_buffer = NULL;
    }

    /* Clear the set */
    if ( ctrl->set != NULL ) {
#ifdef DEBUG
        SUBDBG( " -> %s: Cleaning set\n", __func__ );
#endif

        cpc_set_destroy( cpc, ctrl->set );
        ctrl->set = NULL;
    }

    /* Indicate this idx has no request associated, this counter is unused. */
    for ( i = 0; i < MAX_COUNTERS; i++ ) {
#ifdef DEBUG
        SUBDBG( " -> %s: Cleaning counter state #%d\n", __func__, i );
#endif

        /* Indicate missing setup values */
        ctrl->idx[i] = EVENT_NOT_SET;
        ctrl->code[i].event_code = EVENT_NOT_SET;

        /* No flags yet set, this is for overflow and binding */
        ctrl->flags[i] = 0;

        /* Preset value for counting results */
        ctrl->preset[i] = DEFAULT_CNTR_PRESET;

        /* Needed for overflow handling, will be set later */
        ctrl->threshold[i] = 0;
        ctrl->hangover[i] = 0;

#ifdef SYNTHETIC_EVENTS_SUPPORTED
        ctrl->syn_hangover[i] = 0;
#endif
    }

    /* No counters active in this set */
    ctrl->count = 0;

#ifdef SYNTHETIC_EVENTS_SUPPORTED
    ctrl->syn_count = 0;
#endif

#ifdef DEBUG
    SUBDBG( "LEAVING FUNCTION  >>%s<< at %s:%d\n", __func__, __FILE__,
            __LINE__ );
#endif

    return PAPI_OK;
}
static void _niagara2_lock_init ( void  ) [static]

< Used with setting up array

Definition at line 730 of file solaris-niagara2.c.

{
#ifdef DEBUG
    SUBDBG( "ENTERING FUNCTION >>%s<< at %s:%d\n", __func__, __FILE__,
            __LINE__ );
#endif

    /* Copied from old component, lock_init() */
    memset( lock, 0x0, sizeof ( rwlock_t ) * PAPI_MAX_LOCK );

#ifdef DEBUG
    SUBDBG( "LEAVING FUNCTION  >>%s<< at %s:%d\n", __func__, __FILE__,
            __LINE__ );
#endif
}

Here is the caller graph for this function:

int _niagara2_ntv_code_to_bits ( unsigned int  EventCode,
_niagara2_register_t bits 
)

< Event does not exist

< No error

Definition at line 747 of file solaris-niagara2.c.

{
    int event_code = EventCode & PAPI_NATIVE_AND_MASK;

#ifdef DEBUG
    SUBDBG( "ENTERING FUNCTION >>%s<< at %s:%d\n", __func__, __FILE__,
            __LINE__ );
#endif

    if ( event_code >= 0 &&
         event_code <= _niagara2_vector.cmp_info.num_native_events ) {
        return PAPI_ENOEVNT;
    }

    bits->event_code = event_code;

#ifdef DEBUG
    SUBDBG( "LEAVING FUNCTION  >>%s<< at %s:%d\n", __func__, __FILE__,
            __LINE__ );
#endif

    return PAPI_OK;
}
int _niagara2_ntv_code_to_descr ( unsigned int  EventCode,
char *  ntv_descr,
int  len 
)

Definition at line 772 of file solaris-niagara2.c.

{
#ifdef DEBUG
    SUBDBG( "ENTERING/LEAVING FUNCTION >>%s<< at %s:%d\n", __func__, __FILE__,
            __LINE__ );
#endif

    /* libcpc offers no descriptions, just a link to the reference manual */
    return _niagara2_ntv_code_to_name( EventCode, ntv_descr, len );
}

Here is the call graph for this function:

int _niagara2_ntv_code_to_name ( unsigned int  EventCode,
char *  ntv_name,
int  len 
)

< Buffer size exceeded

< No error

< Event does not exist

Definition at line 784 of file solaris-niagara2.c.

{
    int event_code = EventCode & PAPI_NATIVE_AND_MASK;

#ifdef DEBUG
    SUBDBG( "ENTERING FUNCTION >>%s<< at %s:%d\n", __func__, __FILE__,
            __LINE__ );
#endif

    if ( event_code >= 0 &&
         event_code <= _niagara2_vector.cmp_info.num_native_events ) {
        strlcpy( ntv_name, __t2_ntv_events[event_code], len );

        if ( strlen( __t2_ntv_events[event_code] ) > len - 1 ) {
#ifdef DEBUG
            SUBDBG( "LEAVING FUNCTION  >>%s<< at %s:%d\n", __func__, __FILE__,
                    __LINE__ );
#endif

            /* It's not a real error, but at least a hint */
            return PAPI_EBUF;
        }
#ifdef DEBUG
        SUBDBG( "LEAVING FUNCTION  >>%s<< at %s:%d\n", __func__, __FILE__,
                __LINE__ );
#endif

        return PAPI_OK;
    }
#ifdef DEBUG
    SUBDBG( "LEAVING FUNCTION  >>%s<< at %s:%d\n", __func__, __FILE__,
            __LINE__ );
#endif

    return PAPI_ENOEVNT;
}

Here is the caller graph for this function:

int _niagara2_ntv_enum_events ( unsigned int *  EventCode,
int  modifier 
)

< No error

< No error

< Event does not exist

Definition at line 822 of file solaris-niagara2.c.

{
    /* This code is very similar to the code from the old component. */

    int event_code = *EventCode & PAPI_NATIVE_AND_MASK;

#ifdef DEBUG
    SUBDBG( "ENTERING FUNCTION >>%s<< at %s:%d\n", __func__, __FILE__,
            __LINE__ );
#endif

    if ( modifier == PAPI_ENUM_FIRST ) {
        *EventCode = PAPI_NATIVE_MASK + 1;

#ifdef DEBUG
        SUBDBG( "LEAVING FUNCTION  >>%s<< at %s:%d\n", __func__, __FILE__,
                __LINE__ );
#endif

        return PAPI_OK;
    }

    /* The table needs to be shifted by one position (starting index 1), as PAPI
       expects native event codes not to be 0 (papi_internal.c:744). */

    if ( event_code >= 1 &&
         event_code <= _niagara2_vector.cmp_info.num_native_events - 1 ) {
        *EventCode = *EventCode + 1;

#ifdef DEBUG
        SUBDBG( "LEAVING FUNCTION  >>%s<< at %s:%d\n", __func__, __FILE__,
                __LINE__ );
#endif

        return PAPI_OK;
    }
#ifdef DEBUG
    SUBDBG( "LEAVING FUNCTION  >>%s<< at %s:%d\n", __func__, __FILE__,
            __LINE__ );
#endif

    // If nothing found report an error
    return PAPI_ENOEVNT;
}
int _niagara2_read ( _niagara2_context_t ctx,
_niagara2_control_state_t ctrl,
long long **  events,
int  flags 
)

< Not supported by component

< Not supported by component

< No error

Definition at line 868 of file solaris-niagara2.c.

{
    int i;

#ifdef DEBUG
    SUBDBG( "ENTERING FUNCTION >>%s<< at %s:%d\n", __func__, __FILE__,
            __LINE__ );
    SUBDBG( " -> %s: called with flags=%p\n", __func__, flags );
#endif

    /* Take a new sample from the PIC to the buffer */
    __CHECK_ERR_DFLT( cpc_set_sample( cpc, ctrl->set, ctrl->counter_buffer ) );

    /* Copy the buffer values from all active counters */
    for ( i = 0; i < ctrl->count; i++ ) {
        /* Retrieve the counting results of libcpc */
        __CHECK_ERR_DFLT( cpc_buf_get( cpc, ctrl->counter_buffer, ctrl->idx[i],
                                       &ctrl->result[i] ) );

        /* As libcpc uses uint64_t and PAPI uses int64_t, we need to normalize
           the result back to a value that PAPI can handle, otherwise the result
           is not usable as its in the negative range of int64_t and the result
           becomes useless for PAPI. */
        if ( ctrl->threshold[i] > 0 ) {
#ifdef DEBUG
            SUBDBG( " -> %s: Normalizing result on PIC#%d to %lld\n",
                    __func__, i, ctrl->result[i] );
#endif /* DEBUG */

            /* This shifts the retrieved value back to the PAPI value range */
            ctrl->result[i] = ctrl->result[i] -
                ( UINT64_MAX - ctrl->threshold[i] ) - 1;

            /* Needed if called internally if a PIC didn't really overflow, but
               was programmed in the same set. */
            if ( flags != NOT_A_PAPI_HWD_READ ) {
                ctrl->result[i] = ctrl->hangover[i];
            }
#ifdef DEBUG
            SUBDBG( " -> %s: Overflow scaling on PIC#%d:\n", __func__, i );
            SUBDBG( " -> %s: +++ ctrl->result[%d]=%llu\n",
                    __func__, i, ctrl->result[i] );
            SUBDBG( " -> %s: +++ ctrl->threshold[%d]=%lld\n",
                    __func__, i, ctrl->threshold[i] );
            SUBDBG( " -> %s: +++ ctrl->hangover[%d]=%lld\n",
                    __func__, i, ctrl->hangover[i] );
#endif
        }
#ifdef DEBUG
        SUBDBG( " -> %s: +++ ctrl->result[%d]=%llu\n",
                __func__, i, ctrl->result[i] );
#endif
    }

#ifdef SYNTHETIC_EVENTS_SUPPORTED
    {
        int i;
        const int syn_barrier = _niagara2_vector.cmp_info.num_native_events
            - __t2_store.syn_evt_count;

        for ( i = 0; i < ctrl->count; i++ ) {
            if ( ctrl->code[i].event_code >= syn_barrier ) {
                ctrl->result[i] =
                    __int_get_synthetic_event( ctrl->code[i].event_code
                                               - syn_barrier, ctrl, &i );
            }
        }
    }
#endif

    /* Pass the address of the results back to the calling function */
    *events = ( long_long * ) & ctrl->result[0];

#ifdef DEBUG
    SUBDBG( "LEAVING: %s\n", "_papi_read" );
#endif

    return PAPI_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

< No error

Definition at line 950 of file solaris-niagara2.c.

{
#ifdef DEBUG
    SUBDBG( "ENTERING FUNCTION >>%s<< at %s:%d\n", __func__, __FILE__,
            __LINE__ );
#endif

    /* This does a restart of the whole set, setting the internal counters back
       to the value passed as preset of the last call of cpc_set_add_request or
       cpc_request_preset. */
    cpc_set_restart( cpc, ctrl->set );

#ifdef SYNTHETIC_EVENTS_SUPPORTED
    {
        const int syn_barrier = _niagara2_vector.cmp_info.num_native_events
            - __t2_store.syn_evt_count;
        int i;

        if ( ctrl->syn_count > 0 ) {
            for ( i = 0; i < MAX_COUNTERS; i++ ) {
                if ( ctrl->code[i].event_code >= syn_barrier ) {

                    ctrl->syn_hangover[i] +=
                        __int_get_synthetic_event( ctrl->code[i].event_code -
                                                   syn_barrier, ctrl, &i );
                }
            }
        }
    }
#endif

#ifdef DEBUG
    SUBDBG( "LEAVING FUNCTION  >>%s<< at %s:%d\n", __func__, __FILE__,
            __LINE__ );
#endif

    return PAPI_OK;
}

Here is the call graph for this function:

int _niagara2_set_domain ( _niagara2_control_state_t ctrl,
int  domain 
)

PAPI HWD LAYER RELATED FUNCTIONS ///////////////////////////////////////////

< No error

< Not supported by component

< No error

Definition at line 231 of file solaris-niagara2.c.

{
    int i;

#ifdef DEBUG
    SUBDBG( "ENTERING FUNCTION >>%s<< at %s:%d\n", __func__, __FILE__,
            __LINE__ );
#endif

    /* Clean and set the new flag for each counter */

    for ( i = 0; i < MAX_COUNTERS; i++ ) {
#ifdef DEBUG
        SUBDBG( " -> %s: Setting flags for PIC#%d, old value: %p\n",
                __func__, i, ctrl->flags[i] );
#endif

        ctrl->flags[i] &= ~( CPC_COUNTING_DOMAINS );

#ifdef DEBUG
        SUBDBG( " -> %s: +++                      cleaned value: %p\n",
                __func__, ctrl->flags[i] );
#endif

        ctrl->flags[i] |= __cpc_domain_translator( domain );

#ifdef DEBUG
        SUBDBG( " -> %s: +++                      new value: %p\n",
                __func__, ctrl->flags[i] );
#endif
    }

    /* Recreate the set */
    __CHECK_ERR_PAPI( __cpc_recreate_set( ctrl ) );

#ifdef DEBUG
    SUBDBG( "LEAVING FUNCTION  >>%s<< at %s:%d\n", __func__, __FILE__,
            __LINE__ );
#endif

    return PAPI_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int _niagara2_set_overflow ( EventSetInfo_t ESI,
int  EventIndex,
int  threshold 
)

< No error

< A System/C library call failed

< No error

< Not supported by component

< No error

< Not supported by component

< No error

Definition at line 1003 of file solaris-niagara2.c.

{
    hwd_control_state_t *ctrl = ESI->ctl_state;
    struct sigaction sigact;

#ifdef DEBUG
    SUBDBG( "ENTERING FUNCTION >>%s<< at %s:%d\n", __func__, __FILE__,
            __LINE__ );
    SUBDBG( " -> %s: Overflow handling for 0x%x on PIC#%d requested\n",
            __func__, ctrl, EventIndex );
    SUBDBG( " -> %s: ESI->overflow.flags=%#x\n\n", __func__, ctrl,
            ESI->overflow.flags );
#endif

    /* If threshold > 0, then activate hardware overflow handling, otherwise
       disable it. */
    if ( threshold > 0 ) {
#ifdef DEBUG
        SUBDBG( " -> %s: Activating overflow handling\n", __func__ );
#endif

        ctrl->preset[EventIndex] = UINT64_MAX - threshold;
        ctrl->threshold[EventIndex] = threshold;

        /* If SIGEMT is not yet enabled, enable it. In libcpc this means to re-
           recreate the used set. In order not to break PAPI operations only the
           event referred by EventIndex will be updated to use SIGEMT. */
        if ( !( ctrl->flags[EventIndex] & CPC_OVF_NOTIFY_EMT ) ) {
#ifdef DEBUG
            SUBDBG( " -> %s: Need to activate SIGEMT on PIC %d\n",
                    __func__, EventIndex );
#endif

            /* Enable overflow handling */
            if ( __cpc_enable_sigemt( ctrl, EventIndex ) != PAPI_OK ) {
#ifdef DEBUG
                SUBDBG( " -> %s: Activating SIGEMT failed for PIC %d\n",
                        __func__, EventIndex );
#endif

                return PAPI_ESYS;
            }
        }
#ifdef DEBUG
        SUBDBG( " -> %s: SIGEMT activated, will install signal handler\n",
                __func__ );
#endif

        // FIXME: Not really sure that this construct is working
        return _papi_hwi_start_signal( SIGEMT, 1, 0 );

    } else {
#ifdef DEBUG
        SUBDBG( " -> %s: Disabling overflow handling\n", __func__ );
#endif

        /* Resetting values which were used for overflow handling */
        ctrl->preset[EventIndex] = DEFAULT_CNTR_PRESET;
        ctrl->flags[EventIndex] &= ~( CPC_OVF_NOTIFY_EMT );
        ctrl->threshold[EventIndex] = 0;
        ctrl->hangover[EventIndex] = 0;

#ifdef DEBUG
        SUBDBG( " -> %s:ctrl->preset[%d]=%d, ctrl->flags[%d]=%p\n",
                __func__, EventIndex, ctrl->preset[EventIndex],
                EventIndex, ctrl->flags[EventIndex] );
#endif

        /* Recreate the undelying set and disable the signal handler */
        __CHECK_ERR_PAPI( __cpc_recreate_set( ctrl ) );
        __CHECK_ERR_PAPI( _papi_hwi_stop_signal( SIGEMT ) );
    }



#ifdef DEBUG
    SUBDBG( "LEAVING FUNCTION  >>%s<< at %s:%d\n", __func__, __FILE__,
            __LINE__ );
#endif

    return PAPI_OK;
}

Here is the call graph for this function:

int _niagara2_set_profile ( EventSetInfo_t ESI,
int  EventIndex,
int  threshold 
)

< Not supported

Definition at line 990 of file solaris-niagara2.c.

{
    /* Seems not to be used. */

#ifdef DEBUG
    SUBDBG( "ENTERING/LEAVING FUNCTION >>%s<< at %s:%d\n", __func__, __FILE__,
            __LINE__ );
#endif

    return PAPI_ENOSUPP;
}

< No error

Definition at line 1087 of file solaris-niagara2.c.

{
#ifdef DEBUG
    SUBDBG( "ENTERING FUNCTION >>%s<< at %s:%d\n", __func__, __FILE__,
            __LINE__ );
#endif

    cpc_buf_destroy( cpc, ctx->counter_buffer );
    cpc_set_destroy( cpc, ctx->set );

#ifdef DEBUG
    SUBDBG( "LEAVING FUNCTION  >>%s<< at %s:%d\n", __func__, __FILE__,
            __LINE__ );
#endif

    return PAPI_OK;
}
int _niagara2_shutdown_global ( void  )

< No error

Definition at line 1106 of file solaris-niagara2.c.

{
#ifdef DEBUG
    SUBDBG( "ENTERING FUNCTION >>%s<< at %s:%d\n", __func__, __FILE__,
            __LINE__ );
#endif

    /* Free allocated memory */

    // papi_calloc in __cpc_build_ntv_table
    papi_free( __t2_store.pic_ntv_count );
    // papi_calloc in __cpc_build_ntv_table
    papi_free( __t2_ntv_events );
    // papi_calloc in __cpc_build_pst_table
    papi_free( preset_table );

    /* Shutdown libcpc */

    // cpc_open in _papi_init_component
    cpc_close( cpc );

#ifdef DEBUG
    SUBDBG( "LEAVING FUNCTION  >>%s<< at %s:%d\n", __func__, __FILE__,
            __LINE__ );
#endif

    return PAPI_OK;
}

< Not supported by component

< Not supported by component

< No error

Definition at line 1136 of file solaris-niagara2.c.

{
    int retval;

#ifdef DEBUG
    SUBDBG( "ENTERING FUNCTION >>%s<< at %s:%d\n", __func__, __FILE__,
            __LINE__ );
    SUBDBG( " -> %s: Starting EventSet %p\n", __func__, ctrl );
#endif


#ifdef SYNTHETIC_EVENTS_SUPPORTED
    {
#ifdef DEBUG
        SUBDBG( " -> %s: Event count: ctrl->count=%d, ctrl->syn_count=%d\n",
                __func__, ctrl->count, ctrl->syn_count );
#endif

        if ( ctrl->count > 0 && ctrl->count == ctrl->syn_count ) {
            ctrl->idx[0] = cpc_set_add_request( cpc, ctrl->set, "Instr_cnt",
                                                ctrl->preset[0], ctrl->flags[0],
                                                0, NULL );
            ctrl->counter_buffer = cpc_buf_create( cpc, ctrl->set );
        }
    }
#endif

#ifdef DEBUG
    {
        int i;

        for ( i = 0; i < MAX_COUNTERS; i++ ) {
            SUBDBG( " -> %s: Flags for PIC#%d: ctrl->flags[%d]=%d\n", __func__,
                    i, i, ctrl->flags[i] );
        }
    }
#endif

    __CHECK_ERR_DFLT( cpc_bind_curlwp( cpc, ctrl->set, CPC_BIND_LWP_INHERIT ) );

    /* Ensure the set is working properly */
    retval = cpc_set_sample( cpc, ctrl->set, ctrl->counter_buffer );

    if ( retval != 0 ) {
        printf( "%s: cpc_set_sample failed, return=%d, errno=%d\n",
                __func__, retval, errno );
        return PAPI_ECMP;
    }
#ifdef DEBUG
    SUBDBG( "LEAVING FUNCTION  >>%s<< at %s:%d\n", __func__, __FILE__,
            __LINE__ );
#endif

    return PAPI_OK;
}

< Not supported by component

< No error

Definition at line 1193 of file solaris-niagara2.c.

{
#ifdef DEBUG
    SUBDBG( "ENTERING FUNCTION >>%s<< at %s:%d\n", __func__, __FILE__,
            __LINE__ );
#endif

    __CHECK_ERR_DFLT( cpc_unbind( cpc, ctrl->set ) );

#ifdef DEBUG
    SUBDBG( "LEAVING FUNCTION  >>%s<< at %s:%d\n", __func__, __FILE__,
            __LINE__ );
#endif

    return PAPI_OK;
}
int _niagara2_update_control_state ( _niagara2_control_state_t ctrl,
NativeInfo_t native,
int  count,
_niagara2_context_t ctx 
)

< Not supported by component

< Not supported by component

< Not supported by component

< User context counted

< Not supported by component

< Not supported by component

< No error

Definition at line 1211 of file solaris-niagara2.c.

{
    int i;

#ifdef DEBUG
    SUBDBG( "ENTERING FUNCTION >>%s<< at %s:%d\n", __func__, __FILE__,
            __LINE__ );
#endif

    /* Delete everything as we can't change an existing set */
    if ( ctrl->counter_buffer != NULL ) {
        __CHECK_ERR_DFLT( cpc_buf_destroy( cpc, ctrl->counter_buffer ) );
    }

    if ( ctrl->set != NULL ) {
        __CHECK_ERR_DFLT( cpc_set_destroy( cpc, ctrl->set ) );
    }

    for ( i = 0; i < MAX_COUNTERS; i++ ) {
        ctrl->idx[i] = EVENT_NOT_SET;
    }

    /* New setup */

    ctrl->set = cpc_set_create( cpc );
    __CHECK_ERR_NULL( ctrl->set );

    ctrl->count = count;
    ctrl->syn_count = 0;

    for ( i = 0; i < count; i++ ) {
        /* Store the active event */
        ctrl->code[i].event_code = native[i].ni_event & PAPI_NATIVE_AND_MASK;

        ctrl->flags[i] = __cpc_domain_translator( PAPI_DOM_USER );
        ctrl->preset[i] = DEFAULT_CNTR_PRESET;

#ifdef DEBUG
        SUBDBG
            ( " -> %s: EventSet@0x%p/PIC#%d - ntv request >>%s<< (%d), flags=%#x\n",
              __func__, ctrl, i, __t2_ntv_events[ctrl->code[i].event_code],
              ctrl->code[i].event_code, ctrl->flags[i] );
#endif

        /* Store the counter position (???) */
        native[i].ni_position = i;

#ifdef SYNTHETIC_EVENTS_SUPPORTED
        {
            int syn_code = ctrl->code[i].event_code -
                ( _niagara2_vector.cmp_info.num_native_events
                  - __t2_store.syn_evt_count ) - 1;

            /* Check if the event code is bigger than the CPC provided events. */
            if ( syn_code >= 0 ) {
#ifdef DEBUG
                SUBDBG
                    ( " -> %s: Adding synthetic event 0x%x (%s) on position %d\n",
                      __func__, native[i].ni_event,
                      __t2_ntv_events[ctrl->code[i].event_code], i );
#endif

                /* Call the setup routine */
                __int_setup_synthetic_event( syn_code, ctrl, NULL );

                /* Clean the hangover count as this event is new */
                ctrl->syn_hangover[i] = 0;

                /* Register this event as being synthetic, as an event set only
                   based on synthetic events can not be actived through libcpc */
                ctrl->syn_count++;

                /* Jump to next iteration */
                continue;
            }
        }
#endif

#ifdef DEBUG
        SUBDBG( " -> %s: Adding native event 0x%x (%s) on position %d\n",
                __func__, native[i].ni_event,
                __t2_ntv_events[ctrl->code[i].event_code], i );
#endif

        /* Pass the event as request to libcpc */
        ctrl->idx[i] = cpc_set_add_request( cpc, ctrl->set,
                                            __t2_ntv_events[ctrl->code[i].
                                                            event_code],
                                            ctrl->preset[i], ctrl->flags[i], 0,
                                            NULL );
        __CHECK_ERR_NEGV( ctrl->idx[i] );
    }

#ifdef DEBUG
    if ( i == 0 ) {
        SUBDBG( " -> %s: nothing added\n", __func__ );
    }
#endif

    ctrl->counter_buffer = cpc_buf_create( cpc, ctrl->set );
    __CHECK_ERR_NULL( ctrl->counter_buffer );

    /* Finished the new setup */

    /* Linking to context (same data type by typedef!) */
    ctx = ctrl;

#ifdef DEBUG
    SUBDBG( "LEAVING FUNCTION  >>%s<< at %s:%d\n", __func__, __FILE__,
            __LINE__ );
#endif

    return PAPI_OK;
}

Here is the call graph for this function:

< A System/C library call failed

< A System/C library call failed

< No error

Definition at line 1329 of file solaris-niagara2.c.

{
    char *file = "/proc/self/map";
    char *resolve_pattern = "/proc/self/path/%s";

    char lastobject[PRMAPSZ];
    char link[PAPI_HUGE_STR_LEN];
    char path[PAPI_HUGE_STR_LEN];

    prmap_t mapping;

    int fd, count = 0, total = 0, position = -1, first = 1;
    caddr_t t_min, t_max, d_min, d_max;

    PAPI_address_map_t *pam, *cur;

#ifdef DEBUG
    SUBDBG( "ENTERING FUNCTION  >>%s<< at %s:%d\n", __func__, __FILE__,
            __LINE__ );
#endif

    fd = open( file, O_RDONLY );

    if ( fd == -1 ) {
        return PAPI_ESYS;
    }

    memset( lastobject, 0, PRMAPSZ );

#ifdef DEBUG
    SUBDBG( " -> %s: Preprocessing memory maps from procfs\n", __func__ );
#endif

    /* Search through the list of mappings in order to identify a) how many
       mappings are available and b) how many unique mappings are available. */
    while ( read( fd, &mapping, sizeof ( prmap_t ) ) > 0 ) {
#ifdef DEBUG
        SUBDBG( " -> %s: Found a new memory map entry\n", __func__ );
#endif
        /* Another entry found, just the total count of entries. */
        total++;

        /* Is the mapping accessible and not anonymous? */
        if ( mapping.pr_mflags & ( MA_READ | MA_WRITE | MA_EXEC ) &&
             !( mapping.pr_mflags & MA_ANON ) ) {
            /* Test if a new library has been found. If a new library has been
               found a new entry needs to be counted. */
            if ( strcmp( lastobject, mapping.pr_mapname ) != 0 ) {
                strncpy( lastobject, mapping.pr_mapname, PRMAPSZ );
                count++;

#ifdef DEBUG
                SUBDBG( " -> %s: Memory mapping entry valid for %s\n", __func__,
                        mapping.pr_mapname );
#endif
            }
        }
    }
#ifdef DEBUG
    SUBDBG( " -> %s: Preprocessing done, starting to analyze\n", __func__ );
#endif


    /* Start from the beginning, now fill in the found mappings */
    if ( lseek( fd, 0, SEEK_SET ) == -1 ) {
        return PAPI_ESYS;
    }

    memset( lastobject, 0, PRMAPSZ );

    /* Allocate memory */
    pam =
        ( PAPI_address_map_t * ) papi_calloc( count,
                                              sizeof ( PAPI_address_map_t ) );

    while ( read( fd, &mapping, sizeof ( prmap_t ) ) > 0 ) {

        if ( mapping.pr_mflags & MA_ANON ) {
#ifdef DEBUG
            SUBDBG
                ( " -> %s: Anonymous mapping (MA_ANON) found for %s, skipping\n",
                  __func__, mapping.pr_mapname );
#endif
            continue;
        }

        /* Check for a new entry */
        if ( strcmp( mapping.pr_mapname, lastobject ) != 0 ) {
#ifdef DEBUG
            SUBDBG( " -> %s: Analyzing mapping for %s\n", __func__,
                    mapping.pr_mapname );
#endif
            cur = &( pam[++position] );
            strncpy( lastobject, mapping.pr_mapname, PRMAPSZ );
            snprintf( link, PAPI_HUGE_STR_LEN, resolve_pattern, lastobject );
            memset( path, 0, PAPI_HUGE_STR_LEN );
            readlink( link, path, PAPI_HUGE_STR_LEN );
            strncpy( cur->name, path, PAPI_HUGE_STR_LEN );
#ifdef DEBUG
            SUBDBG( " -> %s: Resolved name for %s: %s\n", __func__,
                    mapping.pr_mapname, cur->name );
#endif
        }

        if ( mapping.pr_mflags & MA_READ ) {
            /* Data (MA_WRITE) or text (MA_READ) segment? */
            if ( mapping.pr_mflags & MA_WRITE ) {
                cur->data_start = ( caddr_t ) mapping.pr_vaddr;
                cur->data_end =
                    ( caddr_t ) ( mapping.pr_vaddr + mapping.pr_size );

                if ( strcmp
                     ( cur->name,
                       _papi_hwi_system_info.exe_info.fullname ) == 0 ) {
                    _papi_hwi_system_info.exe_info.address_info.data_start =
                        cur->data_start;
                    _papi_hwi_system_info.exe_info.address_info.data_end =
                        cur->data_end;
                }

                if ( first )
                    d_min = cur->data_start;
                if ( first )
                    d_max = cur->data_end;

                if ( cur->data_start < d_min ) {
                    d_min = cur->data_start;
                }

                if ( cur->data_end > d_max ) {
                    d_max = cur->data_end;
                }
            } else if ( mapping.pr_mflags & MA_EXEC ) {
                cur->text_start = ( caddr_t ) mapping.pr_vaddr;
                cur->text_end =
                    ( caddr_t ) ( mapping.pr_vaddr + mapping.pr_size );

                if ( strcmp
                     ( cur->name,
                       _papi_hwi_system_info.exe_info.fullname ) == 0 ) {
                    _papi_hwi_system_info.exe_info.address_info.text_start =
                        cur->text_start;
                    _papi_hwi_system_info.exe_info.address_info.text_end =
                        cur->text_end;
                }

                if ( first )
                    t_min = cur->text_start;
                if ( first )
                    t_max = cur->text_end;

                if ( cur->text_start < t_min ) {
                    t_min = cur->text_start;
                }

                if ( cur->text_end > t_max ) {
                    t_max = cur->text_end;
                }
            }
        }

        first = 0;
    }

    close( fd );

    /* During the walk of shared objects the upper and lower bound of the
       segments could be discovered. The bounds are stored in the PAPI info
       structure. The information is important for the profiling functions of
       PAPI. */

/* This variant would pass the addresses of all text and data segments 
  _papi_hwi_system_info.exe_info.address_info.text_start = t_min;
  _papi_hwi_system_info.exe_info.address_info.text_end = t_max;
  _papi_hwi_system_info.exe_info.address_info.data_start = d_min;
  _papi_hwi_system_info.exe_info.address_info.data_end = d_max;
*/

#ifdef DEBUG
    SUBDBG( " -> %s: Analysis of memory maps done, results:\n", __func__ );
    SUBDBG( " -> %s: text_start=%x, text_end=%x, text_size=%lld\n", __func__,
            _papi_hwi_system_info.exe_info.address_info.text_start,
            _papi_hwi_system_info.exe_info.address_info.text_end,
            _papi_hwi_system_info.exe_info.address_info.text_end
            - _papi_hwi_system_info.exe_info.address_info.text_start );
    SUBDBG( " -> %s: data_start=%x, data_end=%x, data_size=%lld\n", __func__,
            _papi_hwi_system_info.exe_info.address_info.data_start,
            _papi_hwi_system_info.exe_info.address_info.data_end,
            _papi_hwi_system_info.exe_info.address_info.data_end
            - _papi_hwi_system_info.exe_info.address_info.data_start );
#endif

    /* Store the map read and the total count of shlibs found */
    _papi_hwi_system_info.shlib_info.map = pam;
    _papi_hwi_system_info.shlib_info.count = count;

#ifdef DEBUG
    SUBDBG( "LEAVING FUNCTION  >>%s<< at %s:%d\n", __func__, __FILE__,
            __LINE__ );
#endif

    return PAPI_OK;
}

Here is the call graph for this function:


Variable Documentation

Initial value:
 {
    {SYNTHETIC_CYCLES_ELAPSED, "_syn_cycles_elapsed"},
    {SYNTHETIC_RETURN_ONE, "_syn_return_one"},
    {SYNTHETIC_RETURN_TWO, "_syn_return_two"},
    {-1, NULL},
}

Definition at line 211 of file solaris-niagara2.c.

enum { ... } __int_synthetic_enum
char** __t2_ntv_events [static]

Definition at line 108 of file solaris-niagara2.c.

Definition at line 107 of file solaris-niagara2.c.

Definition at line 132 of file solaris-niagara2.c.

caddr_t _edata
caddr_t _end
caddr_t _etext

Definition at line 56 of file papi_internal.c.

Initial value:
 {
    .get_memory_info = _niagara2_get_memory_info,
    .get_dmem_info   = _solaris_get_dmem_info,

    .get_real_usec =     _solaris_get_real_usec,
    .get_real_cycles =   _solaris_get_real_cycles,
    .get_virt_usec =     _solaris_get_virt_usec,
    .update_shlib_info = _solaris_update_shlib_info,
    .get_system_info =   _solaris_get_system_info,
}

Definition at line 2280 of file solaris-niagara2.c.

caddr_t _start
cpc_t* cpc = NULL [static]

Definition at line 97 of file solaris-niagara2.c.

int pid [static]

Definition at line 111 of file solaris-niagara2.c.

Definition at line 191 of file solaris-niagara2.c.

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines