16#define PKG_POWER_LIMIT_A 3
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;
79 long long originalValues[1];
98 if ( !
TESTS_QUIET ) printf(
"Trying all powercap events\n" );
102 for( cid=0; cid<numcmp; cid++ ) {
105 test_fail( __FILE__, __LINE__,
"PAPI_get_component_info failed\n", 0 );
107 if ( strstr( cmpinfo->
name,
"powercap" ) ) {
109 if ( !
TESTS_QUIET ) printf(
"Found powercap component at cid %d\n",powercap_cid );
112 printf(
"powercap component disabled: %s\n",
115 test_skip( __FILE__,__LINE__,
"powercap component disabled",0 );
123 test_skip( __FILE__,__LINE__,
"No powercap component found\n",0 );
127 test_skip( __FILE__,__LINE__,
"No counters in the powercap component\n",0 );
135 printf(
"\nThis test may take a few minutes to complete.\n\n" );
141 test_fail( __FILE__, __LINE__,
"Error from PAPI_event_code_to_name",
retval );
170 printf(
"\n=======================================\n%-50s Readout (before 1st write) = %4.6f %s\n",
177 originalValues[0] =
values[0];
192 printf(
"\n%-50s Readout (after 1st write) = %4.6f %s\n",
213 printf(
"\n%-50s Readout (after restoring write) = %4.6f %s\n",
227 printf(
"\n%-50s Readout (final value) %4.6f %s\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.
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.
#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)
static double a[MATRIX_SIZE][MATRIX_SIZE]
static double b[MATRIX_SIZE][MATRIX_SIZE]
static double c[MATRIX_SIZE][MATRIX_SIZE]
char units[MAX_EVENTS][BUFSIZ]
static long long after_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]