54 static int last_count = -1;
56 double st_secs, last_secs;
58 gettimeofday( &now, NULL );
63 if ( last_secs <= 0.001 )
67 printf(
"[%d] %s, time = %.3f, total = %ld, last = %ld, rate = %.1f/sec\n",
69 ( (
double )
count ) / last_secs );
72 if ( last_count != -1 ) {
73 if (
count < .1 * last_count ) {
74 test_fail( __FILE__, __LINE__,
"Interrupt rate changed!", 1 );
84run(
const char *str,
int len )
88 for ( n = 1; n <= len; n++ ) {
95main(
int argc,
char **argv )
100 const char *
name =
"unknown";
111 gettimeofday( &
start, NULL );
124 printf(
"[%d] %s, num_events = %d\n", getpid(),
130 test_fail(
name, __LINE__,
"PAPI_create_eventset failed", 1 );
136 if (!
quiet) printf(
"Trouble adding event.\n");
159 printf(
"[%d] %s, %s\n", getpid(),
name,
"stop");
168 printf(
"[%d] %s, %s\n", getpid(),
name,
"end");
static void print_rate(const char *str)
static struct timeval start last
static void run(const char *str, int len)
static int Event[MAX_EVENTS]
static int Threshold[MAX_EVENTS]
static void my_handler(int EventSet, void *pc, long long ovec, void *context)
add PAPI preset or native hardware event to an event set
Create a new empty PAPI EventSet.
initialize the PAPI library.
Set up an event set to begin registering overflows.
Start counting hardware events in an event set.
Stop counting hardware events in an event set.
static void do_cycles(int program_time)
static struct timeval start
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)