53 static int last_count = -1;
55 double st_secs, last_secs;
57 gettimeofday( &now, NULL );
62 if ( last_secs <= 0.001 )
66 printf(
"[%d] %s, time = %.3f, total = %ld, last = %ld, rate = %.1f/sec\n",
68 ( (
double )
count ) / last_secs );
71 if ( last_count != -1 ) {
72 if (
count < .1 * last_count ) {
73 test_fail( __FILE__, __LINE__,
"Interrupt rate changed!", 1 );
83run(
const char *str,
int len )
87 for ( n = 1; n <= len; n++ ) {
94main(
int argc,
char **argv )
97 const char *
name =
"unknown";
110 gettimeofday( &
start, NULL );
118 test_fail( __FILE__, __LINE__,
"PAPI_library_init failed", 1 );
123 printf(
"[%d] %s, num_events = %d\n", getpid(),
129 test_fail( __FILE__, __LINE__,
"PAPI_create_eventset failed", 1 );
135 if (!
quiet) printf(
"Trouble adding event\n");
136 test_skip( __FILE__, __LINE__,
"PAPI_add_event failed", 1 );
145 test_fail( __FILE__, __LINE__,
"PAPI_overflow failed", 1 );
151 test_fail( __FILE__, __LINE__,
"PAPI_start failed", 1 );
161 printf(
"[%d] %s, %s\n", getpid(),
name,
"stop");
169 printf(
"[%d] %s, %s\n", getpid(),
170 name,
"exec(./child_overflow)");
175 if ( access(
"./child_overflow", X_OK ) == 0 )
176 execl(
"./child_overflow",
"./child_overflow",
177 (
quiet ?
"TESTS_QUIET" : NULL ), NULL );
178 else if ( access(
"./ctests/child_overflow", X_OK ) == 0 )
179 execl(
"./ctests/child_overflow",
"./ctests/child_overflow",
180 (
quiet ?
"TESTS_QUIET" : NULL ), NULL );
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 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)
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_skip(const char *file, int line, const char *call, int retval)