43 int l1_size,l2_size,l1_linesize,l2_linesize,l2_entries;
54 printf(
"Testing the PAPI_L1_DCM event\n");
80 printf(
"\tDetected %dk L1 DCache, %dB linesize\n",
81 l1_size/1024,l1_linesize);
82 printf(
"\tDetected %dk L2 DCache, %dB linesize, %d entries\n",
83 l2_size/1024,l2_linesize,l2_entries);
86 arraysize=(l1_size/
sizeof(double))*8;
89 if (!
quiet) printf(
"Could not detect cache size\n");
90 test_skip(__FILE__,__LINE__,
"No cache info",0);
94 printf(
"\tAllocating %zu bytes of memory (%d doubles)\n",
95 arraysize*
sizeof(
double),arraysize);
98 array=calloc(arraysize,
sizeof(
double));
100 test_fail(__FILE__,__LINE__,
"Can't allocate memory",0);
108 printf(
"\nWrite Test: Writing an array of %d doubles %d random times:\n",
110 printf(
"It's expected that 7/8 of the accesses should be hits\n");
113 high=0; low=0;
total=0;
115 for(
i=0;
i<num_runs;
i++) {
126 "reading PAPI_L1_DCM",
retval );
134 average=(
total/num_runs);
144 printf(
"Instruction count off by more than " 150 if (!
quiet) printf(
"\n");
157 printf(
"\nRead Test: Summing %d random doubles from array " 159 printf(
"It's expected that 7/8 of the accesses should be hits\n");
162 high=0; low=0;
total=0;
164 for(
i=0;
i<num_runs;
i++) {
175 "reading PAPI_L1_DCM",
retval );
183 average=(
total/num_runs);
193 printf(
"Instruction count off by more than " 204 test_fail( __FILE__, __LINE__,
"Error too high", 1 );
int PAPI_stop(int EventSet, long long *values)
void test_pass(const char *filename)
static int expected[NUM_THREADS]
int PAPI_reset(int EventSet)
double display_error(long long average, long long high, long long low, long long expected, int quiet)
static double array[ARRAYSIZE]
void test_skip(const char *file, int line, const char *call, int retval)
int PAPI_add_named_event(int EventSet, const char *EventName)
int cache_random_write_test(double *array, int size, int count)
int PAPI_library_init(int version)
double cache_random_read_test(double *array, int size, int count)
long long get_linesize(int type)
int PAPI_create_eventset(int *EventSet)
long long get_cachesize(int type)
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)
long long get_entries(int type)