23#include <sys/resource.h>
24#include <sys/sysctl.h>
37#define CORETEMP_MAX_COUNTERS 32
40#define UNREFERENCED(x) (void)x
43typedef struct coretemp_register
54typedef struct coretemp_native_event_entry
64typedef struct coretemp_reg_alloc
70typedef struct coretemp_control_state
77typedef struct coretemp_context
103 SUBDBG(
"coretemp_init_thread %p...\n", ctx);
109 if (sysctlnametomib (
"dev.coretemp.0.%driver", mib, &len) == -1)
130 SUBDBG(
"coretemp_init_component...\n");
135 sprintf (
tmp,
"dev.coretemp.%d.%%driver",
i);
137 ret = sysctlnametomib (
tmp, mib, &len);
142 sprintf (
tmp,
"dev.coretemp.%d.%%driver",
i);
144 ret = sysctlnametomib (
tmp, mib, &len);
155 perror(
"malloc():Could not get memory for coretemp events table" );
170 sprintf (
tmp,
"dev.cpu.%d.temperature",
i);
193 SUBDBG(
"coretemp_init_control_state... %p\n", ctrl);
221 int index = *EventCode;
225 *EventCode = *EventCode + 1;
247 int index = EventCode;
261 int index = EventCode;
286 SUBDBG(
"coretemp_update_control_state %p %p...\n", ptr, ctx);
294 SUBDBG (
"\nnative[%i].ni_position = coretemp_native_table[%i].resources.selector-1 = %i;\n",
307 SUBDBG(
"coretemp_start %p %p...\n", ctx, ctrl );
321 SUBDBG(
"coretemp_stop %p %p...\n", ctx, ctrl);
338 SUBDBG(
"coretemp_read... %p %d\n", ctx, flags);
344 size_t len =
sizeof(
tmp);
349 c->counters[
i] =
tmp/10;
369 SUBDBG(
"coretemp_write... %p %p\n", ctx, ctrl);
383 SUBDBG(
"coretemp_reset ctx=%p ctrl=%p...\n", ctx, ctrl);
394 SUBDBG(
"coretemp_shutdown_component...\n");
415 SUBDBG(
"coretemp_ctl... %p %d %p\n", ctx, code, option );
436 SUBDBG (
"coretemp_set_domain... %p %d\n", cntrl, domain);
440 SUBDBG(
" PAPI_DOM_ALL \n" );
452 .
name =
"coretemp_freebsd",
453 .short_name =
"coretemp",
464 .fast_real_timer = 0,
465 .fast_virtual_timer = 0,
467 .attach_must_ptrace = 0,
struct papi_vectors * _papi_hwd[]
static int CORETEMP_NUM_EVENTS
int coretemp_reset(hwd_context_t *ctx, hwd_control_state_t *ctrl)
int coretemp_ntv_code_to_bits(unsigned int EventCode, hwd_register_t *bits)
int coretemp_shutdown_component(void)
int coretemp_init_thread(hwd_context_t *ctx)
int coretemp_ntv_code_to_descr(unsigned int EventCode, char *name, int len)
int coretemp_stop(hwd_context_t *ctx, hwd_control_state_t *ctrl)
int coretemp_ctl(hwd_context_t *ctx, int code, _papi_int_option_t *option)
int coretemp_init_control_state(hwd_control_state_t *ctrl)
int coretemp_set_domain(hwd_control_state_t *cntrl, int domain)
int coretemp_ntv_enum_events(unsigned int *EventCode, int modifier)
int coretemp_start(hwd_context_t *ctx, hwd_control_state_t *ctrl)
static coretemp_native_event_entry_t * coretemp_native_table
int coretemp_update_control_state(hwd_control_state_t *ptr, NativeInfo_t *native, int count, hwd_context_t *ctx)
int coretemp_init_component()
int coretemp_ntv_code_to_name(unsigned int EventCode, char *name, int len)
papi_vector_t _coretemp_freebsd_vector
#define CORETEMP_MAX_COUNTERS
int coretemp_write(hwd_context_t *ctx, hwd_control_state_t *ctrl, long_long events[])
int coretemp_read(hwd_context_t *ctx, hwd_control_state_t *ctrl, long_long **events, int flags)
char events[MAX_EVENTS][BUFSIZ]
static double c[MATRIX_SIZE][MATRIX_SIZE]
#define CORETEMP_MAX_COUNTERS
Return codes and api definitions.
#define SUBDBG(format, args...)
char name[PAPI_MAX_STR_LEN]
coretemp_control_state_t state
coretemp_register_t resources
coretemp_register_t ra_bits
PAPI_component_info_t cmp_info