PAPI 7.1.0.0
Loading...
Searching...
No Matches
linux-powercap.c
Go to the documentation of this file.
1
10#include <stdio.h>
11#include <dirent.h>
12#include <unistd.h>
13#include <fcntl.h>
14#include <string.h>
15#include <stdint.h>
16#include <errno.h>
17#include <sys/types.h>
18#include <sys/stat.h>
19
20/* Headers required by PAPI */
21#include "papi.h"
22#include "papi_internal.h"
23#include "papi_vector.h"
24#include "papi_memory.h"
25
26// The following macro follows if a string function has an error. It should
27// never happen; but it is necessary to prevent compiler warnings. We print
28// something just in case there is programmer error in invoking the function.
29#define HANDLE_STRING_ERROR {fprintf(stderr,"%s:%i unexpected string function error.\n",__FILE__,__LINE__); exit(-1);}
30
31
32typedef struct _powercap_register {
33 unsigned int selector;
35
36typedef struct _powercap_native_event_entry {
39 char description[PAPI_MAX_STR_LEN];
43 int type;
47
48typedef struct _powercap_reg_alloc {
51
54
55static long long max_pkg_energy_count;
57
58static int num_events=0;
59
60// package events
61#define PKG_ENERGY 0
62#define PKG_MAX_ENERGY_RANGE 1
63#define PKG_MAX_POWER_A 2
64#define PKG_POWER_LIMIT_A 3
65#define PKG_TIME_WINDOW_A 4
66#define PKG_MAX_POWER_B 5
67#define PKG_POWER_LIMIT_B 6
68#define PKG_TIME_WINDOW_B 7
69#define PKG_ENABLED 8
70#define PKG_NAME 9
71
72#define PKG_NUM_EVENTS 10
74static char *pkg_event_names[PKG_NUM_EVENTS] = {"ENERGY_UJ", "MAX_ENERGY_RANGE_UJ", "MAX_POWER_A_UW", "POWER_LIMIT_A_UW", "TIME_WINDOW_A_US", "MAX_POWER_B_UW", "POWER_LIMIT_B_UW", "TIME_WINDOW_B", "ENABLED", "NAME"};
75static char *pkg_sys_names[PKG_NUM_EVENTS] = {"energy_uj", "max_energy_range_uj", "constraint_0_max_power_uw", "constraint_0_power_limit_uw", "constraint_0_time_window_us", "constraint_1_max_power_uw", "constraint_1_power_limit_uw", "constraint_1_time_window_us", "enabled", "name"};
76static mode_t pkg_sys_flags[PKG_NUM_EVENTS] = {O_RDONLY, O_RDONLY, O_RDONLY, O_RDWR, O_RDONLY, O_RDONLY, O_RDWR, O_RDONLY, O_RDONLY, O_RDONLY};
77
78
79// non-package events
80#define COMPONENT_ENERGY 10
81#define COMPONENT_MAX_ENERGY_RANGE 11
82#define COMPONENT_MAX_POWER_A 12
83#define COMPONENT_POWER_LIMIT_A 13
84#define COMPONENT_TIME_WINDOW_A 14
85#define COMPONENT_ENABLED 15
86#define COMPONENT_NAME 16
87
88#define COMPONENT_NUM_EVENTS 7
90static char *component_event_names[COMPONENT_NUM_EVENTS] = {"ENERGY_UJ", "MAX_ENERGY_RANGE_UJ", "MAX_POWER_A_UW", "POWER_LIMIT_A_UW", "TIME_WINDOW_A_US", "ENABLED", "NAME"};
91static char *component_sys_names[COMPONENT_NUM_EVENTS] = {"energy_uj", "max_energy_range_uj", "constraint_0_max_power_uw", "constraint_0_power_limit_uw", "constraint_0_time_window_us", "enabled", "name"};
92static mode_t component_sys_flags[COMPONENT_NUM_EVENTS] = {O_RDONLY, O_RDONLY, O_RDONLY, O_RDWR, O_RDONLY, O_RDONLY, O_RDONLY};
93
94#define POWERCAP_MAX_COUNTERS (2 * (PKG_NUM_EVENTS + (3 * COMPONENT_NUM_EVENTS)))
95
97
99
100typedef struct _powercap_control_state {
102 long long which_counter[POWERCAP_MAX_COUNTERS];
103 long long need_difference[POWERCAP_MAX_COUNTERS];
104 long long lastupdate;
107
108typedef struct _powercap_context {
109 long long start_value[POWERCAP_MAX_COUNTERS];
112
114
115/***************************************************************************/
116/****** BEGIN FUNCTIONS USED INTERNALLY SPECIFIC TO THIS COMPONENT *******/
117/***************************************************************************/
118
119static long long map_index_to_counter( hwd_control_state_t *ctl, int index )
120{
122
123 return control->which_counter[index];
124}
125
126/* Null terminated version of strncpy */
127static char * _local_strlcpy( char *dst, const char *src, size_t size )
128{
129 char *retval = strncpy( dst, src, size );
130 if ( size>0 ) dst[size-1] = '\0';
131 return( retval );
132}
133
134static long long read_powercap_value( int index )
135{
136 int sz = pread(event_fds[index], read_buff, PAPI_MAX_STR_LEN, 0);
137 read_buff[sz] = '\0';
138
139 return atoll(read_buff);
140}
141
142static int write_powercap_value( int index, long long value )
143{
144 snprintf(write_buff, sizeof(write_buff), "%lld", value);
145 int sz = pwrite(event_fds[index], write_buff, PAPI_MAX_STR_LEN, 0);
146 if(sz == -1) {
147 perror("Error in pwrite(): ");
148 }
149 return 1;
150}
151
152/************************* PAPI Functions **********************************/
153
154/*
155 * This is called whenever a thread is initialized
156 */
158{
159 ( void ) ctx;
160 return PAPI_OK;
161}
162
163/*
164 * Called when PAPI process is initialized (i.e. PAPI_library_init)
165 */
167{
168 int retval = PAPI_OK;
169 int num_sockets = -1;
170 int s = -1, e = -1, c = -1;
171 long unsigned int strErr;
172
173 char events_dir[128];
174 char event_path[128];
175 char *strCpy;
176
177 DIR *events;
178
179 // get hw info
180 const PAPI_hw_info_t *hw_info;
182
183 // check if intel processor
185 strCpy=strncpy(_powercap_vector.cmp_info.disabled_reason, "Not an Intel processor", PAPI_MAX_STR_LEN);
186 if (strCpy == NULL) HANDLE_STRING_ERROR;
188 goto fn_fail;
189 }
190
191 // store number of sockets for adding events
192 num_sockets = hw_info->sockets;
193
194 num_events = 0;
195 for(s = 0; s < num_sockets; s++) {
196
197 // Find the directory corresponding to the socket number. There may be other top-level entries in there
198 // besides packages, such as "psys", that mess up the numbering, so we conduct an exhaustive search.
199 int s_dir, found = 0;
200 for(s_dir = 0; ; s_dir++) {
201 strErr=snprintf(event_path, sizeof(event_path), "/sys/class/powercap/intel-rapl:%d/%s", s_dir, pkg_sys_names[PKG_NAME]);
202 event_path[sizeof(event_path)-1]=0;
203 if (strErr > sizeof(event_path)) HANDLE_STRING_ERROR;
204
205 int event_fd;
206 event_fd = open(event_path, pkg_sys_flags[PKG_NAME]);
207 if (event_fd == -1) { break; }
208
209 int sz = pread(event_fd, read_buff, PAPI_MAX_STR_LEN, 0);
210 read_buff[sz] = '\0';
212
213 if (strncmp(read_buff, "package-", strlen("package-")) == 0 && strtol(read_buff + strlen("package-"), NULL, 10) == s) {
214 found = 1;
215 break;
216 }
217 }
218 if (!found) { continue; }
219
220 // compose string of a pkg directory path
221 strErr=snprintf(events_dir, sizeof(events_dir), "/sys/class/powercap/intel-rapl:%d/", s_dir);
222 events_dir[sizeof(events_dir)-1]=0;
223 if (strErr > sizeof(events_dir)) HANDLE_STRING_ERROR;
224
225 // open directory to make sure it exists
226 events = opendir(events_dir);
227
228 // not a valid pkg/component directory so continue
229 if (events == NULL) { continue; }
230 closedir(events); // opendir has mallocs; so clean up.
231
232 // loop through pkg events and create powercap event entries
233 for (e = 0; e < PKG_NUM_EVENTS; e++) {
234
235 // compose string to individual event
236 strErr=snprintf(event_path, sizeof(event_path), "%s%s", events_dir, pkg_sys_names[e]);
237 event_path[sizeof(event_path)-1]=0;
238 if (strErr > sizeof(event_path)) HANDLE_STRING_ERROR;
239 // not a valid pkg event path so continue
240
241 if (access(event_path, R_OK) == -1) { continue; }
242
243 strErr=snprintf(powercap_ntv_events[num_events].name, sizeof(powercap_ntv_events[num_events].name), "%s:ZONE%d", pkg_event_names[e], s);
246 //snprintf(powercap_ntv_events[num_events].description, sizeof(powercap_ntv_events[num_events].name), "%s:ZONE%d", pkg_event_names[e], s);
247 //snprintf(powercap_ntv_events[num_events].units, sizeof(powercap_ntv_events[num_events].name), "%s:ZONE%d", pkg_event_names[e], s);
250
252
253 event_fds[num_events] = open(event_path, O_SYNC|pkg_sys_flags[e]);
254
256 int sz = pread(event_fds[num_events], read_buff, PAPI_MAX_STR_LEN, 0);
257 read_buff[sz] = '\0';
258 strErr=snprintf(powercap_ntv_events[num_events].description, sizeof(powercap_ntv_events[num_events].description), "%s", read_buff);
260 if (strErr > sizeof(powercap_ntv_events[num_events].description)) HANDLE_STRING_ERROR;
261 }
262
264 int sz = pread(event_fds[num_events], read_buff, PAPI_MAX_STR_LEN, 0);
265 read_buff[sz] = '\0';
267 }
268
269 num_events++;
270 }
271
272 // reset component count for each socket
273 c = 0;
274 strErr=snprintf(events_dir, sizeof(events_dir), "/sys/class/powercap/intel-rapl:%d:%d/", s_dir, c);
275 events_dir[sizeof(events_dir)-1]=0;
276 if (strErr > sizeof(events_dir)) HANDLE_STRING_ERROR;
277 while((events = opendir(events_dir)) != NULL) {
278 closedir(events); // opendir has mallocs; so clean up.
279
280 // loop through pkg events and create powercap event entries
281 for (e = 0; e < COMPONENT_NUM_EVENTS; e++) {
282
283 // compose string to individual event
284 strErr=snprintf(event_path, sizeof(event_path), "%s%s", events_dir, component_sys_names[e]);
285 event_path[sizeof(event_path)-1]=0;
286 if (strErr > sizeof(event_path)) HANDLE_STRING_ERROR;
287
288 // not a valid pkg event path so continue
289 if (access(event_path, R_OK) == -1) { continue; }
290
291 strErr=snprintf(powercap_ntv_events[num_events].name, sizeof(powercap_ntv_events[num_events].name), "%s:ZONE%d_SUBZONE%d", component_event_names[e], s, c);
294 //snprintf(powercap_ntv_events[num_events].description, sizeof(powercap_ntv_events[num_events].name), "%s:ZONE%d_SUBZONE%d", component_event_names[e], s, c);
295 //snprintf(powercap_ntv_events[num_events].units, sizeof(powercap_ntv_events[num_events].name), "%s:ZONE%d_SUBZONE%d", component_event_names[e], s, c);
298
300
301 event_fds[num_events] = open(event_path, O_SYNC|component_sys_flags[e]);
302
304 int sz = pread(event_fds[num_events], read_buff, PAPI_MAX_STR_LEN, 0);
305 read_buff[sz] = '\0';
306 strErr=snprintf(powercap_ntv_events[num_events].description, sizeof(powercap_ntv_events[num_events].description), "%s", read_buff);
308 if (strErr > sizeof(powercap_ntv_events[num_events].description)) HANDLE_STRING_ERROR;
309 }
310
312 int sz = pread(event_fds[num_events], read_buff, PAPI_MAX_STR_LEN, 0);
313 read_buff[sz] = '\0';
315 }
316
317 num_events++;
318 }
319
320 // test for next component
321 c++;
322
323 // compose string of an pkg directory path
324 strErr=snprintf(events_dir, sizeof(events_dir), "/sys/class/powercap/intel-rapl:%d:%d/", s_dir, c);
325 events_dir[sizeof(events_dir)-1]=0;
326 if (strErr > sizeof(events_dir)) HANDLE_STRING_ERROR;
327 }
328 }
329
330 /* Export the total number of events available */
334
335 /* Export the component id */
337
338 fn_exit:
339 _papi_hwd[cidx]->cmp_info.disabled = retval;
340 return retval;
341 fn_fail:
342 goto fn_exit;
343}
344
345
346/*
347 * Control of counters (Reading/Writing/Starting/Stopping/Setup)
348 * functions
349 */
351{
353 memset( control, 0, sizeof ( _powercap_control_state_t ) );
354
355
356 /* if an event is a counter, set its corresponding flag to 1 */
357 int i;
358 for (i = 0; i < num_events; i++) {
360 control->need_difference[i] = 1;
361 }
362 }
363
364 return PAPI_OK;
365}
366
368{
369 _powercap_context_t* context = ( _powercap_context_t* ) ctx;
370 (void) ctl;
371
372 int b;
373 for( b = 0; b < num_events; b++ ) {
375 }
376
377 return PAPI_OK;
378}
379
381{
382 (void) ctx;
383 (void) ctl;
384 return PAPI_OK;
385}
386
387/* Shutdown a thread */
388static int
390{
391 ( void ) ctx;
392 SUBDBG( "Enter\n" );
393 return PAPI_OK;
394}
395
396
397static int
399 long long **events, int flags )
400{
401 SUBDBG("Enter _powercap_read\n");
402
403 (void) flags;
405 _powercap_context_t* context = ( _powercap_context_t* ) ctx;
406
407 long long start_val = 0;
408 long long curr_val = 0;
409 int c, i;
410
411 for( c = 0; c < control->active_counters; c++ ) {
412 i = map_index_to_counter(ctl, c);
413 start_val = context->start_value[i];
414 curr_val = read_powercap_value(i);
415
416 SUBDBG("%d, start value: %lld, current value %lld\n", i, start_val, curr_val);
417
418 if(start_val) {
419
420 /* Make sure an event is a counter. */
421 if (control->need_difference[i] == 1) {
422
423 /* Wraparound. */
424 if(start_val > curr_val) {
425 SUBDBG("Wraparound!\nstart value:\t%lld,\tcurrent value:%lld\n", start_val, curr_val);
427 curr_val += (max_pkg_energy_count - start_val);
428 } else if( powercap_ntv_events[i].type == COMPONENT_ENERGY ) {
429 curr_val += (max_component_energy_count - start_val);
430 } else {
431 curr_val += (0x100000000 - start_val);
432 }
433 }
434
435 /* Normal subtraction. */
436 else if (start_val < curr_val) {
437 SUBDBG("Normal subtraction!\nstart value:\t%lld,\tcurrent value:%lld\n", start_val, curr_val);
438 curr_val -= start_val;
439 }
440 SUBDBG("Final value: %lld\n", curr_val);
441
442 }
443 }
444 control->count[c]=curr_val;
445 }
446
447 *events = ( ( _powercap_control_state_t* ) ctl )->count;
448
449 return PAPI_OK;
450}
451
452static int _powercap_write( hwd_context_t * ctx, hwd_control_state_t * ctl, long long *values )
453{
454 /* write values */
455 ( void ) ctx;
457
458 int c, i;
459
460 for(c=0;c<control->active_counters;c++) {
461 i = map_index_to_counter(ctl, c);
464 }
465 }
466
467 return PAPI_OK;
468}
469/*
470 * Clean up what was setup in powercap_init_component().
471 */
473{
474 int i;
475
476 /* Read counters into expected slot */
477 for(i=0;i<num_events;i++) {
478 close(event_fds[i]);
479 }
480 return PAPI_OK;
481}
482
483/* This function sets various options in the component. The valid
484 * codes being passed in are PAPI_SET_DEFDOM, PAPI_SET_DOMAIN,
485 * PAPI_SETDEFGRN, PAPI_SET_GRANUL and PAPI_SET_INHERIT
486 */
487static int
489{
490 SUBDBG( "Enter: ctx: %p\n", ctx );
491 ( void ) ctx;
492 ( void ) code;
493 ( void ) option;
494
495 return PAPI_OK;
496}
497
498
501 hwd_context_t *ctx )
502{
503 (void) ctx;
504 int i, index;
505
507 control->active_counters = count;
508
509 if (count==0) return PAPI_OK;
510
511 for( i = 0; i < count; i++ ) {
512 index = native[i].ni_event;
513 control->which_counter[i]=index;
514 native[i].ni_position = i;
515 }
516
517 return PAPI_OK;
518
519}
520
521static int _powercap_set_domain( hwd_control_state_t *ctl, int domain )
522{
523 ( void ) ctl;
524 if ( PAPI_DOM_ALL != domain )
525 return PAPI_EINVAL;
526
527 return PAPI_OK;
528}
529
530
532{
533 ( void ) ctx;
534 ( void ) ctl;
535 return PAPI_OK;
536}
537
538/*
539 * Native Event functions
540 */
541static int _powercap_ntv_enum_events( unsigned int *EventCode, int modifier )
542{
543 int index;
544 switch ( modifier ) {
545
546 case PAPI_ENUM_FIRST:
547 *EventCode = 0;
548 return PAPI_OK;
549 case PAPI_ENUM_EVENTS:index = *EventCode;
550 if (index < num_events - 1) {
551 *EventCode = *EventCode + 1;
552 return PAPI_OK;
553 } else {
554 return PAPI_ENOEVNT;
555 }
556
557 default:return PAPI_EINVAL;
558 }
559}
560
561/*
562 *
563 */
564static int _powercap_ntv_code_to_name( unsigned int EventCode, char *name, int len )
565{
566 int index = EventCode & PAPI_NATIVE_AND_MASK;
567
568 if ( index >= 0 && index < num_events ) {
570 return PAPI_OK;
571 }
572 return PAPI_ENOEVNT;
573}
574
575/*
576 *
577 */
578static int _powercap_ntv_code_to_descr( unsigned int EventCode, char *name, int len )
579{
580 int index = EventCode;
581
582 if ( index < 0 && index >= num_events )
583 return PAPI_ENOEVNT;
584 _local_strlcpy( name, powercap_ntv_events[index].description, len );
585 return PAPI_OK;
586}
587
588static int _powercap_ntv_code_to_info( unsigned int EventCode, PAPI_event_info_t *info )
589{
590 int index = EventCode;
591
592 if ( index < 0 || index >= num_events )
593 return PAPI_ENOEVNT;
594
598
600 return PAPI_OK;
601}
602
603
605 .cmp_info = { /* (unspecified values are initialized to 0) */
606 .name = "powercap",
607 .short_name = "powercap",
608 .description = "Linux powercap energy measurements",
609 .version = "5.3.0",
610 .default_domain = PAPI_DOM_ALL,
611 .default_granularity = PAPI_GRN_SYS,
612 .available_granularities = PAPI_GRN_SYS,
613 .hardware_intr_sig = PAPI_INT_SIGNAL,
614 .available_domains = PAPI_DOM_ALL,
615 },
616
617 /* sizes of framework-opaque component-private structures */
618 .size = {
619 .context = sizeof ( _powercap_context_t ),
620 .control_state = sizeof ( _powercap_control_state_t ),
621 .reg_value = sizeof ( _powercap_register_t ),
622 .reg_alloc = sizeof ( _powercap_reg_alloc_t ),
623 },
624 /* function pointers in this component */
625 .init_thread = _powercap_init_thread,
626 .init_component = _powercap_init_component,
627 .init_control_state = _powercap_init_control_state,
628 .update_control_state = _powercap_update_control_state,
629 .start = _powercap_start,
630 .stop = _powercap_stop,
631 .read = _powercap_read,
632 .write = _powercap_write,
633 .shutdown_thread = _powercap_shutdown_thread,
634 .shutdown_component = _powercap_shutdown_component,
635 .ctl = _powercap_ctl,
636
637 .set_domain = _powercap_set_domain,
638 .reset = _powercap_reset,
639
640 .ntv_enum_events = _powercap_ntv_enum_events,
641 .ntv_code_to_name = _powercap_ntv_code_to_name,
642 .ntv_code_to_descr = _powercap_ntv_code_to_descr,
643 .ntv_code_to_info = _powercap_ntv_code_to_info,
644};
int i
int open(const char *pathname, int flags, mode_t mode)
Definition: appio.c:188
int close(int fd)
Definition: appio.c:179
static const PAPI_hw_info_t * hw_info
Definition: byte_profile.c:28
double s
Definition: byte_profile.c:36
static long count
struct papi_vectors * _papi_hwd[]
#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_VENDOR_INTEL
Definition: f90papi.h:275
#define PAPI_EINVAL
Definition: f90papi.h:115
#define PAPI_ENOSUPP
Definition: f90papi.h:244
#define PAPI_MAX_STR_LEN
Definition: f90papi.h:77
#define PAPI_DATATYPE_UINT64
Definition: f90papi.h:278
#define PAPI_GRN_SYS
Definition: f90papi.h:43
#define PAPI_DOM_ALL
Definition: f90papi.h:261
char events[MAX_EVENTS][BUFSIZ]
static long long values[NUM_EVENTS]
Definition: init_fini.c:10
static double b[MATRIX_SIZE][MATRIX_SIZE]
Definition: libmsr_basic.c:39
static double c[MATRIX_SIZE][MATRIX_SIZE]
Definition: libmsr_basic.c:40
static _powercap_native_event_entry_t powercap_ntv_events[(2 *(PKG_NUM_EVENTS+(3 *COMPONENT_NUM_EVENTS)))]
static char read_buff[PAPI_MAX_STR_LEN]
#define PKG_POWER_LIMIT_B
static int _powercap_ctl(hwd_context_t *ctx, int code, _papi_int_option_t *option)
static int _powercap_stop(hwd_context_t *ctx, hwd_control_state_t *ctl)
#define PKG_ENABLED
#define PKG_ENERGY
papi_vector_t _powercap_vector
static int _powercap_ntv_enum_events(unsigned int *EventCode, int modifier)
static char * component_event_names[COMPONENT_NUM_EVENTS]
static int num_events
#define POWERCAP_MAX_COUNTERS
#define PKG_NUM_EVENTS
#define COMPONENT_ENERGY
#define PKG_NAME
static int _powercap_shutdown_thread(hwd_context_t *ctx)
#define PKG_MAX_ENERGY_RANGE
static int _powercap_set_domain(hwd_control_state_t *ctl, int domain)
static long long max_component_energy_count
#define COMPONENT_POWER_LIMIT_A
static int _powercap_init_thread(hwd_context_t *ctx)
static char * _local_strlcpy(char *dst, const char *src, size_t size)
#define COMPONENT_ENABLED
static int component_events[COMPONENT_NUM_EVENTS]
#define PKG_MAX_POWER_B
static long long map_index_to_counter(hwd_control_state_t *ctl, int index)
static char * pkg_event_names[PKG_NUM_EVENTS]
static long long read_powercap_value(int index)
static int _powercap_update_control_state(hwd_control_state_t *ctl, NativeInfo_t *native, int count, hwd_context_t *ctx)
static int event_fds[POWERCAP_MAX_COUNTERS]
static char * pkg_sys_names[PKG_NUM_EVENTS]
static int _powercap_write(hwd_context_t *ctx, hwd_control_state_t *ctl, long long *values)
static mode_t pkg_sys_flags[PKG_NUM_EVENTS]
static int pkg_events[PKG_NUM_EVENTS]
static int write_powercap_value(int index, long long value)
static char write_buff[PAPI_MAX_STR_LEN]
static int _powercap_ntv_code_to_descr(unsigned int EventCode, char *name, int len)
#define COMPONENT_MAX_ENERGY_RANGE
#define COMPONENT_NAME
#define COMPONENT_NUM_EVENTS
#define PKG_TIME_WINDOW_A
static int _powercap_init_control_state(hwd_control_state_t *ctl)
static int _powercap_ntv_code_to_info(unsigned int EventCode, PAPI_event_info_t *info)
static char * component_sys_names[COMPONENT_NUM_EVENTS]
static int _powercap_shutdown_component(void)
#define PKG_TIME_WINDOW_B
static long long max_pkg_energy_count
#define PKG_POWER_LIMIT_A
static mode_t component_sys_flags[COMPONENT_NUM_EVENTS]
static int _powercap_start(hwd_context_t *ctx, hwd_control_state_t *ctl)
#define PKG_MAX_POWER_A
#define COMPONENT_TIME_WINDOW_A
static int _powercap_read(hwd_context_t *ctx, hwd_control_state_t *ctl, long long **events, int flags)
#define COMPONENT_MAX_POWER_A
static int _powercap_init_component(int cidx)
static int _powercap_ntv_code_to_name(unsigned int EventCode, char *name, int len)
static int _powercap_reset(hwd_context_t *ctx, hwd_control_state_t *ctl)
#define HANDLE_STRING_ERROR
static int event_fd
uint16_t type
#define PAPI_NATIVE_AND_MASK
Return codes and api definitions.
#define SUBDBG(format, args...)
Definition: papi_debug.h:64
#define PAPI_INT_SIGNAL
Definition: papi_internal.h:52
static int native
static int cidx
papi_mdi_t _papi_hwi_system_info
Definition: papi_internal.c:56
char units[MAX_EVENTS][BUFSIZ]
Definition: powercap_plot.c:15
const char * name
Definition: rocs.c:225
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
Hardware info structure.
Definition: papi.h:774
int sockets
Definition: papi.h:778
int vendor
Definition: papi.h:781
long long start_value[POWERCAP_MAX_COUNTERS]
_powercap_control_state_t state
long long need_difference[POWERCAP_MAX_COUNTERS]
long long count[POWERCAP_MAX_COUNTERS]
long long which_counter[POWERCAP_MAX_COUNTERS]
int component_id
int type
int return_type
int event_id
char name[PAPI_MAX_STR_LEN]
char description[PAPI_MAX_STR_LEN]
_powercap_register_t resources
char units[PAPI_MIN_STR_LEN]
int socket_id
_powercap_register_t ra_bits
unsigned int selector
PAPI_hw_info_t hw_info
PAPI_component_info_t cmp_info
Definition: papi_vector.h:20
int retval
Definition: zero_fork.c:53