26int 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");
44 fprintf(
stderr,
"Error creating event set\n");
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");
62 fprintf(
stderr,
"Error getting code for %s\n",
names[e]);
67 fprintf(
stderr,
"Error adding %s to event set\n",
names[e]);
74 fprintf(
stderr,
"Error in PAPI_start\n");
82 while ((bytes =
fread(
buf, 1, 1024, fdin)) > 0) {
91 fprintf(
stderr,
"Error in PAPI_stop\n");
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]
Return codes and api definitions.
int fclose(FILE *__stream)
int tests_quiet(int argc, char **argv)
void PAPI_NORETURN test_pass(const char *filename)