28 #define EXAMPLE_MAX_SIMULTANEOUS_COUNTERS 3 29 #define EXAMPLE_MAX_MULTIPLEX_COUNTERS 4 36 typedef struct example_register
47 typedef struct example_native_event_entry
59 typedef struct example_reg_alloc
69 typedef struct example_control_state
81 typedef struct example_context
97 #define EXAMPLE_ZERO_REG 0 98 #define EXAMPLE_CONSTANT_REG 1 99 #define EXAMPLE_AUTOINC_REG 2 100 #define EXAMPLE_GLOBAL_AUTOINC_REG 3 102 #define EXAMPLE_TOTAL_EVENTS 4 125 switch ( which_one ) {
139 fprintf(stderr,
"Invalid counter read %#x\n",which_one );
153 switch ( which_one ) {
164 perror(
"Invalid counter write" );
190 SUBDBG(
"_example_init_component..." );
207 PAPIERROR(
"malloc():Could not get memory for events table" );
217 "This is an example counter, that always returns 0" );
222 "This is an example counter, that always returns a constant value of 42" );
227 "This is an example counter, that reports a per-thread auto-incrementing value" );
232 "This is an example counter, that reports a global auto-incrementing value" );
255 SUBDBG(
"_example_init_thread %p...", ctx );
270 SUBDBG(
"example_init_control_state... %p\n", ctl );
292 SUBDBG(
"_example_update_control_state %p %p...", ctl, ctx );
321 SUBDBG(
"example_start %p %p...", ctx, ctl );
343 SUBDBG(
"example_stop %p %p...", ctx, ctl );
357 long long **
events,
int flags )
365 SUBDBG(
"example_read... %p %d", ctx, flags );
394 SUBDBG(
"example_write... %p %p", ctx, ctl );
416 SUBDBG(
"example_reset ctx=%p ctrl=%p...", ctx, ctl );
429 SUBDBG(
"example_shutdown_component..." );
445 SUBDBG(
"example_shutdown_thread... %p", ctx );
468 SUBDBG(
"example_ctl..." );
488 SUBDBG(
"example_set_domain..." );
491 SUBDBG(
" PAPI_DOM_USER " );
495 SUBDBG(
" PAPI_DOM_KERNEL " );
499 SUBDBG(
" PAPI_DOM_OTHER " );
503 SUBDBG(
" PAPI_DOM_ALL " );
530 switch ( modifier ) {
547 *EventCode = *EventCode + 1;
611 .short_name =
"example",
612 .description =
"A simple example component",
614 .support_version =
"n/a",
615 .kernel_version =
"n/a",
676 .ntv_name_to_code = NULL,
static int _example_ntv_code_to_descr(unsigned int EventCode, char *descr, int len)
static int _example_shutdown_component(void)
static long long example_global_autoinc_value
static int detect_example(void)
static int _example_ntv_enum_events(unsigned int *EventCode, int modifier)
example_register_t ra_bits
static int _example_init_component(int cidx)
PAPI_component_info_t cmp_info
static int _example_stop(hwd_context_t *ctx, hwd_control_state_t *ctl)
papi_vector_t _example_vector
int which_counter[EXAMPLE_MAX_SIMULTANEOUS_COUNTERS]
static int example_hardware_write(int which_one, example_context_t *ctx, long long value)
Return codes and api definitions.
static long long example_hardware_read(int which_one, example_context_t *ctx)
static int _example_init_control_state(hwd_control_state_t *ctl)
char events[MAX_EVENTS][BUFSIZ]
example_register_t resources
static int _example_ctl(hwd_context_t *ctx, int code, _papi_int_option_t *option)
static int _example_shutdown_thread(hwd_context_t *ctx)
static int _example_ntv_code_to_name(unsigned int EventCode, char *name, int len)
#define EXAMPLE_TOTAL_EVENTS
long long counter[EXAMPLE_MAX_MULTIPLEX_COUNTERS]
static int _example_write(hwd_context_t *ctx, hwd_control_state_t *ctl, long long *events)
#define EXAMPLE_MAX_SIMULTANEOUS_COUNTERS
static int _example_reset(hwd_context_t *ctx, hwd_control_state_t *ctl)
#define SUBDBG(format, args...)
#define EXAMPLE_GLOBAL_AUTOINC_REG
void PAPIERROR(char *format,...)
char name[PAPI_MAX_STR_LEN]
static example_native_event_entry_t * example_native_table
static int _example_init_thread(hwd_context_t *ctx)
static int _example_start(hwd_context_t *ctx, hwd_control_state_t *ctl)
static void example_hardware_reset(example_context_t *ctx)
#define EXAMPLE_AUTOINC_REG
#define EXAMPLE_MAX_MULTIPLEX_COUNTERS
static int _example_update_control_state(hwd_control_state_t *ctl, NativeInfo_t *native, int count, hwd_context_t *ctx)
static int _example_set_domain(hwd_control_state_t *cntrl, int domain)
#define EXAMPLE_CONSTANT_REG
static int _example_read(hwd_context_t *ctx, hwd_control_state_t *ctl, long long **events, int flags)
#define papi_calloc(a, b)