28#define EXAMPLE_MAX_SIMULTANEOUS_COUNTERS 3
29#define EXAMPLE_MAX_MULTIPLEX_COUNTERS 4
34#define HANDLE_STRING_ERROR {fprintf(stderr,"%s:%i unexpected string function error.\n",__FILE__,__LINE__); exit(-1);}
41typedef struct example_register
52typedef struct example_native_event_entry
64typedef struct example_reg_alloc
74typedef struct example_control_state
86typedef struct example_context
102#define EXAMPLE_ZERO_REG 0
103#define EXAMPLE_CONSTANT_REG 1
104#define EXAMPLE_AUTOINC_REG 2
105#define EXAMPLE_GLOBAL_AUTOINC_REG 3
107#define EXAMPLE_TOTAL_EVENTS 4
130 switch ( which_one ) {
144 fprintf(
stderr,
"Invalid counter read %#x\n",which_one );
158 switch ( which_one ) {
169 perror(
"Invalid counter write" );
196 SUBDBG(
"_example_init_component..." );
201 "Example Hardware not present.");
231 "This is an example counter, that always returns 0" );
236 "This is an example counter, that always returns a constant value of 42" );
241 "This is an example counter, that reports a per-thread auto-incrementing value" );
246 "This is an example counter, that reports a global auto-incrementing value" );
271 SUBDBG(
"_example_init_thread %p...", ctx );
286 SUBDBG(
"example_init_control_state... %p\n", ctl );
308 SUBDBG(
"_example_update_control_state %p %p...", ctl, ctx );
337 SUBDBG(
"example_start %p %p...", ctx, ctl );
359 SUBDBG(
"example_stop %p %p...", ctx, ctl );
373 long long **
events,
int flags )
381 SUBDBG(
"example_read... %p %d", ctx, flags );
410 SUBDBG(
"example_write... %p %p", ctx, ctl );
432 SUBDBG(
"example_reset ctx=%p ctrl=%p...", ctx, ctl );
445 SUBDBG(
"example_shutdown_component..." );
461 SUBDBG(
"example_shutdown_thread... %p", ctx );
484 SUBDBG(
"example_ctl..." );
504 SUBDBG(
"example_set_domain..." );
507 SUBDBG(
" PAPI_DOM_USER " );
511 SUBDBG(
" PAPI_DOM_KERNEL " );
515 SUBDBG(
" PAPI_DOM_OTHER " );
519 SUBDBG(
" PAPI_DOM_ALL " );
546 switch ( modifier ) {
563 *EventCode = *EventCode + 1;
627 .short_name =
"example",
628 .description =
"A simple example component",
630 .support_version =
"n/a",
631 .kernel_version =
"n/a",
692 .ntv_name_to_code = NULL,
struct papi_vectors * _papi_hwd[]
static int detect_example(void)
static int _example_ntv_code_to_name(unsigned int EventCode, char *name, int len)
static example_native_event_entry_t * example_native_table
papi_vector_t _example_vector
#define EXAMPLE_GLOBAL_AUTOINC_REG
#define EXAMPLE_MAX_SIMULTANEOUS_COUNTERS
static int _example_update_control_state(hwd_control_state_t *ctl, NativeInfo_t *native, int count, hwd_context_t *ctx)
static int example_hardware_write(int which_one, example_context_t *ctx, long long value)
static int _example_stop(hwd_context_t *ctx, hwd_control_state_t *ctl)
static int _example_ntv_enum_events(unsigned int *EventCode, int modifier)
#define EXAMPLE_TOTAL_EVENTS
static int _example_reset(hwd_context_t *ctx, hwd_control_state_t *ctl)
static long long example_hardware_read(int which_one, example_context_t *ctx)
#define EXAMPLE_CONSTANT_REG
static void example_hardware_reset(example_context_t *ctx)
#define EXAMPLE_AUTOINC_REG
static int _example_read(hwd_context_t *ctx, hwd_control_state_t *ctl, long long **events, int flags)
static int _example_start(hwd_context_t *ctx, hwd_control_state_t *ctl)
#define EXAMPLE_MAX_MULTIPLEX_COUNTERS
static int _example_shutdown_thread(hwd_context_t *ctx)
static int _example_write(hwd_context_t *ctx, hwd_control_state_t *ctl, long long *events)
static int _example_set_domain(hwd_control_state_t *cntrl, int domain)
static int _example_ctl(hwd_context_t *ctx, int code, _papi_int_option_t *option)
static int _example_init_component(int cidx)
static long long example_global_autoinc_value
static int _example_ntv_code_to_descr(unsigned int EventCode, char *descr, int len)
static int _example_init_control_state(hwd_control_state_t *ctl)
static int _example_init_thread(hwd_context_t *ctx)
static int _example_shutdown_component(void)
#define HANDLE_STRING_ERROR
char events[MAX_EVENTS][BUFSIZ]
Return codes and api definitions.
#define SUBDBG(format, args...)
#define papi_calloc(a, b)
char name[PAPI_MAX_STR_LEN]
char disabled_reason[PAPI_HUGE_STR_LEN]
long long counter[EXAMPLE_MAX_MULTIPLEX_COUNTERS]
int which_counter[EXAMPLE_MAX_SIMULTANEOUS_COUNTERS]
example_register_t resources
example_register_t ra_bits
PAPI_component_info_t cmp_info