|
Packit |
577717 |
/****************************/
|
|
Packit |
577717 |
/* THIS IS OPEN SOURCE CODE */
|
|
Packit |
577717 |
/****************************/
|
|
Packit |
577717 |
/**
|
|
Packit |
577717 |
* @file papi_internal.h
|
|
Packit |
577717 |
* @author Philip Mucci
|
|
Packit |
577717 |
* mucci@cs.utk.edu
|
|
Packit |
577717 |
* @author Dan Terpstra
|
|
Packit |
577717 |
* terpstra.utk.edu
|
|
Packit |
577717 |
* @author Kevin London
|
|
Packit |
577717 |
* london@cs.utk.edu
|
|
Packit |
577717 |
* @author Haihang You
|
|
Packit |
577717 |
* you@cs.utk.edu
|
|
Packit |
577717 |
*/
|
|
Packit |
577717 |
|
|
Packit |
577717 |
#ifndef _PAPI_INTERNAL_H
|
|
Packit |
577717 |
#define _PAPI_INTERNAL_H
|
|
Packit |
577717 |
|
|
Packit |
577717 |
/* AIX's C compiler does not recognize the inline keyword */
|
|
Packit |
577717 |
#ifdef _AIX
|
|
Packit |
577717 |
#define inline
|
|
Packit |
577717 |
#endif
|
|
Packit |
577717 |
|
|
Packit |
577717 |
#include "papi_debug.h"
|
|
Packit |
577717 |
|
|
Packit |
577717 |
#define DEADBEEF 0xdedbeef
|
|
Packit |
577717 |
extern int papi_num_components;
|
|
Packit |
577717 |
extern int _papi_num_compiled_components;
|
|
Packit |
577717 |
extern int init_level;
|
|
Packit |
577717 |
extern int _papi_hwi_errno;
|
|
Packit |
577717 |
extern int _papi_hwi_num_errors;
|
|
Packit |
577717 |
extern char **_papi_errlist;
|
|
Packit |
577717 |
|
|
Packit |
577717 |
|
|
Packit |
577717 |
/********************************************************/
|
|
Packit |
577717 |
/* This block provides general strings used in PAPI */
|
|
Packit |
577717 |
/* If a new string is needed for PAPI prompts */
|
|
Packit |
577717 |
/* it should be placed in this file and referenced by */
|
|
Packit |
577717 |
/* label. */
|
|
Packit |
577717 |
/********************************************************/
|
|
Packit |
577717 |
#define PAPI_ERROR_CODE_str "Error Code"
|
|
Packit |
577717 |
#define PAPI_SHUTDOWN_str "PAPI_shutdown: PAPI is not initialized"
|
|
Packit |
577717 |
#define PAPI_SHUTDOWN_SYNC_str "PAPI_shutdown: other threads still have running EventSets"
|
|
Packit |
577717 |
|
|
Packit |
577717 |
|
|
Packit |
577717 |
/* some members of structs and/or function parameters may or may not be
|
|
Packit |
577717 |
necessary, but at this point, we have included anything that might
|
|
Packit |
577717 |
possibly be useful later, and will remove them as we progress */
|
|
Packit |
577717 |
|
|
Packit |
577717 |
/* Signal used for overflow delivery */
|
|
Packit |
577717 |
|
|
Packit |
577717 |
#define PAPI_INT_MPX_SIGNAL SIGPROF
|
|
Packit |
577717 |
#define PAPI_INT_SIGNAL SIGPROF
|
|
Packit |
577717 |
#define PAPI_INT_ITIMER ITIMER_PROF
|
|
Packit |
577717 |
|
|
Packit |
577717 |
#define PAPI_INT_ITIMER_MS 1
|
|
Packit |
577717 |
#if defined(linux)
|
|
Packit |
577717 |
#define PAPI_NSIG _NSIG
|
|
Packit |
577717 |
#else
|
|
Packit |
577717 |
#define PAPI_NSIG 128
|
|
Packit |
577717 |
#endif
|
|
Packit |
577717 |
|
|
Packit |
577717 |
/* Multiplex definitions */
|
|
Packit |
577717 |
|
|
Packit |
577717 |
#define PAPI_INT_MPX_DEF_US 10000 /*Default resolution in us. of mpx handler */
|
|
Packit |
577717 |
|
|
Packit |
577717 |
/* Commands used to compute derived events */
|
|
Packit |
577717 |
|
|
Packit |
577717 |
#define NOT_DERIVED 0x0 /**< Do nothing */
|
|
Packit |
577717 |
#define DERIVED_ADD 0x1 /**< Add counters */
|
|
Packit |
577717 |
#define DERIVED_PS 0x2 /**< Divide by the cycle counter and convert to seconds */
|
|
Packit |
577717 |
#define DERIVED_ADD_PS 0x4 /**< Add 2 counters then divide by the cycle counter and xl8 to secs. */
|
|
Packit |
577717 |
#define DERIVED_CMPD 0x8 /**< Event lives in operand index but takes 2 or more codes */
|
|
Packit |
577717 |
#define DERIVED_SUB 0x10 /**< Sub all counters from counter with operand_index */
|
|
Packit |
577717 |
#define DERIVED_POSTFIX 0x20 /**< Process counters based on specified postfix string */
|
|
Packit |
577717 |
#define DERIVED_INFIX 0x40 /**< Process counters based on specified infix string */
|
|
Packit |
577717 |
|
|
Packit |
577717 |
/* Thread related: thread local storage */
|
|
Packit |
577717 |
|
|
Packit |
577717 |
#define LOWLEVEL_TLS PAPI_NUM_TLS+0
|
|
Packit |
577717 |
#define NUM_INNER_TLS 1
|
|
Packit |
577717 |
#define PAPI_MAX_TLS (NUM_INNER_TLS+PAPI_NUM_TLS)
|
|
Packit |
577717 |
|
|
Packit |
577717 |
/* Thread related: locks */
|
|
Packit |
577717 |
|
|
Packit |
577717 |
#define INTERNAL_LOCK PAPI_NUM_LOCK+0 /* papi_internal.c */
|
|
Packit |
577717 |
#define MULTIPLEX_LOCK PAPI_NUM_LOCK+1 /* multiplex.c */
|
|
Packit |
577717 |
#define THREADS_LOCK PAPI_NUM_LOCK+2 /* threads.c */
|
|
Packit |
577717 |
#define HIGHLEVEL_LOCK PAPI_NUM_LOCK+3 /* papi_hl.c */
|
|
Packit |
577717 |
#define MEMORY_LOCK PAPI_NUM_LOCK+4 /* papi_memory.c */
|
|
Packit |
577717 |
#define COMPONENT_LOCK PAPI_NUM_LOCK+5 /* per-component */
|
|
Packit |
577717 |
#define GLOBAL_LOCK PAPI_NUM_LOCK+6 /* papi.c for global variable (static and non) initialization/shutdown */
|
|
Packit |
577717 |
#define CPUS_LOCK PAPI_NUM_LOCK+7 /* cpus.c */
|
|
Packit |
577717 |
#define NAMELIB_LOCK PAPI_NUM_LOCK+8 /* papi_pfm4_events.c */
|
|
Packit |
577717 |
|
|
Packit |
577717 |
/* extras related */
|
|
Packit |
577717 |
|
|
Packit |
577717 |
#define NEED_CONTEXT 1
|
|
Packit |
577717 |
#define DONT_NEED_CONTEXT 0
|
|
Packit |
577717 |
|
|
Packit |
577717 |
#define PAPI_EVENTS_IN_DERIVED_EVENT 8
|
|
Packit |
577717 |
|
|
Packit |
577717 |
|
|
Packit |
577717 |
/* these vestigial pointers are to structures defined in the components
|
|
Packit |
577717 |
they are opaque to the framework and defined as void at this level
|
|
Packit |
577717 |
they are remapped to real data in the component routines that use them */
|
|
Packit |
577717 |
#define hwd_context_t void
|
|
Packit |
577717 |
#define hwd_control_state_t void
|
|
Packit |
577717 |
#define hwd_reg_alloc_t void
|
|
Packit |
577717 |
#define hwd_register_t void
|
|
Packit |
577717 |
#define hwd_siginfo_t void
|
|
Packit |
577717 |
#define hwd_ucontext_t void
|
|
Packit |
577717 |
|
|
Packit |
577717 |
/* DEFINES END HERE */
|
|
Packit |
577717 |
|
|
Packit |
577717 |
#ifndef NO_CONFI
|
|
Packit |
577717 |
#include "config.h"
|
|
Packit |
577717 |
#endif
|
|
Packit |
577717 |
|
|
Packit |
577717 |
#include OSCONTEXT
|
|
Packit |
577717 |
#include "papi_preset.h"
|
|
Packit |
577717 |
|
|
Packit |
577717 |
#ifndef inline_static
|
|
Packit |
577717 |
#define inline_static inline static
|
|
Packit |
577717 |
#endif
|
|
Packit |
577717 |
|
|
Packit |
577717 |
typedef struct _EventSetDomainInfo {
|
|
Packit |
577717 |
int domain;
|
|
Packit |
577717 |
} EventSetDomainInfo_t;
|
|
Packit |
577717 |
|
|
Packit |
577717 |
typedef struct _EventSetGranularityInfo {
|
|
Packit |
577717 |
int granularity;
|
|
Packit |
577717 |
} EventSetGranularityInfo_t;
|
|
Packit |
577717 |
|
|
Packit |
577717 |
typedef struct _EventSetOverflowInfo {
|
|
Packit |
577717 |
int flags;
|
|
Packit |
577717 |
int event_counter;
|
|
Packit |
577717 |
PAPI_overflow_handler_t handler;
|
|
Packit |
577717 |
long long *deadline;
|
|
Packit |
577717 |
int *threshold;
|
|
Packit |
577717 |
int *EventIndex;
|
|
Packit |
577717 |
int *EventCode;
|
|
Packit |
577717 |
} EventSetOverflowInfo_t;
|
|
Packit |
577717 |
|
|
Packit |
577717 |
typedef struct _EventSetAttachInfo {
|
|
Packit |
577717 |
unsigned long tid;
|
|
Packit |
577717 |
} EventSetAttachInfo_t;
|
|
Packit |
577717 |
|
|
Packit |
577717 |
typedef struct _EventSetCpuInfo {
|
|
Packit |
577717 |
unsigned int cpu_num;
|
|
Packit |
577717 |
} EventSetCpuInfo_t;
|
|
Packit |
577717 |
|
|
Packit |
577717 |
typedef struct _EventSetInheritInfo
|
|
Packit |
577717 |
{
|
|
Packit |
577717 |
int inherit;
|
|
Packit |
577717 |
} EventSetInheritInfo_t;
|
|
Packit |
577717 |
|
|
Packit |
577717 |
/** @internal */
|
|
Packit |
577717 |
typedef struct _EventSetProfileInfo {
|
|
Packit |
577717 |
PAPI_sprofil_t **prof;
|
|
Packit |
577717 |
int *count; /**< Number of buffers */
|
|
Packit |
577717 |
int *threshold;
|
|
Packit |
577717 |
int *EventIndex;
|
|
Packit |
577717 |
int *EventCode;
|
|
Packit |
577717 |
int flags;
|
|
Packit |
577717 |
int event_counter;
|
|
Packit |
577717 |
} EventSetProfileInfo_t;
|
|
Packit |
577717 |
|
|
Packit |
577717 |
/** This contains info about an individual event added to the EventSet.
|
|
Packit |
577717 |
The event can be either PRESET or NATIVE, and either simple or derived.
|
|
Packit |
577717 |
If derived, it can consist of up to PAPI_EVENTS_IN_DERIVED_EVENT
|
|
Packit |
577717 |
native events.
|
|
Packit |
577717 |
An EventSet contains a pointer to an array of these structures to define
|
|
Packit |
577717 |
each added event.
|
|
Packit |
577717 |
@internal
|
|
Packit |
577717 |
*/
|
|
Packit |
577717 |
typedef struct _EventInfo {
|
|
Packit |
577717 |
unsigned int event_code; /**< Preset or native code for this event as passed to PAPI_add_event() */
|
|
Packit |
577717 |
int pos[PAPI_EVENTS_IN_DERIVED_EVENT]; /**< position in the counter array for this events components */
|
|
Packit |
577717 |
char *ops; /**< operation string of preset (points into preset event struct) */
|
|
Packit |
577717 |
int derived; /**< Counter derivation command used for derived events */
|
|
Packit |
577717 |
} EventInfo_t;
|
|
Packit |
577717 |
|
|
Packit |
577717 |
/** This contains info about each native event added to the EventSet.
|
|
Packit |
577717 |
An EventSet contains an array of MAX_COUNTERS of these structures
|
|
Packit |
577717 |
to define each native event in the set.
|
|
Packit |
577717 |
@internal
|
|
Packit |
577717 |
*/
|
|
Packit |
577717 |
typedef struct _NativeInfo {
|
|
Packit |
577717 |
int ni_event; /**< native (libpfm4) event code;
|
|
Packit |
577717 |
always non-zero unless empty */
|
|
Packit |
577717 |
int ni_papi_code; /**< papi event code
|
|
Packit |
577717 |
value returned to papi applications */
|
|
Packit |
577717 |
int ni_position; /**< counter array position where this
|
|
Packit |
577717 |
native event lives */
|
|
Packit |
577717 |
int ni_owners; /**< specifies how many owners share
|
|
Packit |
577717 |
this native event */
|
|
Packit |
577717 |
hwd_register_t *ni_bits; /**< Component defined resources used by
|
|
Packit |
577717 |
this native event */
|
|
Packit |
577717 |
} NativeInfo_t;
|
|
Packit |
577717 |
|
|
Packit |
577717 |
|
|
Packit |
577717 |
/* Multiplex definitions */
|
|
Packit |
577717 |
|
|
Packit |
577717 |
/** This contains only the information about an event that
|
|
Packit |
577717 |
* would cause two events to be counted separately. Options
|
|
Packit |
577717 |
* that don't affect an event aren't included here.
|
|
Packit |
577717 |
* @internal
|
|
Packit |
577717 |
*/
|
|
Packit |
577717 |
typedef struct _papi_info {
|
|
Packit |
577717 |
long long event_type;
|
|
Packit |
577717 |
int domain;
|
|
Packit |
577717 |
int granularity;
|
|
Packit |
577717 |
} PapiInfo;
|
|
Packit |
577717 |
|
|
Packit |
577717 |
typedef struct _masterevent {
|
|
Packit |
577717 |
int uses;
|
|
Packit |
577717 |
int active;
|
|
Packit |
577717 |
int is_a_rate;
|
|
Packit |
577717 |
int papi_event;
|
|
Packit |
577717 |
PapiInfo pi;
|
|
Packit |
577717 |
long long count;
|
|
Packit |
577717 |
long long cycles;
|
|
Packit |
577717 |
long long handler_count;
|
|
Packit |
577717 |
long long prev_total_c;
|
|
Packit |
577717 |
long long count_estimate;
|
|
Packit |
577717 |
double rate_estimate;
|
|
Packit |
577717 |
struct _threadlist *mythr;
|
|
Packit |
577717 |
struct _masterevent *next;
|
|
Packit |
577717 |
} MasterEvent;
|
|
Packit |
577717 |
|
|
Packit |
577717 |
/** @internal */
|
|
Packit |
577717 |
typedef struct _threadlist {
|
|
Packit |
577717 |
#ifdef PTHREADS
|
|
Packit |
577717 |
pthread_t thr;
|
|
Packit |
577717 |
#else
|
|
Packit |
577717 |
unsigned long int tid;
|
|
Packit |
577717 |
#endif
|
|
Packit |
577717 |
/** Total cycles for this thread */
|
|
Packit |
577717 |
long long total_c;
|
|
Packit |
577717 |
/** Pointer to event in use */
|
|
Packit |
577717 |
MasterEvent *cur_event;
|
|
Packit |
577717 |
/** List of multiplexing events for this thread */
|
|
Packit |
577717 |
MasterEvent *head;
|
|
Packit |
577717 |
/** Pointer to next thread */
|
|
Packit |
577717 |
struct _threadlist *next;
|
|
Packit |
577717 |
} Threadlist;
|
|
Packit |
577717 |
|
|
Packit |
577717 |
/* Ugh, should move this out and into all callers of papi_internal.h */
|
|
Packit |
577717 |
#include "sw_multiplex.h"
|
|
Packit |
577717 |
|
|
Packit |
577717 |
/** Opaque struct, not defined yet...due to threads.h <-> papi_internal.h
|
|
Packit |
577717 |
@internal */
|
|
Packit |
577717 |
struct _ThreadInfo;
|
|
Packit |
577717 |
struct _CpuInfo;
|
|
Packit |
577717 |
|
|
Packit |
577717 |
/** Fields below are ordered by access in PAPI_read for performance
|
|
Packit |
577717 |
@internal */
|
|
Packit |
577717 |
typedef struct _EventSetInfo {
|
|
Packit |
577717 |
struct _ThreadInfo *master; /**< Pointer to thread that owns this EventSet*/
|
|
Packit |
577717 |
struct _CpuInfo *CpuInfo; /**< Pointer to cpu that owns this EventSet */
|
|
Packit |
577717 |
|
|
Packit |
577717 |
int state; /**< The state of this entire EventSet; can be
|
|
Packit |
577717 |
PAPI_RUNNING or PAPI_STOPPED plus flags */
|
|
Packit |
577717 |
|
|
Packit |
577717 |
EventInfo_t *EventInfoArray; /**< This array contains the mapping from
|
|
Packit |
577717 |
events added into the API into hardware
|
|
Packit |
577717 |
specific encoding as returned by the
|
|
Packit |
577717 |
kernel or the code that directly
|
|
Packit |
577717 |
accesses the counters. */
|
|
Packit |
577717 |
|
|
Packit |
577717 |
hwd_control_state_t *ctl_state; /**< This contains the encoding necessary
|
|
Packit |
577717 |
for the hardware to set the counters
|
|
Packit |
577717 |
to the appropriate conditions */
|
|
Packit |
577717 |
|
|
Packit |
577717 |
unsigned long int tid; /**< Thread ID, only used if
|
|
Packit |
577717 |
PAPI_thread_init() is called */
|
|
Packit |
577717 |
|
|
Packit |
577717 |
int EventSetIndex; /**< Index of the EventSet in the array */
|
|
Packit |
577717 |
|
|
Packit |
577717 |
int CmpIdx; /**< Which Component this EventSet Belongs to */
|
|
Packit |
577717 |
|
|
Packit |
577717 |
int NumberOfEvents; /**< Number of events added to EventSet */
|
|
Packit |
577717 |
|
|
Packit |
577717 |
long long *hw_start; /**< Array of length num_mpx_cntrs to hold
|
|
Packit |
577717 |
unprocessed, out of order,
|
|
Packit |
577717 |
long long counter registers */
|
|
Packit |
577717 |
|
|
Packit |
577717 |
long long *sw_stop; /**< Array of length num_mpx_cntrs that
|
|
Packit |
577717 |
contains processed, in order, PAPI
|
|
Packit |
577717 |
counter values when used or stopped */
|
|
Packit |
577717 |
|
|
Packit |
577717 |
int NativeCount; /**< Number of native events in
|
|
Packit |
577717 |
NativeInfoArray */
|
|
Packit |
577717 |
|
|
Packit |
577717 |
NativeInfo_t *NativeInfoArray; /**< Info about each native event in
|
|
Packit |
577717 |
the set */
|
|
Packit |
577717 |
hwd_register_t *NativeBits; /**< Component-specific bits corresponding
|
|
Packit |
577717 |
to the native events */
|
|
Packit |
577717 |
|
|
Packit |
577717 |
EventSetDomainInfo_t domain;
|
|
Packit |
577717 |
EventSetGranularityInfo_t granularity;
|
|
Packit |
577717 |
EventSetOverflowInfo_t overflow;
|
|
Packit |
577717 |
EventSetMultiplexInfo_t multiplex;
|
|
Packit |
577717 |
EventSetAttachInfo_t attach;
|
|
Packit |
577717 |
EventSetCpuInfo_t cpu;
|
|
Packit |
577717 |
EventSetProfileInfo_t profile;
|
|
Packit |
577717 |
EventSetInheritInfo_t inherit;
|
|
Packit |
577717 |
} EventSetInfo_t;
|
|
Packit |
577717 |
|
|
Packit |
577717 |
/** @internal */
|
|
Packit |
577717 |
typedef struct _dynamic_array {
|
|
Packit |
577717 |
EventSetInfo_t **dataSlotArray; /**< array of ptrs to EventSets */
|
|
Packit |
577717 |
int totalSlots; /**< number of slots in dataSlotArrays */
|
|
Packit |
577717 |
int availSlots; /**< number of open slots in dataSlotArrays */
|
|
Packit |
577717 |
int fullSlots; /**< number of full slots in dataSlotArray */
|
|
Packit |
577717 |
int lowestEmptySlot; /**< index of lowest empty dataSlotArray */
|
|
Packit |
577717 |
} DynamicArray_t;
|
|
Packit |
577717 |
|
|
Packit |
577717 |
/* Component option types for _papi_hwd_ctl. */
|
|
Packit |
577717 |
|
|
Packit |
577717 |
typedef struct _papi_int_attach {
|
|
Packit |
577717 |
unsigned long tid;
|
|
Packit |
577717 |
EventSetInfo_t *ESI;
|
|
Packit |
577717 |
} _papi_int_attach_t;
|
|
Packit |
577717 |
|
|
Packit |
577717 |
typedef struct _papi_int_cpu {
|
|
Packit |
577717 |
unsigned int cpu_num;
|
|
Packit |
577717 |
EventSetInfo_t *ESI;
|
|
Packit |
577717 |
} _papi_int_cpu_t;
|
|
Packit |
577717 |
|
|
Packit |
577717 |
typedef struct _papi_int_multiplex {
|
|
Packit |
577717 |
int flags;
|
|
Packit |
577717 |
unsigned long ns;
|
|
Packit |
577717 |
EventSetInfo_t *ESI;
|
|
Packit |
577717 |
} _papi_int_multiplex_t;
|
|
Packit |
577717 |
|
|
Packit |
577717 |
typedef struct _papi_int_defdomain {
|
|
Packit |
577717 |
int defdomain;
|
|
Packit |
577717 |
} _papi_int_defdomain_t;
|
|
Packit |
577717 |
|
|
Packit |
577717 |
typedef struct _papi_int_domain {
|
|
Packit |
577717 |
int domain;
|
|
Packit |
577717 |
int eventset;
|
|
Packit |
577717 |
EventSetInfo_t *ESI;
|
|
Packit |
577717 |
} _papi_int_domain_t;
|
|
Packit |
577717 |
|
|
Packit |
577717 |
typedef struct _papi_int_granularity {
|
|
Packit |
577717 |
int granularity;
|
|
Packit |
577717 |
int eventset;
|
|
Packit |
577717 |
EventSetInfo_t *ESI;
|
|
Packit |
577717 |
} _papi_int_granularity_t;
|
|
Packit |
577717 |
|
|
Packit |
577717 |
typedef struct _papi_int_overflow {
|
|
Packit |
577717 |
EventSetInfo_t *ESI;
|
|
Packit |
577717 |
EventSetOverflowInfo_t overflow;
|
|
Packit |
577717 |
} _papi_int_overflow_t;
|
|
Packit |
577717 |
|
|
Packit |
577717 |
typedef struct _papi_int_profile {
|
|
Packit |
577717 |
EventSetInfo_t *ESI;
|
|
Packit |
577717 |
EventSetProfileInfo_t profile;
|
|
Packit |
577717 |
} _papi_int_profile_t;
|
|
Packit |
577717 |
|
|
Packit |
577717 |
typedef PAPI_itimer_option_t _papi_int_itimer_t;
|
|
Packit |
577717 |
/* These shortcuts are only for use code */
|
|
Packit |
577717 |
#undef multiplex_itimer_sig
|
|
Packit |
577717 |
#undef multiplex_itimer_num
|
|
Packit |
577717 |
#undef multiplex_itimer_us
|
|
Packit |
577717 |
|
|
Packit |
577717 |
typedef struct _papi_int_inherit
|
|
Packit |
577717 |
{
|
|
Packit |
577717 |
EventSetInfo_t *ESI;
|
|
Packit |
577717 |
int inherit;
|
|
Packit |
577717 |
} _papi_int_inherit_t;
|
|
Packit |
577717 |
|
|
Packit |
577717 |
/** @internal */
|
|
Packit |
577717 |
typedef struct _papi_int_addr_range { /* if both are zero, range is disabled */
|
|
Packit |
577717 |
EventSetInfo_t *ESI;
|
|
Packit |
577717 |
int domain;
|
|
Packit |
577717 |
caddr_t start; /**< start address of an address range */
|
|
Packit |
577717 |
caddr_t end; /**< end address of an address range */
|
|
Packit |
577717 |
int start_off; /**< offset from start address as programmed in hardware */
|
|
Packit |
577717 |
int end_off; /**< offset from end address as programmed in hardware */
|
|
Packit |
577717 |
/**< if offsets are undefined, they are both set to -1 */
|
|
Packit |
577717 |
} _papi_int_addr_range_t;
|
|
Packit |
577717 |
|
|
Packit |
577717 |
typedef union _papi_int_option_t {
|
|
Packit |
577717 |
_papi_int_overflow_t overflow;
|
|
Packit |
577717 |
_papi_int_profile_t profile;
|
|
Packit |
577717 |
_papi_int_domain_t domain;
|
|
Packit |
577717 |
_papi_int_attach_t attach;
|
|
Packit |
577717 |
_papi_int_cpu_t cpu;
|
|
Packit |
577717 |
_papi_int_multiplex_t multiplex;
|
|
Packit |
577717 |
_papi_int_itimer_t itimer;
|
|
Packit |
577717 |
_papi_int_inherit_t inherit;
|
|
Packit |
577717 |
_papi_int_granularity_t granularity;
|
|
Packit |
577717 |
_papi_int_addr_range_t address_range;
|
|
Packit |
577717 |
} _papi_int_option_t;
|
|
Packit |
577717 |
|
|
Packit |
577717 |
/** Hardware independent context
|
|
Packit |
577717 |
* @internal */
|
|
Packit |
577717 |
typedef struct {
|
|
Packit |
577717 |
hwd_siginfo_t *si;
|
|
Packit |
577717 |
hwd_ucontext_t *ucontext;
|
|
Packit |
577717 |
} _papi_hwi_context_t;
|
|
Packit |
577717 |
|
|
Packit |
577717 |
/** @internal */
|
|
Packit |
577717 |
typedef struct _papi_mdi {
|
|
Packit |
577717 |
DynamicArray_t global_eventset_map; /**< Global structure to maintain int<->EventSet mapping */
|
|
Packit |
577717 |
pid_t pid; /**< Process identifier */
|
|
Packit |
577717 |
PAPI_hw_info_t hw_info; /**< See definition in papi.h */
|
|
Packit |
577717 |
PAPI_exe_info_t exe_info; /**< See definition in papi.h */
|
|
Packit |
577717 |
PAPI_shlib_info_t shlib_info; /**< See definition in papi.h */
|
|
Packit |
577717 |
PAPI_preload_info_t preload_info; /**< See definition in papi.h */
|
|
Packit |
577717 |
} papi_mdi_t;
|
|
Packit |
577717 |
|
|
Packit |
577717 |
extern papi_mdi_t _papi_hwi_system_info;
|
|
Packit |
577717 |
extern int _papi_hwi_error_level;
|
|
Packit |
577717 |
/* extern const hwi_describe_t _papi_hwi_err[PAPI_NUM_ERRORS]; */
|
|
Packit |
577717 |
/*extern volatile int _papi_hwi_using_signal;*/
|
|
Packit |
577717 |
extern int _papi_hwi_using_signal[PAPI_NSIG];
|
|
Packit |
577717 |
|
|
Packit |
577717 |
/** @ingroup papi_data_structures */
|
|
Packit |
577717 |
typedef struct _papi_os_option {
|
|
Packit |
577717 |
char name[PAPI_MAX_STR_LEN]; /**< Name of the operating system */
|
|
Packit |
577717 |
char version[PAPI_MAX_STR_LEN]; /**< descriptive OS Version */
|
|
Packit |
577717 |
int os_version; /**< numerical, for workarounds */
|
|
Packit |
577717 |
int itimer_sig; /**< Signal used by the multiplex timer, 0 if not */
|
|
Packit |
577717 |
int itimer_num; /**< Number of the itimer used by mpx and overflow/profile emulation */
|
|
Packit |
577717 |
int itimer_ns; /**< ns between mpx switching and overflow/profile emulation */
|
|
Packit |
577717 |
int itimer_res_ns; /**< ns of resolution of itimer */
|
|
Packit |
577717 |
int clock_ticks; /**< clock ticks per second */
|
|
Packit |
577717 |
unsigned long reserved[8]; /* For future expansion */
|
|
Packit |
577717 |
} PAPI_os_info_t;
|
|
Packit |
577717 |
|
|
Packit |
577717 |
extern PAPI_os_info_t _papi_os_info; /* For internal PAPI use only */
|
|
Packit |
577717 |
|
|
Packit |
577717 |
#include "papi_lock.h"
|
|
Packit |
577717 |
#include "threads.h"
|
|
Packit |
577717 |
|
|
Packit |
577717 |
EventSetInfo_t *_papi_hwi_lookup_EventSet( int eventset );
|
|
Packit |
577717 |
void _papi_hwi_set_papi_event_string (const char *event_string);
|
|
Packit |
577717 |
char *_papi_hwi_get_papi_event_string (void);
|
|
Packit |
577717 |
void _papi_hwi_free_papi_event_string();
|
|
Packit |
577717 |
void _papi_hwi_set_papi_event_code (unsigned int event_code, int update_flag);
|
|
Packit |
577717 |
unsigned int _papi_hwi_get_papi_event_code (void);
|
|
Packit |
577717 |
int _papi_hwi_get_ntv_idx (unsigned int papi_evt_code);
|
|
Packit |
577717 |
int _papi_hwi_is_sw_multiplex( EventSetInfo_t * ESI );
|
|
Packit |
577717 |
hwd_context_t *_papi_hwi_get_context( EventSetInfo_t * ESI, int *is_dirty );
|
|
Packit |
577717 |
|
|
Packit |
577717 |
extern int _papi_hwi_error_level;
|
|
Packit |
577717 |
extern PAPI_debug_handler_t _papi_hwi_debug_handler;
|
|
Packit |
577717 |
void PAPIERROR( char *format, ... );
|
|
Packit |
577717 |
void PAPIWARN( char *format, ... );
|
|
Packit |
577717 |
int _papi_hwi_assign_eventset( EventSetInfo_t * ESI, int cidx );
|
|
Packit |
577717 |
void _papi_hwi_free_EventSet( EventSetInfo_t * ESI );
|
|
Packit |
577717 |
int _papi_hwi_create_eventset( int *EventSet, ThreadInfo_t * handle );
|
|
Packit |
577717 |
int _papi_hwi_lookup_EventCodeIndex( const EventSetInfo_t * ESI,
|
|
Packit |
577717 |
unsigned int EventCode );
|
|
Packit |
577717 |
int _papi_hwi_remove_EventSet( EventSetInfo_t * ESI );
|
|
Packit |
577717 |
void _papi_hwi_map_events_to_native( EventSetInfo_t *ESI);
|
|
Packit |
577717 |
int _papi_hwi_add_event( EventSetInfo_t * ESI, int EventCode );
|
|
Packit |
577717 |
int _papi_hwi_remove_event( EventSetInfo_t * ESI, int EventCode );
|
|
Packit |
577717 |
int _papi_hwi_read( hwd_context_t * context, EventSetInfo_t * ESI,
|
|
Packit |
577717 |
long long *values );
|
|
Packit |
577717 |
int _papi_hwi_cleanup_eventset( EventSetInfo_t * ESI );
|
|
Packit |
577717 |
int _papi_hwi_convert_eventset_to_multiplex( _papi_int_multiplex_t * mpx );
|
|
Packit |
577717 |
int _papi_hwi_init_global( void );
|
|
Packit |
577717 |
int _papi_hwi_init_global_internal( void );
|
|
Packit |
577717 |
int _papi_hwi_init_os(void);
|
|
Packit |
577717 |
void _papi_hwi_init_errors(void);
|
|
Packit |
577717 |
PAPI_os_info_t *_papi_hwi_get_os_info(void);
|
|
Packit |
577717 |
void _papi_hwi_shutdown_global_internal( void );
|
|
Packit |
577717 |
void _papi_hwi_dummy_handler( int EventSet, void *address, long long overflow_vector,
|
|
Packit |
577717 |
void *context );
|
|
Packit |
577717 |
int _papi_hwi_get_preset_event_info( int EventCode, PAPI_event_info_t * info );
|
|
Packit |
577717 |
int _papi_hwi_get_user_event_info( int EventCode, PAPI_event_info_t * info );
|
|
Packit |
577717 |
int _papi_hwi_derived_type( char *tmp, int *code );
|
|
Packit |
577717 |
|
|
Packit |
577717 |
int _papi_hwi_query_native_event( unsigned int EventCode );
|
|
Packit |
577717 |
int _papi_hwi_get_native_event_info( unsigned int EventCode,
|
|
Packit |
577717 |
PAPI_event_info_t * info );
|
|
Packit |
577717 |
int _papi_hwi_native_name_to_code( const char *in, int *out );
|
|
Packit |
577717 |
int _papi_hwi_native_code_to_name( unsigned int EventCode, char *hwi_name,
|
|
Packit |
577717 |
int len );
|
|
Packit |
577717 |
|
|
Packit |
577717 |
|
|
Packit |
577717 |
int _papi_hwi_invalid_cmp( int cidx );
|
|
Packit |
577717 |
int _papi_hwi_component_index( int event_code );
|
|
Packit |
577717 |
int _papi_hwi_native_to_eventcode(int cidx, int event_code, int ntv_idx, const char *event_name);
|
|
Packit |
577717 |
int _papi_hwi_eventcode_to_native(int event_code);
|
|
Packit |
577717 |
|
|
Packit |
577717 |
#endif /* PAPI_INTERNAL_H */
|