16#define MAX_powercap_EVENTS 64
23 printf(
"Sleeping 1 second...\n" );
30#define MATRIX_SIZE 1024
45 a[
i][j]=( double )
i*(
double )j;
46 b[
i][j]=( double )
i/(
double )( j+5 );
67 if ( !
quiet ) printf(
"Matrix multiply sum: s=%lf\n",
s );
72int main (
int argc,
char **argv )
76 int retval,cid,powercap_cid=-1,numcmp;
99 if ( strstr( argv[1],
"-w" ) ) {
110 if ( !
TESTS_QUIET ) printf(
"Trying all powercap events\n" );
114 for( cid=0; cid<numcmp; cid++ ) {
117 test_fail( __FILE__, __LINE__,
"PAPI_get_component_info failed\n", 0 );
119 if ( strstr( cmpinfo->
name,
"powercap" ) ) {
121 if ( !
TESTS_QUIET ) printf(
"Found powercap component at cid %d\n",powercap_cid );
124 printf(
"powercap component disabled: %s\n",
127 test_skip( __FILE__,__LINE__,
"powercap component disabled",0 );
135 test_skip( __FILE__,__LINE__,
"No powercap component found\n",0 );
139 test_skip( __FILE__,__LINE__,
"No counters in the powercap component\n",0 );
152 test_fail( __FILE__, __LINE__,
"Error from PAPI_event_code_to_name",
retval );
176 if ( !
TESTS_QUIET ) printf(
"\nStarting measurements...\n\n" );
196 printf(
"\nStopping measurements, took %.3fs, gathering results...\n\n", elapsed_time );
199 printf(
"scaled energy measurements:\n" );
203 printf(
"%-45s%-20s%4.6f J (Average Power %.1fW)\n",
206 ( (
double )
values[
i]/1.0e6 )/elapsed_time );
212 printf(
"energy counts:\n" );
224 printf(
"long term time window values:\n" );
228 printf(
"%-45s%-20s%4f (secs)\n",
236 printf(
"short term time window values:\n" );
240 printf(
"%-45s%-20s%4f (secs)\n",
248 printf(
"long term power limit:\n" );
252 printf(
"%-45s%-20s%4f (watts)\n",
260 printf(
"short term power limit:\n" );
264 printf(
"%-45s%-20s%4f (watts)\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.
Get real time counter value in nanoseconds.
initialize the PAPI library.
Get the number of components available on the system.
Start counting hardware events in an event set.
Stop counting hardware events in an event set.
#define PAPI_DATATYPE_UINT64
#define PAPI_HUGE_STR_LEN
static long long values[NUM_EVENTS]
Return codes and api definitions.
int tests_quiet(int argc, char **argv)
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)
int data_type[MAX_EVENTS]
char units[MAX_EVENTS][BUFSIZ]
static long long after_time
static long long before_time
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]
static double a[MATRIX_SIZE][MATRIX_SIZE]
static double b[MATRIX_SIZE][MATRIX_SIZE]
#define MAX_powercap_EVENTS
Tests basic functionality of powercap component.
static double c[MATRIX_SIZE][MATRIX_SIZE]