15 #include <sys/types.h> 26 int main(
int argc,
char** argv) {
28 const char*
names[
NUM_EVENTS] = {
"READ_CALLS",
"READ_BYTES",
"READ_USEC",
"READ_ERR",
"READ_EOF",
"WRITE_CALLS",
"WRITE_BYTES",
"WRITE_USEC"};
31 char *infile =
"/etc/group";
38 fprintf(stderr,
"PAPI_library_init version mismatch\n");
41 if (!
TESTS_QUIET) printf(
"This program will read %s and write it to /dev/null\n", infile);
42 FILE* fdin=fopen(infile,
"r");
43 if (fdin == NULL) perror(
"Could not open file for reading: \n");
44 FILE* fout=fopen(
"/dev/null",
"w");
45 if (fout == NULL) perror(
"Could not open file for writing: \n");
54 fprintf(stderr,
"Error getting code for %s\n",
names[e]);
61 fprintf(stderr,
"Error in PAPI_start_counters\n");
69 while ((bytes =
fread(
buf, 1, 1024, fdin)) > 0) {
78 fprintf(stderr,
"Error in PAPI_stop_counters\n");
void test_pass(const char *filename)
size_t fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream)
static int Events[NUM_EVENTS]
int main(int argc, char **argv)
size_t fread(void *ptr, size_t size, size_t nmemb, FILE *stream)
int PAPI_event_name_to_code(const char *in, int *out)
Return codes and api definitions.
int PAPI_library_init(int version)
int PAPI_stop_counters(long long *values, int array_len)
int tests_quiet(int argc, char **argv)
int PAPI_start_counters(int *events, int array_len)
static long long values[NUM_EVENTS]
volatile int buf[CACHE_FLUSH_BUFFER_SIZE_INTS]
const char * names[NUM_EVENTS]