16#define MAX_powercap_EVENTS 64
19main(
int argc,
char **argv )
23 int retval,cid,powercap_cid=-1,numcmp;
32 int r,
i,
quiet = 1, passed = 0;
37 if (2 == argc)
quiet = atoi(argv[1]);
42 fprintf(
stderr,
"PAPI_library_init failed\n" );
44 if (!
quiet) fprintf(
stdout,
"Trying all powercap_ppc events\n" );
48 for( cid=0; cid<numcmp; cid++ ) {
51 fprintf(
stderr,
"PAPI_get_component_info failed\n");
53 if ( strstr( cmpinfo->
name,
"powercap_ppc" ) ) {
55 if ( !
quiet ) fprintf(
stdout,
"Found powercap_ppc component at cid %d\n",powercap_cid );
58 fprintf(
stderr,
"powercap_ppc component disabled: %s\n",
61 fprintf(
stderr,
"powercap_ppc component disabled\n");
69 fprintf(
stderr,
"No powercap_ppc component found\n" );
73 fprintf(
stderr,
"No counters in the powercap_ppc component\n" );
78 fprintf(
stderr,
"PAPI_create_eventset()\n");
86 fprintf(
stdout,
"Error from PAPI_event_code_to_name\n");
90 fprintf(
stderr,
"Error getting event info\n");
109 if (!
values) { fprintf(
stderr,
"No enough memory for allocation of values array.\n");
return -1; }
114 fprintf(
stdout,
"%-45s%-20s > %lldW\n",
125 fprintf(
stdout,
"TEST PASSED\n");
127 fprintf(
stdout,
"TESTS FAILED\n");
132 fprintf(
stderr,
"PAPI_cleanup_eventset()\n");
136 fprintf(
stderr,
"PAPI_destroy_eventset()\n");
static const char * event_names[2]
add PAPI preset or native hardware event to an event set
Empty and destroy an EventSet.
Create a new empty PAPI EventSet.
Empty and destroy an EventSet.
Enumerate PAPI preset or native events for a given component.
Convert a numeric hardware event code to a name.
get information about a specific software component
Get the event's name and description info.
initialize the PAPI library.
Get the number of components available on the system.
Read hardware counters from an event set.
Start counting hardware events in an event set.
Stop counting hardware events in an event set.
#define PAPI_DATATYPE_INT64
#define PAPI_HUGE_STR_LEN
static long long values[NUM_EVENTS]
Return codes and api definitions.
int data_type[MAX_EVENTS]
char units[MAX_EVENTS][BUFSIZ]
#define MAX_powercap_EVENTS
Tests basic functionality of powercap component.
char name[PAPI_MAX_STR_LEN]
char disabled_reason[PAPI_HUGE_STR_LEN]
char units[PAPI_MIN_STR_LEN]
char long_descr[PAPI_HUGE_STR_LEN]