24 long long high=0,low=0,average=0;
25 long long expected_cond=500000,expected_total=1000000;
34 long long count_total,count_conditional,count_taken,count_nottaken;
35 int cond_avail=1,nottaken_avail=1;
41 printf(
"\nTesting the PAPI_BR_TKN event.\n");
42 printf(
"\tIt measures total number of conditional branches not taken\n");
71 if (!
quiet) printf(
"Could not add PAPI_BR_CN\n");
84 if (!
quiet) printf(
"Could not add PAPI_BR_TKN\n");
96 if (!
quiet) printf(
"Could not add PAPI_BR_NTK\n");
123 if (nottaken_avail) {
131 printf(
"The test code has:\n");
132 printf(
"\t%lld total branches\n",count_total);
134 printf(
"\t%lld conditional branches\n",count_conditional);
136 printf(
"\t%lld taken branches\n",count_taken);
137 if (nottaken_avail) {
138 printf(
"\t%lld not-taken branches\n",count_nottaken);
144 printf(
"Testing a loop with %lld conditional taken branches (%d times):\n",
145 expected_cond,num_runs);
148 for(
i=0;
i<num_runs;
i++) {
157 fprintf(stderr,
"\tCode unimplemented\n");
158 test_skip( __FILE__, __LINE__,
"unimplemented", 0);
163 "reading PAPI_BR_TKN",
retval );
171 average=(
total/num_runs);
175 if ((error > 1.0) || (error<-1.0)) {
176 if (!
quiet) printf(
"Instruction count off by more than 1%%\n");
181 if (!
quiet) printf(
"\n");
188 if ((error > 1.0) || (error<-1.0)) {
189 if (!
quiet) printf(
"Instruction count off by more than 1%%\n");
190 test_fail( __FILE__, __LINE__,
"Error too high", 1 );
193 test_warn(__FILE__,__LINE__,
"Using TOTAL BRANCHES as base rather than CONDITIONAL BRANCHES\n",0);
int PAPI_stop(int EventSet, long long *values)
void test_pass(const char *filename)
int PAPI_reset(int EventSet)
double display_error(long long average, long long high, long long low, long long expected, int quiet)
#define CODE_UNIMPLEMENTED
void test_warn(const char *file, int line, const char *call, int retval)
void test_skip(const char *file, int line, const char *call, int retval)
int PAPI_add_named_event(int EventSet, const char *EventName)
int PAPI_library_init(int version)
int PAPI_create_eventset(int *EventSet)
int branches_testcode(void)
int tests_quiet(int argc, char **argv)
void test_fail(const char *file, int line, const char *call, int retval)
int PAPI_start(int EventSet)