35 long long count,high=0,low=0,
total=0,average=0;
40 printf(
"\nTesting a loop of 1 million instructions (%d times):\n",
51 if (!
quiet) printf(
"Could not add PAPI_TOT_INS\n");
65 fprintf(
stderr,
"\tCode unimplemented\n");
66 test_skip( __FILE__, __LINE__,
"unimplemented", 0);
71 "reading PAPI_TOT_INS",
result );
83 if ((error > 1.0) || (error<-1.0)) {
88 printf(
"If PPC is off by 50%%, this might be due to\n"
89 "\"folded\" branch instructions on PPC32\n");
103#if defined(__i386__) || (defined __x86_64__)
107 long long count,high=0,low=0,
total=0,average=0;
111 printf(
"\nTesting a fldcw loop of 900,000 instructions (%d times):\n",
135 test_fail( __FILE__, __LINE__,
"Code unimplemented", 1 );
139 test_fail( __FILE__, __LINE__,
"Unexpected error on read", 1 );
151 if ((error > 1.0) || (error<-1.0)) {
154 printf(
"On Pentium 4 machines, the fldcw instruction counts as 2.\n");
155 printf(
"This will lead to an overcount of 22%%\n");
157 test_fail( __FILE__, __LINE__,
"Error too high", 1 );
169#if defined(__i386__) || (defined __x86_64__)
173 long long count,high=0,low=0,
total=0,average=0;
177 printf(
"\nTesting a 16k rep loop (%d times):\n",
NUM_RUNS);
200 fprintf(
stderr,
"\tCode unimplemented\n");
201 test_fail( __FILE__, __LINE__,
"Code unimplemented", 1 );
205 test_fail( __FILE__, __LINE__,
"Unexpected error on read", 1 );
217 if ((error > 10.0) || (error<-10.0)) {
219 printf(
"Instruction count off by more than 10%%\n");
221 test_fail( __FILE__, __LINE__,
"Error too high", 1 );
226int main(
int argc,
char **argv) {
237 printf(
"\nThis test checks that the \"PAPI_TOT_INS\" generalized "
238 "event is working.\n");
251 if (!
quiet) printf(
"\n");
add PAPI preset or native hardware event by name to an EventSet
Create a new empty PAPI EventSet.
initialize the PAPI library.
Reset the hardware event counts in an event set.
Finish using PAPI and free all related resources.
Start counting hardware events in an event set.
Stop counting hardware events in an event set.
double display_error(long long average, long long high, long long low, long long expected, int quiet)
int instructions_fldcw(void)
int instructions_rep(void)
int instructions_million(void)
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 void test_fldcw(int quiet)
static void test_rep(int quiet)
static void test_million(int quiet)
#define CODE_UNIMPLEMENTED