26 {
28 const char*
names[
NUM_EVENTS] = {
"READ_CALLS",
"READ_BYTES",
"READ_USEC",
"READ_ERR",
"READ_EOF",
"WRITE_CALLS",
"WRITE_BYTES",
"WRITE_USEC"};
30
31 char *infile = "/etc/group";
32
33
35
38 fprintf(
stderr,
"PAPI_library_init version mismatch\n");
39 exit(1);
40 }
41
42
44 fprintf(
stderr,
"Error creating event set\n");
45 exit(2);
46 }
47
48 if (!
TESTS_QUIET) printf(
"This program will read %s and write it to /dev/null\n", infile);
49 FILE* fdin=fopen(infile, "r");
50 if (fdin == NULL) perror("Could not open file for reading: \n");
51 FILE* fout=fopen("/dev/null", "w");
52 if (fout == NULL) perror("Could not open file for writing: \n");
53 int bytes = 0;
55
57 int e;
58 int event_code;
62 fprintf(
stderr,
"Error getting code for %s\n",
names[e]);
63 exit(2);
64 }
67 fprintf(
stderr,
"Error adding %s to event set\n",
names[e]);
68 exit(2);
69 }
70 }
71
72
74 fprintf(
stderr,
"Error in PAPI_start\n");
75 exit(1);
76 }
77
78
79
80
81
82 while ((bytes =
fread(
buf, 1, 1024, fdin)) > 0) {
84 }
85
88
89
91 fprintf(
stderr,
"Error in PAPI_stop\n");
92 }
93
95 printf("----\n");
98 }
100 return 0;
101}
size_t fread(void *ptr, size_t size, size_t nmemb, FILE *stream)
size_t fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream)
const char * names[NUM_EVENTS]
add PAPI preset or native hardware event to an event set
Create a new empty PAPI EventSet.
Convert a name to a numeric hardware event code.
initialize the PAPI library.
Start counting hardware events in an event set.
Stop counting hardware events in an event set.
volatile int buf[CACHE_FLUSH_BUFFER_SIZE_INTS]
static long long values[NUM_EVENTS]
int fclose(FILE *__stream)
int tests_quiet(int argc, char **argv)
void PAPI_NORETURN test_pass(const char *filename)