PAPI 7.1.0.0
Loading...
Searching...
No Matches
linux-host_micpower.c
Go to the documentation of this file.
1
12/* From intel examples, see $(mic_dir)/sysmgt/sdk/Examples/Usage */
13#define MAX_DEVICES (32)
14#define EVENTS_PER_DEVICE 10
15#include <stdio.h>
16#include <stdlib.h>
17#include <unistd.h>
18#include <dlfcn.h>
19
20#include "MicAccessTypes.h"
21#include "MicBasicTypes.h"
22#include "MicAccessErrorTypes.h"
23#include "MicAccessApi.h"
24#include "MicPowerManagerAPI.h"
25
26#include "papi.h"
27#include "papi_internal.h"
28#include "papi_vector.h"
29#include "papi_memory.h"
30
31void (*_dl_non_dynamic_init)(void) __attribute__((weak));
32
33/* This is a guess, refine this later */
34#define UPDATEFREQ 500000
35
37
38typedef struct host_micpower_register {
40 unsigned int selector;
42
43typedef struct host_micpower_reg_alloc {
46
48typedef struct host_micpower_native_event_entry {
51 char description[PAPI_MAX_STR_LEN];
52 char units[3];
54
56typedef struct host_micpower_control_state {
59 long long counts[MAX_DEVICES*EVENTS_PER_DEVICE];
62
64typedef struct host_micpower_context {
67
68/* Global state info */
69static MicDeviceOnSystem adapters[MAX_DEVICES];
70static HANDLE handles[MAX_DEVICES];
71static long long lastupdate[MAX_DEVICES];
72static HANDLE accessHandle = NULL;
74
75static void* mic_access = NULL;
76static void* scif_access = NULL;
77
78#undef MICACCESS_API
79#define MICACCESS_API __attribute__((weak))
80const char *MicGetErrorString(U32);
82U32 MICACCESS_API MicInitAPI(HANDLE *, ETarget, MicDeviceOnSystem *, U32 *);
84U32 MICACCESS_API MicInitAdapter(HANDLE *, MicDeviceOnSystem *);
85U32 MICACCESS_API MicGetPowerUsage(HANDLE, MicPwrUsage *);
86
87const char *(*MicGetErrorStringPtr)(U32);
88U32 (*MicCloseAdapterPtr)(HANDLE);
89U32 (*MicInitAPIPtr)(HANDLE *, ETarget, MicDeviceOnSystem *, U32 *);
90U32 (*MicCloseAPIPtr)(HANDLE *);
91U32 (*MicInitAdapterPtr)(HANDLE *, MicDeviceOnSystem *);
92U32 (*MicGetPowerUsagePtr)(HANDLE, MicPwrUsage *);
94
95struct powers {
96 int total0;
97 int total1;
98 int inst;
99 int imax;
100 int pcie;
101 int c2x3;
102 int c2x4;
103 int vccp;
104 int vddg;
105 int vddq;
106};
107
108typedef union {
109 struct powers power;
111} power_t;
112
114
115static int
117{
118 /* Attempt to guess if we were statically linked to libc, if so bail */
119 if ( _dl_non_dynamic_init != NULL ) {
120 strncpy(_host_micpower_vector.cmp_info.disabled_reason, "The host_micpower component does not support statically linking of libc.", PAPI_MAX_STR_LEN);
121 return PAPI_ENOSUPP;
122 }
123
124 /* Need to link in the cuda libraries, if not found disable the component */
125 scif_access = dlopen("libscif.so", RTLD_NOW | RTLD_GLOBAL);
126 if (NULL == scif_access)
127 {
128 snprintf(_host_micpower_vector.cmp_info.disabled_reason, PAPI_MAX_STR_LEN, "Problem loading the SCIF library: %s\n", dlerror());
130 return ( PAPI_ENOSUPP );
131 }
132
133 mic_access = dlopen("libMicAccessSDK.so", RTLD_NOW | RTLD_GLOBAL);
134 if (NULL == mic_access)
135 {
136 snprintf(_host_micpower_vector.cmp_info.disabled_reason, PAPI_MAX_STR_LEN, "Problem loading libMicAccessSDK.so: %s\n", dlerror());
138 return ( PAPI_ENOSUPP );
139 }
140
141 MicGetErrorStringPtr = dlsym(mic_access, "MicGetErrorString");
142 if (dlerror() != NULL)
143 {
144 strncpy(_host_micpower_vector.cmp_info.disabled_reason, "MicAccessSDK function MicGetErrorString not found.",PAPI_MAX_STR_LEN);
146 return ( PAPI_ENOSUPP );
147 }
148 MicCloseAdapterPtr = dlsym(mic_access, "MicCloseAdapter");
149 if (dlerror() != NULL)
150 {
151 strncpy(_host_micpower_vector.cmp_info.disabled_reason, "MicAccessSDK function MicCloseAdapter not found.",PAPI_MAX_STR_LEN);
153 return ( PAPI_ENOSUPP );
154 }
155 MicInitAPIPtr = dlsym(mic_access, "MicInitAPI");
156 if (dlerror() != NULL)
157 {
158 strncpy(_host_micpower_vector.cmp_info.disabled_reason, "MicAccessSDK function MicInitAPI not found.",PAPI_MAX_STR_LEN);
160 return ( PAPI_ENOSUPP );
161 }
162 MicCloseAPIPtr = dlsym(mic_access, "MicCloseAPI");
163 if (dlerror() != NULL)
164 {
165 strncpy(_host_micpower_vector.cmp_info.disabled_reason, "MicAccessSDK function MicCloseAPI not found.",PAPI_MAX_STR_LEN);
167 return ( PAPI_ENOSUPP );
168 }
169 MicInitAdapterPtr = dlsym(mic_access, "MicInitAdapter");
170 if (dlerror() != NULL)
171 {
172 strncpy(_host_micpower_vector.cmp_info.disabled_reason, "MicAccessSDK function MicInitAdapter not found.",PAPI_MAX_STR_LEN);
174 return ( PAPI_ENOSUPP );
175 }
176
177 MicGetPowerUsagePtr = dlsym(mic_access, "MicGetPowerUsage");
178 if (dlerror() != NULL)
179 {
180 strncpy(_host_micpower_vector.cmp_info.disabled_reason, "MicAccessSDK function MicGetPowerUsage not found.",PAPI_MAX_STR_LEN);
182 return ( PAPI_ENOSUPP );
183 }
184
185 return 0;
186}
187
188
189/* ###############################################
190 * Component Interface code
191 * ############################################### */
192
193
194int
196{
197 int retval = PAPI_OK;
198 U32 ret = MIC_ACCESS_API_ERROR_UNKNOWN;
199 U32 adapterNum = 0;
200 U32 throwaway = 1;
201
203
204 if ( loadFunctionPtrs() ) {
206 goto fn_fail;
207 }
208
209 memset( lastupdate, 0x0, sizeof(lastupdate));
210 memset( cached_values, 0x0, sizeof(struct powers)*MAX_DEVICES );
211 ret = MicInitAPIPtr( &accessHandle, eTARGET_SCIF_DRIVER, adapters, &nAdapters );
212 if ( MIC_ACCESS_API_SUCCESS != ret ) {
216 goto fn_fail;
217 }
218 /* Sanity check on array size */
219 if ( nAdapters >= MAX_DEVICES ) {
220 snprintf(_host_micpower_vector.cmp_info.disabled_reason, PAPI_MAX_STR_LEN, "Too many MIC cards [%d] found, bailing.", nAdapters);
223 goto fn_fail;
224 }
225
226/* XXX: This code initializes a token for each adapter, in testing this appeared to be required/
227 * One has to call MicInitAdapter() before calling into that adapter's entries */
228 for (adapterNum=0; adapterNum < nAdapters; adapterNum++) {
229 ret = MicInitAPIPtr( &handles[adapterNum], eTARGET_SCIF_DRIVER, adapters, &throwaway );
230 throwaway = 1;
231 if (MIC_ACCESS_API_SUCCESS != ret) {
232 fprintf(stderr, "%d:MicInitAPI carps: %s\n", __LINE__, MicGetErrorStringPtr(ret));
233 nAdapters = adapterNum;
234 for (adapterNum=0; adapterNum < nAdapters; adapterNum++)
235 MicCloseAdapterPtr( handles[adapterNum] );
238 "Failed to initialize card %d's interface.", nAdapters);
240 goto fn_fail;
241 }
242 ret = MicInitAdapterPtr(&handles[adapterNum], &adapters[adapterNum]);
243 if (MIC_ACCESS_API_SUCCESS != ret) {
244 fprintf(stderr, "%d:MicInitAdapter carps: %s\n", __LINE__, MicGetErrorStringPtr(ret));
245 nAdapters = adapterNum;
246 for (adapterNum=0; adapterNum < nAdapters; adapterNum++)
247 MicCloseAdapterPtr( handles[adapterNum] );
250 "Failed to initialize card %d's interface.", nAdapters);
252 goto fn_fail;
253 }
254 }
255
257 if ( NULL == native_events_table ) {
259 goto fn_fail;
260 }
261 for (adapterNum=0; adapterNum < nAdapters; adapterNum++) {
262 snprintf(native_events_table[adapterNum*EVENTS_PER_DEVICE].name, PAPI_MAX_STR_LEN, "mic%d:tot0", adapterNum);
263 snprintf(native_events_table[adapterNum*EVENTS_PER_DEVICE].description, PAPI_MAX_STR_LEN, "Total power utilization, Averaged over Time Window 0 (uWatts)");
264 native_events_table[adapterNum*EVENTS_PER_DEVICE].resources.selector = adapterNum*EVENTS_PER_DEVICE + 1;
265 snprintf(native_events_table[adapterNum*EVENTS_PER_DEVICE].units, PAPI_MIN_STR_LEN, "uW");
266
267 snprintf(native_events_table[adapterNum*EVENTS_PER_DEVICE + 1].name, PAPI_MAX_STR_LEN, "mic%d:tot1", adapterNum);
268 snprintf(native_events_table[adapterNum*EVENTS_PER_DEVICE + 1].description, PAPI_MAX_STR_LEN, "Total power utilization, Averaged over Time Window 1 (uWatts)");
269 native_events_table[adapterNum*EVENTS_PER_DEVICE + 1].resources.selector = adapterNum*EVENTS_PER_DEVICE + 2;
270 snprintf(native_events_table[adapterNum*EVENTS_PER_DEVICE + 1].units, PAPI_MIN_STR_LEN, "uW");
271
272 snprintf(native_events_table[adapterNum*EVENTS_PER_DEVICE + 2].name, PAPI_MAX_STR_LEN, "mic%d:pcie", adapterNum);
273 snprintf(native_events_table[adapterNum*EVENTS_PER_DEVICE + 2].description, PAPI_MAX_STR_LEN, "PCI-E connector power (uWatts)");
274 native_events_table[adapterNum*EVENTS_PER_DEVICE + 2].resources.selector = adapterNum*EVENTS_PER_DEVICE + 3;
275 snprintf(native_events_table[adapterNum*EVENTS_PER_DEVICE + 2].units, PAPI_MIN_STR_LEN, "uW");
276
277 snprintf(native_events_table[adapterNum*EVENTS_PER_DEVICE + 3].name, PAPI_MAX_STR_LEN, "mic%d:inst", adapterNum);
278 snprintf(native_events_table[adapterNum*EVENTS_PER_DEVICE + 3].description, PAPI_MAX_STR_LEN, "Instantaneous power (uWatts)");
279 native_events_table[adapterNum*EVENTS_PER_DEVICE + 3].resources.selector = adapterNum*EVENTS_PER_DEVICE + 4;
280 snprintf(native_events_table[adapterNum*EVENTS_PER_DEVICE + 3].units, PAPI_MIN_STR_LEN, "uW");
281
282 snprintf(native_events_table[adapterNum*EVENTS_PER_DEVICE + 4].name, PAPI_MAX_STR_LEN, "mic%d:imax", adapterNum);
283 snprintf(native_events_table[adapterNum*EVENTS_PER_DEVICE + 4].description, PAPI_MAX_STR_LEN, "Max instantaneous power (uWatts)");
284 native_events_table[adapterNum*EVENTS_PER_DEVICE + 4].resources.selector = adapterNum*EVENTS_PER_DEVICE + 5;
285 snprintf(native_events_table[adapterNum*EVENTS_PER_DEVICE + 4].units, PAPI_MIN_STR_LEN, "uW");
286
287 snprintf(native_events_table[adapterNum*EVENTS_PER_DEVICE + 5].name, PAPI_MAX_STR_LEN, "mic%d:c2x3", adapterNum);
288 snprintf(native_events_table[adapterNum*EVENTS_PER_DEVICE + 5].description, PAPI_MAX_STR_LEN, "2x3 connector power (uWatts)");
289 native_events_table[adapterNum*EVENTS_PER_DEVICE + 5].resources.selector = adapterNum*EVENTS_PER_DEVICE + 6;
290 snprintf(native_events_table[adapterNum*EVENTS_PER_DEVICE + 5].units, PAPI_MIN_STR_LEN, "uW");
291
292 snprintf(native_events_table[adapterNum*EVENTS_PER_DEVICE + 6].name, PAPI_MAX_STR_LEN, "mic%d:c2x4", adapterNum);
293 snprintf(native_events_table[adapterNum*EVENTS_PER_DEVICE + 6].description, PAPI_MAX_STR_LEN, "2x4 connector power (uWatts)");
294 native_events_table[adapterNum*EVENTS_PER_DEVICE + 6].resources.selector = adapterNum*EVENTS_PER_DEVICE + 7;
295 snprintf(native_events_table[adapterNum*EVENTS_PER_DEVICE + 6].units, PAPI_MIN_STR_LEN, "uW");
296
297 snprintf(native_events_table[adapterNum*EVENTS_PER_DEVICE + 7].name, PAPI_MAX_STR_LEN, "mic%d:vccp", adapterNum);
298 snprintf(native_events_table[adapterNum*EVENTS_PER_DEVICE + 7].description, PAPI_MAX_STR_LEN, "Core rail (uVolts)");
299 native_events_table[adapterNum*EVENTS_PER_DEVICE + 7].resources.selector = adapterNum*EVENTS_PER_DEVICE + 8;
300 snprintf(native_events_table[adapterNum*EVENTS_PER_DEVICE + 7].units, PAPI_MIN_STR_LEN, "uV");
301
302 snprintf(native_events_table[adapterNum*EVENTS_PER_DEVICE + 8].name, PAPI_MAX_STR_LEN, "mic%d:vddg", adapterNum);
303 snprintf(native_events_table[adapterNum*EVENTS_PER_DEVICE + 8].description, PAPI_MAX_STR_LEN, "Uncore rail (uVolts)");
304 native_events_table[adapterNum*EVENTS_PER_DEVICE + 8].resources.selector = adapterNum*EVENTS_PER_DEVICE + 9;
305 snprintf(native_events_table[adapterNum*EVENTS_PER_DEVICE + 8].units, PAPI_MIN_STR_LEN, "uV");
306
307 snprintf(native_events_table[adapterNum*EVENTS_PER_DEVICE + 9].name, PAPI_MAX_STR_LEN, "mic%d:vddq", adapterNum);
308 snprintf(native_events_table[adapterNum*EVENTS_PER_DEVICE + 9].description, PAPI_MAX_STR_LEN, "Memory subsystem rail (uVolts)");
309 native_events_table[adapterNum*EVENTS_PER_DEVICE + 9].resources.selector = adapterNum*EVENTS_PER_DEVICE + 10;
310 snprintf(native_events_table[adapterNum*EVENTS_PER_DEVICE + 9].units, PAPI_MIN_STR_LEN, "uV");
311 }
312
313 fn_exit:
317
318 _papi_hwd[cidx]->cmp_info.disabled = retval;
319 return retval;
320
321 fn_fail:
322 nAdapters = 0;
323 goto fn_exit;
324}
325
327 (void)ctx;
328 return PAPI_OK;
329}
330
331int
333 U32 i = 0;
334 for( i=0; i<nAdapters; i++) {
336 }
337
339 return PAPI_OK;
340}
341
342int
344 (void) ctx;
345 return PAPI_OK;
346}
347
350 memset( state, 0, sizeof(host_micpower_control_state_t));
351
352 return PAPI_OK;
353}
354
356 NativeInfo_t *info,
357 int count,
358 hwd_context_t* ctx ) {
359
360 (void) ctx;
361 int i, index;
362
364
365 for (i=0; i<MAX_DEVICES*EVENTS_PER_DEVICE; i++)
366 state->resident[i] = 0;
367
368 for (i=0; i < count; i++) {
369 index = info[i].ni_event&PAPI_NATIVE_AND_MASK;
370 info[i].ni_position=native_events_table[index].resources.selector-1;
371 state->resident[index] = 1;
372 }
373 state->num_events = count;
374
375 return PAPI_OK;
376}
377
378int
380{
381 (void) ctx;
382 (void) ctl;
383 return PAPI_OK;
384}
385
386static int
387read_power( struct powers *pwr, int which_one )
388{
389 MicPwrUsage power;
390 U32 ret = MIC_ACCESS_API_ERROR_UNKNOWN;
391
392 if ( which_one < 0 || which_one > (int)nAdapters )
393 return PAPI_ENOEVNT;
394
395
396 ret = MicGetPowerUsagePtr(handles[which_one], &power);
397 if (MIC_ACCESS_API_SUCCESS != ret) {
398 fprintf(stderr,"Oops MicGetPowerUsage failed: %s\n",
400 return PAPI_ECMP;
401 }
402
403 pwr->total0 = power.total0.prr;
404 pwr->total1 = power.total1.prr;
405 pwr->inst = power.inst.prr;
406 pwr->imax = power.imax.prr;
407 pwr->pcie = power.pcie.prr;
408 pwr->c2x3 = power.c2x3.prr;
409 pwr->c2x4 = power.c2x4.prr;
410 pwr->vccp = power.vccp.pwr;
411 pwr->vddg = power.vddg.pwr;
412 pwr->vddq = power.vddq.pwr;
413
414 return PAPI_OK;
415}
416
417int
419 long long **events, int flags)
420{
421 (void)flags;
422 (void)events;
423 (void)ctx;
424 unsigned int i,j;
425 int needs_update = 0;
427 long long now = PAPI_get_real_usec();
428
429 for( i=0; i<nAdapters; i++) {
430 needs_update = 0;
431 for (j=0; j<EVENTS_PER_DEVICE; j++) {
432 if ( control->resident[EVENTS_PER_DEVICE*i+j]) {
433 needs_update = 1;
434 break;
435 }
436 }
437
438 if ( needs_update ) {
439 /* Do the global update */
440 if ( now >= lastupdate[i] + UPDATEFREQ) {
441 read_power( &cached_values[i].power, i );
442 lastupdate[i] = now;
443 }
444 /* update from cached values */
445 if ( control->lastupdate[i] < lastupdate[i]) {
446 control->lastupdate[i] = lastupdate[i];
447 }
448 for (j=0; j<EVENTS_PER_DEVICE; j++) {
449 if ( control->resident[EVENTS_PER_DEVICE*i+j] ) {
450 control->counts[EVENTS_PER_DEVICE*i+j] = (long long)cached_values[i].array[j];
451 }
452 }
453 }
454 }
455
456 *events = control->counts;
457 return PAPI_OK;
458}
459
460int
462{
463 (void)ctx;
464 int needs_update = 0;
465 unsigned int i,j;
467 long long now = PAPI_get_real_usec();
468
469 for( i=0; i<nAdapters; i++) {
470 needs_update = 0;
471 for (j=0; j<EVENTS_PER_DEVICE; j++) {
472 if ( control->resident[EVENTS_PER_DEVICE*i+j]) {
473 needs_update = 1;
474 break;
475 }
476 }
477
478 if ( needs_update ) {
479 /* Do the global update */
480 if ( now >= lastupdate[i] + UPDATEFREQ) {
481 read_power( &cached_values[i].power, i );
482 lastupdate[i] = now;
483 }
484 /* update from cached values */
485 if ( control->lastupdate[i] < lastupdate[i]) {
486 control->lastupdate[i] = lastupdate[i];
487 }
488 for (j=0; j<EVENTS_PER_DEVICE; j++) {
489 if ( control->resident[EVENTS_PER_DEVICE*i+j] ) {
490 control->counts[EVENTS_PER_DEVICE*i+j] = (long long)cached_values[i].array[j];
491 }
492 }
493 }
494 }
495 return PAPI_OK;
496
497}
498
499int _host_micpower_ntv_enum_events( unsigned int *EventCode, int modifier )
500{
501 int index;
502 switch (modifier) {
503 case PAPI_ENUM_FIRST:
505 return PAPI_ENOEVNT;
506 *EventCode = 0;
507 return PAPI_OK;
508 case PAPI_ENUM_EVENTS:
509 index = *EventCode;
510 if ( index < _host_micpower_vector.cmp_info.num_cntrs - 1) {
511 *EventCode = *EventCode + 1;
512 return PAPI_OK;
513 } else {
514 return PAPI_ENOEVNT;
515 }
516 break;
517 default:
518 return PAPI_EINVAL;
519 }
520 return PAPI_EINVAL;
521}
522
523int
524_host_micpower_ntv_code_to_name( unsigned int EventCode, char *name, int len )
525{
526 unsigned int code = EventCode & PAPI_NATIVE_AND_MASK;
528 strncpy( name, native_events_table[code].name, len);
529 return PAPI_OK;
530 }
531
532 return PAPI_ENOEVNT;
533}
534
535int
536_host_micpower_ntv_code_to_descr( unsigned int EventCode, char *name, int len )
537{
538 unsigned int code = EventCode & PAPI_NATIVE_AND_MASK;
540 strncpy( name, native_events_table[code].description, len );
541 return PAPI_OK;
542 }
543
544 return PAPI_ENOEVNT;
545}
546
547int
549{
550 unsigned int code = EventCode & PAPI_NATIVE_AND_MASK;
552 return PAPI_ENOEVNT;
553 strncpy( info->symbol, native_events_table[code].name, sizeof(info->symbol) );
554 strncpy( info->long_descr, native_events_table[code].description, sizeof(info->long_descr) );
555 strncpy( info->units, native_events_table[code].units, sizeof(info->units) );
556 return PAPI_OK;
557}
558
559int
561{
562 (void)ctx;
563 (void)code;
564 (void)option;
565 return PAPI_OK;
566}
567
568int
570{
571 (void)ctl;
572 if ( PAPI_DOM_ALL != domain )
573 return PAPI_EINVAL;
574 return PAPI_OK;
575}
576
578 .cmp_info = {
579 .name = "host_micpower",
580 .short_name = "host_micpower",
581 .description = "A host-side component to read power usage on MIC guest cards.",
582 .version = "0.1",
583 .support_version = "n/a",
584 .kernel_version = "n/a",
585 .num_cntrs = 0,
586 .num_mpx_cntrs = 0,
587 .default_domain = PAPI_DOM_ALL,
588 .available_domains = PAPI_DOM_ALL,
589 .default_granularity = PAPI_GRN_SYS,
590 .available_granularities = PAPI_GRN_SYS,
591 .hardware_intr_sig = PAPI_INT_SIGNAL,
592 },
593
594 .size = {
595 .context = sizeof(host_micpower_context_t),
596 .control_state = sizeof(host_micpower_control_state_t),
597 .reg_value = sizeof(host_micpower_register_t),
598 .reg_alloc = sizeof(host_micpower_reg_alloc_t),
599 },
600
601 .start = _host_micpower_start,
602 .stop = _host_micpower_start,
603 .read = _host_micpower_read,
604 .reset = NULL,
605 .write = NULL,
606 .init_component = _host_micpower_init_component,
607 .init_thread = _host_micpower_init_thread,
608 .init_control_state = _host_micpower_init_control_state,
609 .update_control_state = _host_micpower_update_control_state,
610 .ctl = _host_micpower_ctl,
611 .shutdown_thread = _host_micpower_shutdown_thread,
612 .shutdown_component = _host_micpower_shutdown_component,
613 .set_domain = _host_micpower_set_domain,
614
615 .ntv_enum_events = _host_micpower_ntv_enum_events,
616 .ntv_code_to_name = _host_micpower_ntv_code_to_name,
617 .ntv_code_to_descr = _host_micpower_ntv_code_to_descr,
618 .ntv_code_to_info = _host_micpower_ntv_code_to_info,
619
620};
int i
static long count
get real time counter value in microseconds
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_EINVAL
Definition: f90papi.h:115
#define PAPI_ENOSUPP
Definition: f90papi.h:244
#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
char events[MAX_EVENTS][BUFSIZ]
U32(* MicInitAdapterPtr)(HANDLE *, MicDeviceOnSystem *)
U32 MICACCESS_API MicGetPowerUsage(HANDLE, MicPwrUsage *)
static MicDeviceOnSystem adapters[MAX_DEVICES]
int _host_micpower_read(hwd_context_t *ctx, hwd_control_state_t *ctl, long long **events, int flags)
static host_micpower_native_event_entry_t * native_events_table
int _host_micpower_update_control_state(hwd_control_state_t *ctl, NativeInfo_t *info, int count, hwd_context_t *ctx)
const char *(* MicGetErrorStringPtr)(U32)
U32(* MicCloseAPIPtr)(HANDLE *)
static long long lastupdate[MAX_DEVICES]
int _host_micpower_ntv_code_to_descr(unsigned int EventCode, char *name, int len)
papi_vector_t _host_micpower_vector
static int loadFunctionPtrs()
int _host_micpower_init_thread(hwd_context_t *ctx)
int _host_micpower_start(hwd_context_t *ctx, hwd_control_state_t *ctl)
#define EVENTS_PER_DEVICE
host_micpower_register_t
#define MAX_DEVICES
This component wraps the MicAccessAPI to provide hostside power information for attached Intel Xeon P...
int _host_micpower_set_domain(hwd_control_state_t *ctl, int domain)
int _host_micpower_ntv_enum_events(unsigned int *EventCode, int modifier)
static HANDLE accessHandle
static power_t cached_values[MAX_DEVICES]
const char * MicGetErrorString(U32)
U32 MICACCESS_API MicCloseAdapter(HANDLE)
int _host_micpower_init_control_state(hwd_control_state_t *ctl)
int _host_micpower_ntv_code_to_name(unsigned int EventCode, char *name, int len)
int _host_micpower_shutdown_thread(hwd_context_t *ctx)
static HANDLE handles[MAX_DEVICES]
static int read_power(struct powers *pwr, int which_one)
int _host_micpower_ctl(hwd_context_t *ctx, int code, _papi_int_option_t *option)
static void * scif_access
U32(* MicGetPowerUsagePtr)(HANDLE, MicPwrUsage *)
U32 MICACCESS_API MicInitAPI(HANDLE *, ETarget, MicDeviceOnSystem *, U32 *)
int _host_micpower_init_component(int cidx)
#define MICACCESS_API
U32 MICACCESS_API MicInitAdapter(HANDLE *, MicDeviceOnSystem *)
#define UPDATEFREQ
void(* _dl_non_dynamic_init)(void)
U32(* MicCloseAdapterPtr)(HANDLE)
U32(* MicInitAPIPtr)(HANDLE *, ETarget, MicDeviceOnSystem *, U32 *)
static U32 nAdapters
U32 MICACCESS_API MicCloseAPI(HANDLE *)
int _host_micpower_shutdown_component(void)
static void * mic_access
int _host_micpower_ntv_code_to_info(unsigned int EventCode, PAPI_event_info_t *info)
int _host_micpower_stop(hwd_context_t *ctx, hwd_control_state_t *ctl)
unsigned long AO_t __attribute__((__aligned__(4)))
Definition: m68k.h:21
#define PAPI_NATIVE_AND_MASK
Return codes and api definitions.
FILE * stderr
bool state
Definition: papi_hl.c:155
#define PAPI_INT_SIGNAL
Definition: papi_internal.h:52
static double array[ARRAYSIZE]
Definition: papi_l1_dca.c:23
#define papi_free(a)
Definition: papi_memory.h:35
#define papi_malloc(a)
Definition: papi_memory.h:34
static int cidx
char units[MAX_EVENTS][BUFSIZ]
Definition: powercap_plot.c:15
const char * name
Definition: rocs.c:225
long long int long long
Definition: sde_internal.h:85
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
host_micpower_control_state_t state
long long lastupdate[MAX_DEVICES]
long long counts[MAX_DEVICES *EVENTS_PER_DEVICE]
int resident[MAX_DEVICES *EVENTS_PER_DEVICE]
char units[3]
char description[PAPI_MAX_STR_LEN]
host_micpower_register_t resources
char name[PAPI_MAX_STR_LEN]
host_micpower_register_t ra_bits
PAPI_component_info_t cmp_info
Definition: papi_vector.h:20
int retval
Definition: zero_fork.c:53