16#define MAX_powercap_EVENTS 64
18int main (
int argc,
char **argv )
22 int retval,cid,powercap_cid=-1,numcmp;
38 if ( !
TESTS_QUIET ) printf(
"Trying all powercap events\n" );
42 for( cid=0; cid<numcmp; cid++ ) {
45 test_fail( __FILE__, __LINE__,
"PAPI_get_component_info()\n", 0 );
47 if ( strstr( cmpinfo->
name,
"powercap" ) ) {
49 if ( !
TESTS_QUIET ) printf(
"Found powercap component at cid %d\n",powercap_cid );
52 printf(
"powercap component disabled: %s\n",
55 test_skip( __FILE__,__LINE__,
"powercap component disabled",0 );
63 test_skip( __FILE__,__LINE__,
"No powercap component found\n",0 );
67 test_skip( __FILE__,__LINE__,
"No counters in the powercap component\n",0 );
110 printf(
"\nCURRENT LIMITS\n");
111 for(
i=0;
i<num_limits;
i++ ) {
112 printf(
"EVENT: %s\tLIMIT: %0.2lf Watts\n",
event_names[limit_map[
i]], ((
double)
values[limit_map[
i]]*1e-6));
117 printf(
"\nSETTING LIMITS 10 WATTS BELOW CURRENT LIMITS\n");
124 printf(
"\nREADING LIMITS TO MAKE SURE THEY ARE SET\n");
130 printf(
"\nNEW LIMITS\n");
131 for(
i=0;
i<num_limits;
i++ ) {
132 printf(
"EVENT: %s\tLIMIT: %0.2lf Watts\n",
event_names[limit_map[
i]], ((
double)
values[limit_map[
i]]*1e-6));
136 printf(
"\nRESET LIMITS BEFORE EXITING...");
142 printf(
"\nREADING RESET LIMITS TO MAKE SURE THEY ARE SET\n");
148 printf(
"\nRESET LIMITS\n");
149 for(
i=0;
i<num_limits;
i++ ) {
150 printf(
"EVENT: %s\tLIMIT: %0.2lf Watts\n",
event_names[limit_map[
i]], ((
double)
values[limit_map[
i]]*1e-6));
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
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.
Write counter values into counters.
static long long values[NUM_EVENTS]
Return codes and api definitions.
void PAPI_NORETURN test_fail(const char *file, int line, const char *call, int retval)
void PAPI_NORETURN test_pass(const char *filename)
void PAPI_NORETURN test_skip(const char *file, int line, const char *call, int retval)
char name[PAPI_MAX_STR_LEN]
char disabled_reason[PAPI_HUGE_STR_LEN]
#define MAX_powercap_EVENTS
Tests basic functionality of powercap component.