PAPI 7.1.0.0
Loading...
Searching...
No Matches
linux-coretemp.c
Go to the documentation of this file.
1#include <string.h>
2
3/* Headers required by PAPI */
4#include "papi.h"
5#include "papi_internal.h"
6#include "papi_vector.h"
7#include "papi_memory.h"
8
9#include "linux-coretemp.h"
10
11/* this is what I found on my core2 machine
12 * but I have not explored this widely yet*/
13#define REFRESH_LAT 4000
14
15#define INVALID_RESULT -1000000L
16
18
19/* temporary event */
20struct temp_event {
25 char path[PATH_MAX];
26 int stone;
27 long count;
29};
30
31// The following macro follows if a string function has an error. It should
32// never happen; but it is necessary to prevent compiler warnings. We print
33// something just in case there is programmer error in invoking the function.
34#define HANDLE_STRING_ERROR {fprintf(stderr,"%s:%i unexpected string function error.\n",__FILE__,__LINE__); exit(-1);}
35
37static int num_events = 0;
38static int is_initialized = 0;
39
40/***************************************************************************/
41/****** BEGIN FUNCTIONS USED INTERNALLY SPECIFIC TO THIS COMPONENT *******/
42/***************************************************************************/
43
44static struct temp_event* root = NULL;
45static struct temp_event *last = NULL;
46
47static int
49 char *description, char *filename) {
50
51
52 struct temp_event *temp;
53
54
55 /* new_event path, events->d_name */
56 temp = (struct temp_event *) papi_calloc(1, sizeof(struct temp_event));
57 if (temp==NULL) {
58 PAPIERROR("out of memory!");
59 /* We should also free any previously allocated data */
60 return PAPI_ENOMEM;
61 }
62
63 temp->next = NULL;
64
65 if (root == NULL) {
66 root = temp;
67 }
68 else if (last) {
69 last->next = temp;
70 }
71 else {
72 /* Because this is a function, it is possible */
73 /* we are called with root!=NULL but no last */
74 /* so add this to keep coverity happy */
75 free(temp);
76 PAPIERROR("This shouldn't be possible\n");
77
78 return PAPI_ECMP;
79 }
80
81 last = temp;
82
83 snprintf(temp->name, PAPI_MAX_STR_LEN, "%s", name);
84 snprintf(temp->units, PAPI_MIN_STR_LEN, "%s", units);
85 snprintf(temp->description, PAPI_MAX_STR_LEN, "%s", description);
86 snprintf(temp->path, PATH_MAX, "%s", filename);
87
88 return PAPI_OK;
89}
90
91/*
92 * find all coretemp information reported by the kernel
93 */
94static int
95generateEventList(char *base_dir)
96{
97 char path[PATH_MAX],filename[PATH_MAX];
98 char modulename[PAPI_MIN_STR_LEN],
103 DIR *dir,*d;
104 FILE *fff;
105 int count = 0;
106 struct dirent *hwmonx;
107 int i,pathnum;
108 int retlen;
109
110#define NUM_PATHS 2
111 char paths[NUM_PATHS][PATH_MAX]={
112 "device","."
113 };
114
115 /* Open "/sys/class/hwmon" */
116 dir = opendir(base_dir);
117 if ( dir == NULL ) {
118 SUBDBG("Can't find %s, are you sure the coretemp module is loaded?\n",
119 base_dir);
120 return 0;
121 }
122
123 /* Iterate each /sys/class/hwmonX/device directory */
124 while( (hwmonx = readdir(dir) ) ) {
125 if ( !strncmp("hwmon", hwmonx->d_name, 5) ) {
126
127 /* Found a hwmon directory */
128
129 /* Sometimes the files are in ./, sometimes in device/ */
130 for(pathnum=0;pathnum<NUM_PATHS;pathnum++) {
131
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");
136 return PAPI_EINVAL;
137 }
138 SUBDBG("Trying to open %s\n",path);
139 d = opendir(path);
140 if (d==NULL) {
141 continue;
142 }
143
144 /* Get the name of the module */
145
146 retlen = snprintf(filename, PAPI_MAX_STR_LEN, "%s/name",path);
147 if (retlen <= 0 || PAPI_MAX_STR_LEN <= retlen) {
148 SUBDBG("Module name too long.\n");
149 return PAPI_EINVAL;
150 }
151 fff=fopen(filename,"r");
152 if (fff==NULL) {
153 snprintf(modulename, PAPI_MIN_STR_LEN, "Unknown");
154 } else {
155 if (fgets(modulename,PAPI_MIN_STR_LEN,fff)!=NULL) {
156 modulename[strlen(modulename)-1]='\0';
157 }
158 fclose(fff);
159 }
160
161 SUBDBG("Found module %s\n",modulename);
162
163 /******************************************************/
164 /* Try handling all events starting with in (voltage) */
165 /******************************************************/
166
167
168 /* arbitrary maximum */
169 /* the problem is the numbering can be sparse */
170 /* should probably go back to dirent listing */
171
172 for(i=0;i<32;i++) {
173
174 /* Try looking for a location label */
175 retlen = snprintf(filename, PAPI_MAX_STR_LEN, "%s/in%d_label",
176 path,i);
177 if (retlen <= 0 || PAPI_MAX_STR_LEN <= retlen) {
178 SUBDBG("Failed to construct location label.\n");
179 return PAPI_EINVAL;
180 }
181 fff=fopen(filename,"r");
182 if (fff==NULL) {
183 strncpy(location,"?",PAPI_MIN_STR_LEN);
184 }
185 else {
186 if (fgets(location,PAPI_MIN_STR_LEN,fff)!=NULL) {
187 location[strlen(location)-1]='\0';
188 }
189 fclose(fff);
190 }
191
192 /* Look for input temperature */
193 retlen = snprintf(filename, PAPI_MAX_STR_LEN, "%s/in%d_input",
194 path,i);
195 if (retlen <= 0 || PAPI_MAX_STR_LEN <= retlen) {
196 SUBDBG("Failed input temperature string.\n");
197 return PAPI_EINVAL;
198 }
199 fff=fopen(filename,"r");
200 if (fff==NULL) continue;
201 fclose(fff);
202
203 retlen = snprintf(name, PAPI_MAX_STR_LEN, "%s:in%i_input", hwmonx->d_name, i);
204 if (retlen <= 0 || PAPI_MAX_STR_LEN <= retlen) {
205 SUBDBG("Unable to generate name %s:in%i_input\n", hwmonx->d_name, i);
206 closedir(dir);
207 closedir(d);
208 return ( PAPI_EINVAL );
209 }
210
211 snprintf(units, PAPI_MIN_STR_LEN, "V");
212 retlen = snprintf(description, PAPI_MAX_STR_LEN, "%s, %s module, label %s",
213 units,modulename,
214 location);
215 if (retlen <= 0 || PAPI_MAX_STR_LEN <= retlen) {
216 SUBDBG("snprintf failed.\n");
217 return PAPI_EINVAL;
218 }
219
220 if (insert_in_list(name,units,description,filename)!=PAPI_OK) {
221 goto done_error;
222 }
223
224 count++;
225
226 }
227
228 /************************************************************/
229 /* Try handling all events starting with temp (temperature) */
230 /************************************************************/
231
232 for(i=0;i<32;i++) {
233
234 /* Try looking for a location label */
235 retlen = snprintf(filename, PAPI_MAX_STR_LEN, "%s/temp%d_label",
236 path,i);
237 if (retlen <= 0 || PAPI_MAX_STR_LEN <= retlen) {
238 SUBDBG("Location label string failed.\n");
239 return PAPI_EINVAL;
240 }
241 fff=fopen(filename,"r");
242 if (fff==NULL) {
243 strncpy(location,"?",PAPI_MIN_STR_LEN);
244 }
245 else {
246 if (fgets(location,PAPI_MIN_STR_LEN,fff)!=NULL) {
247 location[strlen(location)-1]='\0';
248 }
249 fclose(fff);
250 }
251
252 /* Look for input temperature */
253 retlen = snprintf(filename, PAPI_MAX_STR_LEN, "%s/temp%d_input",
254 path,i);
255 if (retlen <= 0 || PAPI_MAX_STR_LEN <= retlen) {
256 SUBDBG("Input temperature string failed.\n");
257 return PAPI_EINVAL;
258 }
259 fff=fopen(filename,"r");
260 if (fff==NULL) continue;
261 fclose(fff);
262
263 retlen = snprintf(name, PAPI_MAX_STR_LEN, "%s:temp%i_input", hwmonx->d_name, i);
264 if (retlen <= 0 || PAPI_MAX_STR_LEN <= retlen) {
265 SUBDBG("Unable to generate name %s:temp%i_input\n", hwmonx->d_name, i);
266 closedir(d);
267 closedir(dir);
268 return ( PAPI_EINVAL );
269 }
270
271 snprintf(units, PAPI_MIN_STR_LEN, "degrees C");
272 retlen = snprintf(description, PAPI_MAX_STR_LEN, "%s, %s module, label %s",
273 units,modulename,
274 location);
275 if (retlen <= 0 || PAPI_MAX_STR_LEN <= retlen) {
276 SUBDBG("snprintf failed.\n");
277 return PAPI_EINVAL;
278 }
279
280 if (insert_in_list(name,units,description,filename)!=PAPI_OK) {
281 goto done_error;
282 }
283
284 count++;
285 }
286
287 /************************************************************/
288 /* Try handling all events starting with fan (fan) */
289 /************************************************************/
290
291 for(i=0;i<32;i++) {
292
293 /* Try looking for a location label */
294 retlen = snprintf(filename, PAPI_MAX_STR_LEN, "%s/fan%d_label",
295 path,i);
296 if (retlen <= 0 || PAPI_MAX_STR_LEN <= retlen) {
297 SUBDBG("Failed to write fan label string.\n");
298 return PAPI_EINVAL;
299 }
300 fff=fopen(filename,"r");
301 if (fff==NULL) {
302 strncpy(location,"?",PAPI_MIN_STR_LEN);
303 }
304 else {
305 if (fgets(location,PAPI_MIN_STR_LEN,fff)!=NULL) {
306 location[strlen(location)-1]='\0';
307 }
308 fclose(fff);
309 }
310
311 /* Look for input fan */
312 retlen = snprintf(filename, PAPI_MAX_STR_LEN, "%s/fan%d_input", path,i);
313 if (retlen <= 0 || PAPI_MAX_STR_LEN <= retlen) {
314 SUBDBG("Unable to generate filename %s/fan%d_input\n", path,i);
315 closedir(d);
316 closedir(dir);
317 return ( PAPI_EINVAL );
318 }
319
320 fff=fopen(filename,"r");
321 if (fff==NULL) continue;
322 fclose(fff);
323
324 retlen = snprintf(name, PAPI_MAX_STR_LEN, "%s:fan%i_input", hwmonx->d_name, i);
325 if (retlen <= 0 || PAPI_MAX_STR_LEN <= retlen) {
326 SUBDBG("Unable to generate name %s:fan%i_input\n", hwmonx->d_name, i);
327 closedir(d);
328 closedir(dir);
329 return ( PAPI_EINVAL );
330 }
331
332 snprintf(units, PAPI_MIN_STR_LEN, "RPM");
333 retlen = snprintf(description, PAPI_MAX_STR_LEN, "%s, %s module, label %s",
334 units,modulename,
335 location);
336 if (retlen <= 0 || PAPI_MAX_STR_LEN <= retlen) {
337 SUBDBG("snprintf failed.\n");
338 return PAPI_EINVAL;
339 }
340
341 if (insert_in_list(name,units,description,filename)!=PAPI_OK) {
342 goto done_error;
343 }
344
345 count++;
346
347 }
348 closedir(d);
349 }
350 }
351 }
352
353 closedir(dir);
354 return count;
355
356done_error:
357 closedir(d);
358 closedir(dir);
359 return PAPI_ECMP;
360}
361
362static long long
363getEventValue( int index )
364{
365 char buf[PAPI_MAX_STR_LEN];
366 FILE* fp;
367 long result;
368
369 if (_coretemp_native_events[index].stone) {
370 return _coretemp_native_events[index].value;
371 }
372
373 fp = fopen(_coretemp_native_events[index].path, "r");
374 if (fp==NULL) {
375 return INVALID_RESULT;
376 }
377
378 if (fgets(buf, PAPI_MAX_STR_LEN, fp)==NULL) {
380 }
381 else {
382 result=strtoll(buf, NULL, 10);
383 }
384 fclose(fp);
385
386 return result;
387}
388
389/*****************************************************************************
390 ******************* BEGIN PAPI's COMPONENT REQUIRED FUNCTIONS *************
391 *****************************************************************************/
392
393/*
394 * This is called whenever a thread is initialized
395 */
396static int
398{
399 ( void ) ctx;
400 return PAPI_OK;
401}
402
403
404
405/* Initialize hardware counters, setup the function vector table
406 * and get hardware information, this routine is called when the
407 * PAPI process is initialized (IE PAPI_library_init)
408 */
409static int
411{
412 int retval = PAPI_OK;
413 int i = 0;
414 struct temp_event *t,*last;
415
416 if ( is_initialized )
417 goto fn_exit;
418
419 is_initialized = 1;
420
421 /* This is the prefered method, all coretemp sensors are symlinked here
422 * see $(kernel_src)/Documentation/hwmon/sysfs-interface */
423
424 num_events = generateEventList("/sys/class/hwmon");
425
426 if ( num_events < 0 ) {
427 char* strCpy;
429 "Cannot open /sys/class/hwmon",PAPI_MAX_STR_LEN);
431 if (strCpy == NULL) HANDLE_STRING_ERROR;
433 goto fn_fail;
434 }
435
436 if ( num_events == 0 ) {
437 char* strCpy=strncpy(_coretemp_vector.cmp_info.disabled_reason,
438 "No coretemp events found",PAPI_MAX_STR_LEN);
440 if (strCpy == NULL) HANDLE_STRING_ERROR;
442 goto fn_fail;
443 }
444
445 t = root;
446
449 if (_coretemp_native_events == NULL) {
450 int strErr=snprintf(_coretemp_vector.cmp_info.disabled_reason, PAPI_MAX_STR_LEN, "malloc() of _coretemp_native_events failed for %lu bytes.", num_events*sizeof(CORETEMP_native_event_entry_t));
454 goto fn_fail;
455 }
456
457 do {
458 int retlen;
459 retlen = snprintf(_coretemp_native_events[i].name, PAPI_MAX_STR_LEN, "%s", t->name);
460 if (retlen <= 0 || retlen >= PAPI_MAX_STR_LEN) HANDLE_STRING_ERROR;
461
462 retlen = snprintf(_coretemp_native_events[i].path, PATH_MAX, "%s", t->path);
463 if (retlen <= 0 || retlen >= PATH_MAX) HANDLE_STRING_ERROR;
464
465 retlen = snprintf(_coretemp_native_events[i].units, PAPI_MIN_STR_LEN, "%s", t->units);
466 if (retlen <= 0 || retlen >= PAPI_MIN_STR_LEN) HANDLE_STRING_ERROR;
467
469 if (retlen <= 0 || retlen >= PAPI_MAX_STR_LEN) HANDLE_STRING_ERROR;
470
473 last = t;
474 t = t->next;
476 i++;
477 } while (t != NULL);
478 root = NULL;
479
480 /* Export the total number of events available */
482
483 /* Export the component id */
485
486 fn_exit:
487 _papi_hwd[cidx]->cmp_info.disabled = retval;
488 return retval;
489 fn_fail:
490 goto fn_exit;
491}
492
493
494
495
496/*
497 * Control of counters (Reading/Writing/Starting/Stopping/Setup)
498 * functions
499 */
500static int
502{
503 int i;
504
506
507 for ( i=0; i < num_events; i++ ) {
508 coretemp_ctl->counts[i] = getEventValue(i);
509 }
510
511 /* Set last access time for caching results */
512 coretemp_ctl->lastupdate = PAPI_get_real_usec();
513
514 return PAPI_OK;
515}
516
517static int
519{
520 ( void ) ctx;
521 ( void ) ctl;
522
523 return PAPI_OK;
524}
525
526static int
528 long long ** events, int flags)
529{
530 (void) flags;
531 (void) ctx;
532
534 long long now = PAPI_get_real_usec();
535 int i;
536
537 /* Only read the values from the kernel if enough time has passed */
538 /* since the last read. Otherwise return cached values. */
539
540 if ( now - control->lastupdate > REFRESH_LAT ) {
541 for ( i = 0; i < num_events; i++ ) {
542 control->counts[i] = getEventValue( i );
543 }
544 control->lastupdate = now;
545 }
546
547 /* Pass back a pointer to our results */
548 *events = control->counts;
549
550 return PAPI_OK;
551}
552
553static int
555{
556 (void) ctx;
557 /* read values */
559 int i;
560
561 for ( i = 0; i < num_events; i++ ) {
562 control->counts[i] = getEventValue( i );
563 }
564
565 return PAPI_OK;
566}
567
568/* Shutdown a thread */
569static int
571{
572 ( void ) ctx;
573 return PAPI_OK;
574}
575
576
577/*
578 * Clean up what was setup in coretemp_init_component().
579 */
580static int
582{
583 if ( is_initialized ) {
584 is_initialized = 0;
587 }
588 return PAPI_OK;
589}
590
591
592/* This function sets various options in the component
593 * The valid codes being passed in are PAPI_SET_DEFDOM,
594 * PAPI_SET_DOMAIN, PAPI_SETDEFGRN, PAPI_SET_GRANUL * and PAPI_SET_INHERIT
595 */
596static int
598{
599 ( void ) ctx;
600 ( void ) code;
601 ( void ) option;
602
603 return PAPI_OK;
604}
605
606
607static int
610 hwd_context_t * ctx )
611{
612 int i, index;
613 ( void ) ctx;
614 ( void ) ptr;
615
616 for ( i = 0; i < count; i++ ) {
617 index = native[i].ni_event;
618 native[i].ni_position = _coretemp_native_events[index].resources.selector - 1;
619 }
620 return PAPI_OK;
621}
622
623
624/*
625 * This function has to set the bits needed to count different domains
626 * In particular: PAPI_DOM_USER, PAPI_DOM_KERNEL PAPI_DOM_OTHER
627 * By default return PAPI_EINVAL if none of those are specified
628 * and PAPI_OK with success
629 * PAPI_DOM_USER is only user context is counted
630 * PAPI_DOM_KERNEL is only the Kernel/OS context is counted
631 * PAPI_DOM_OTHER is Exception/transient mode (like user TLB misses)
632 * PAPI_DOM_ALL is all of the domains
633 */
634static int
636{
637 (void) cntl;
638 if ( PAPI_DOM_ALL != domain )
639 return PAPI_EINVAL;
640
641 return PAPI_OK;
642}
643
644
645static int
647{
648 ( void ) ctx;
649 ( void ) ctl;
650
651 return PAPI_OK;
652}
653
654
655/*
656 * Native Event functions
657 */
658static int
659_coretemp_ntv_enum_events( unsigned int *EventCode, int modifier )
660{
661
662 int index;
663
664 switch ( modifier ) {
665
666 case PAPI_ENUM_FIRST:
667
668 if (num_events==0) {
669 return PAPI_ENOEVNT;
670 }
671 *EventCode = 0;
672
673 return PAPI_OK;
674
675
676 case PAPI_ENUM_EVENTS:
677
678 index = *EventCode;
679
680 if ( index < num_events - 1 ) {
681 *EventCode = *EventCode + 1;
682 return PAPI_OK;
683 } else {
684 return PAPI_ENOEVNT;
685 }
686 break;
687
688 default:
689 return PAPI_EINVAL;
690 }
691 return PAPI_EINVAL;
692}
693
694/*
695 *
696 */
697static int
698_coretemp_ntv_code_to_name( unsigned int EventCode, char *name, int len )
699{
700 int index = EventCode;
701
702 if ( index >= 0 && index < num_events ) {
703 strncpy( name, _coretemp_native_events[index].name, len );
704 return PAPI_OK;
705 }
706 return PAPI_ENOEVNT;
707}
708
709/*
710 *
711 */
712static int
713_coretemp_ntv_code_to_descr( unsigned int EventCode, char *name, int len )
714{
715 int index = EventCode;
716
717 if ( index >= 0 && index < num_events ) {
718 strncpy( name, _coretemp_native_events[index].description, len );
719 return PAPI_OK;
720 }
721 return PAPI_ENOEVNT;
722}
723
724static int
725_coretemp_ntv_code_to_info(unsigned int EventCode, PAPI_event_info_t *info)
726{
727
728 int index = EventCode;
729
730 if ( ( index < 0) || (index >= num_events )) return PAPI_ENOEVNT;
731
732 strncpy( info->symbol, _coretemp_native_events[index].name, sizeof(info->symbol));
733 strncpy( info->long_descr, _coretemp_native_events[index].description, sizeof(info->long_descr));
734 strncpy( info->units, _coretemp_native_events[index].units, sizeof(info->units));
735 info->units[sizeof(info->units)-1] = '\0';
736
737 return PAPI_OK;
738}
739
740
741
742/*
743 *
744 */
746 .cmp_info = {
747 /* default component information (unspecified values are initialized to 0) */
748 .name = "coretemp",
749 .short_name = "coretemp",
750 .description = "Linux hwmon temperature and other info",
751 .version = "4.2.1",
752 .num_mpx_cntrs = CORETEMP_MAX_COUNTERS,
753 .num_cntrs = CORETEMP_MAX_COUNTERS,
754 .default_domain = PAPI_DOM_ALL,
755 .available_domains = PAPI_DOM_ALL,
756 .default_granularity = PAPI_GRN_SYS,
757 .available_granularities = PAPI_GRN_SYS,
758 .hardware_intr_sig = PAPI_INT_SIGNAL,
759
760 /* component specific cmp_info initializations */
761 .fast_real_timer = 0,
762 .fast_virtual_timer = 0,
763 .attach = 0,
764 .attach_must_ptrace = 0,
765 }
766 ,
767
768 /* sizes of framework-opaque component-private structures */
769 .size = {
770 .context = sizeof ( CORETEMP_context_t ),
771 .control_state = sizeof ( CORETEMP_control_state_t ),
772 .reg_value = sizeof ( CORETEMP_register_t ),
773 .reg_alloc = sizeof ( CORETEMP_reg_alloc_t ),
774 }
775 ,
776 /* function pointers in this component */
777 .init_thread = _coretemp_init_thread,
778 .init_component = _coretemp_init_component,
779 .init_control_state = _coretemp_init_control_state,
780 .start = _coretemp_start,
781 .stop = _coretemp_stop,
782 .read = _coretemp_read,
783 .shutdown_thread = _coretemp_shutdown_thread,
784 .shutdown_component = _coretemp_shutdown_component,
785 .ctl = _coretemp_ctl,
786
787 .update_control_state = _coretemp_update_control_state,
788 .set_domain = _coretemp_set_domain,
789 .reset = _coretemp_reset,
790
791 .ntv_enum_events = _coretemp_ntv_enum_events,
792 .ntv_code_to_name = _coretemp_ntv_code_to_name,
793 .ntv_code_to_descr = _coretemp_ntv_code_to_descr,
794 .ntv_code_to_info = _coretemp_ntv_code_to_info,
795};
volatile int result
int i
static long count
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]
Definition: do_loops.c:12
#define PAPI_ENUM_EVENTS
Definition: f90papi.h:224
#define PAPI_OK
Definition: f90papi.h:73
#define PAPI_ENUM_FIRST
Definition: f90papi.h:85
#define PAPI_MIN_STR_LEN
Definition: f90papi.h:208
#define PAPI_ENOEVNT
Definition: f90papi.h:139
#define PAPI_EINVAL
Definition: f90papi.h:115
#define PAPI_MAX_STR_LEN
Definition: f90papi.h:77
#define PAPI_ECMP
Definition: f90papi.h:214
#define PAPI_GRN_SYS
Definition: f90papi.h:43
#define PAPI_ENOMEM
Definition: f90papi.h:16
#define PAPI_DOM_ALL
Definition: f90papi.h:261
FILE * fff[MAX_EVENTS]
char events[MAX_EVENTS][BUFSIZ]
static int _coretemp_ntv_code_to_descr(unsigned int EventCode, char *name, int len)
#define INVALID_RESULT
static int num_events
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)
#define REFRESH_LAT
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
#define NUM_PATHS
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
uint16_t location
Return codes and api definitions.
#define SUBDBG(format, args...)
Definition: papi_debug.h:64
int fclose(FILE *__stream)
void PAPIERROR(char *format,...)
#define PAPI_INT_SIGNAL
Definition: papi_internal.h:52
#define papi_calloc(a, b)
Definition: papi_memory.h:37
#define papi_free(a)
Definition: papi_memory.h:35
static FILE * fp
static int native
static int cidx
char units[MAX_EVENTS][BUFSIZ]
Definition: powercap_plot.c:15
const char * name
Definition: rocs.c:225
long long counts[CORETEMP_MAX_COUNTERS]
char units[PAPI_MIN_STR_LEN]
CORETEMP_register_t resources
int stone
long value
char description[PAPI_MAX_STR_LEN]
char name[PAPI_MAX_STR_LEN]
unsigned int selector
char name[PAPI_MAX_STR_LEN]
Definition: papi.h:627
char disabled_reason[PAPI_HUGE_STR_LEN]
Definition: papi.h:634
char units[PAPI_MIN_STR_LEN]
Definition: papi.h:969
char symbol[PAPI_HUGE_STR_LEN]
Definition: papi.h:960
char long_descr[PAPI_HUGE_STR_LEN]
Definition: papi.h:963
PAPI_component_info_t cmp_info
Definition: papi_vector.h:20
char description[PAPI_MAX_STR_LEN]
char location[PAPI_MAX_STR_LEN]
struct temp_event * next
char units[PAPI_MIN_STR_LEN]
char path[PATH_MAX]
char name[PAPI_MAX_STR_LEN]
int retval
Definition: zero_fork.c:53