13#define REFRESH_LAT 4000
15#define INVALID_RESULT -1000000L
34#define HANDLE_STRING_ERROR {fprintf(stderr,"%s:%i unexpected string function error.\n",__FILE__,__LINE__); exit(-1);}
76 PAPIERROR(
"This shouldn't be possible\n");
86 snprintf(temp->
path, PATH_MAX,
"%s", filename);
97 char path[PATH_MAX],filename[PATH_MAX];
106 struct dirent *hwmonx;
116 dir = opendir(base_dir);
118 SUBDBG(
"Can't find %s, are you sure the coretemp module is loaded?\n",
124 while( (hwmonx = readdir(dir) ) ) {
125 if ( !strncmp(
"hwmon", hwmonx->d_name, 5) ) {
130 for(pathnum=0;pathnum<
NUM_PATHS;pathnum++) {
132 retlen = snprintf(path, PATH_MAX,
"%s/%s/%s",
133 base_dir, hwmonx->d_name,paths[pathnum]);
134 if (retlen <= 0 || PATH_MAX <= retlen) {
135 SUBDBG(
"Path length is too long.\n");
138 SUBDBG(
"Trying to open %s\n",path);
148 SUBDBG(
"Module name too long.\n");
151 fff=fopen(filename,
"r");
156 modulename[strlen(modulename)-1]=
'\0';
161 SUBDBG(
"Found module %s\n",modulename);
178 SUBDBG(
"Failed to construct location label.\n");
181 fff=fopen(filename,
"r");
196 SUBDBG(
"Failed input temperature string.\n");
199 fff=fopen(filename,
"r");
200 if (
fff==NULL)
continue;
205 SUBDBG(
"Unable to generate name %s:in%i_input\n", hwmonx->d_name,
i);
216 SUBDBG(
"snprintf failed.\n");
238 SUBDBG(
"Location label string failed.\n");
241 fff=fopen(filename,
"r");
256 SUBDBG(
"Input temperature string failed.\n");
259 fff=fopen(filename,
"r");
260 if (
fff==NULL)
continue;
265 SUBDBG(
"Unable to generate name %s:temp%i_input\n", hwmonx->d_name,
i);
276 SUBDBG(
"snprintf failed.\n");
297 SUBDBG(
"Failed to write fan label string.\n");
300 fff=fopen(filename,
"r");
314 SUBDBG(
"Unable to generate filename %s/fan%d_input\n", path,
i);
320 fff=fopen(filename,
"r");
321 if (
fff==NULL)
continue;
326 SUBDBG(
"Unable to generate name %s:fan%i_input\n", hwmonx->d_name,
i);
337 SUBDBG(
"snprintf failed.\n");
528 long long **
events,
int flags)
664 switch ( modifier ) {
681 *EventCode = *EventCode + 1;
700 int index = EventCode;
715 int index = EventCode;
728 int index = EventCode;
749 .short_name =
"coretemp",
750 .description =
"Linux hwmon temperature and other info",
761 .fast_real_timer = 0,
762 .fast_virtual_timer = 0,
764 .attach_must_ptrace = 0,
get real time counter value in microseconds
struct papi_vectors * _papi_hwd[]
int coretemp_ctl(hwd_context_t *ctx, int code, _papi_int_option_t *option)
volatile int buf[CACHE_FLUSH_BUFFER_SIZE_INTS]
char events[MAX_EVENTS][BUFSIZ]
static int _coretemp_ntv_code_to_descr(unsigned int EventCode, char *name, int len)
static int _coretemp_init_thread(hwd_context_t *ctx)
static int _coretemp_ntv_code_to_name(unsigned int EventCode, char *name, int len)
static int _coretemp_ntv_code_to_info(unsigned int EventCode, PAPI_event_info_t *info)
static struct temp_event * root
static CORETEMP_native_event_entry_t * _coretemp_native_events
static long long getEventValue(int index)
static int _coretemp_set_domain(hwd_control_state_t *cntl, int domain)
static int _coretemp_stop(hwd_context_t *ctx, hwd_control_state_t *ctl)
static int insert_in_list(char *name, char *units, char *description, char *filename)
static int is_initialized
static int _coretemp_read(hwd_context_t *ctx, hwd_control_state_t *ctl, long long **events, int flags)
static int _coretemp_init_control_state(hwd_control_state_t *ctl)
static int _coretemp_ntv_enum_events(unsigned int *EventCode, int modifier)
static int _coretemp_init_component(int cidx)
static int _coretemp_ctl(hwd_context_t *ctx, int code, _papi_int_option_t *option)
static int _coretemp_reset(hwd_context_t *ctx, hwd_control_state_t *ctl)
static int _coretemp_update_control_state(hwd_control_state_t *ptr, NativeInfo_t *native, int count, hwd_context_t *ctx)
papi_vector_t _coretemp_vector
static int _coretemp_start(hwd_context_t *ctx, hwd_control_state_t *ctl)
static int generateEventList(char *base_dir)
static int _coretemp_shutdown_component()
static struct temp_event * last
static int _coretemp_shutdown_thread(hwd_context_t *ctx)
#define HANDLE_STRING_ERROR
coretemp component This file has the source code for a component that enables PAPI-C to access hardwa...
#define CORETEMP_MAX_COUNTERS
Return codes and api definitions.
#define SUBDBG(format, args...)
int fclose(FILE *__stream)
void PAPIERROR(char *format,...)
#define papi_calloc(a, b)
char units[MAX_EVENTS][BUFSIZ]
long long counts[CORETEMP_MAX_COUNTERS]
char units[PAPI_MIN_STR_LEN]
CORETEMP_register_t resources
char description[PAPI_MAX_STR_LEN]
char name[PAPI_MAX_STR_LEN]
char name[PAPI_MAX_STR_LEN]
char disabled_reason[PAPI_HUGE_STR_LEN]
char units[PAPI_MIN_STR_LEN]
char symbol[PAPI_HUGE_STR_LEN]
char long_descr[PAPI_HUGE_STR_LEN]
PAPI_component_info_t cmp_info
char description[PAPI_MAX_STR_LEN]
char location[PAPI_MAX_STR_LEN]
char units[PAPI_MIN_STR_LEN]
char name[PAPI_MAX_STR_LEN]