24 {
26 const char*
names[
NUM_EVENTS] = {
"OPEN_CALLS",
"OPEN_FDS",
"READ_CALLS",
"READ_BYTES",
"READ_USEC",
"READ_ERR",
"READ_INTERRUPTED",
"READ_WOULD_BLOCK",
"WRITE_CALLS",
"WRITE_BYTES",
"WRITE_USEC",
"WRITE_WOULD_BLOCK"};
28
29 char *infile = "/etc/group";
30
31
33
36 fprintf(
stderr,
"PAPI_library_init version mismatch\n");
37 exit(1);
38 }
39
40
42 fprintf(
stderr,
"Error creating event set\n");
43 exit(2);
44 }
45
46 int fdin;
47 if (!
TESTS_QUIET) printf(
"This program will read %s and write it to /dev/null\n", infile);
49 int e;
50 int event_code;
54 fprintf(
stderr,
"Error getting code for %s\n",
names[e]);
55 exit(2);
56 }
59 fprintf(
stderr,
"Error adding %s to event set\n",
names[e]);
60 exit(2);
61 }
62 }
63
64
66 fprintf(
stderr,
"Error in PAPI_start\n");
67 exit(1);
68 }
69
70 fdin=
open(infile, O_RDONLY);
71 if (fdin < 0) perror("Could not open file for reading: \n");
72 int fdout;
73 fdout=
open(
"/dev/null", O_WRONLY);
74 if (fdout < 0) perror("Could not open file for writing: \n");
75 int bytes = 0;
77
78
79
80
81
82
83 while ((bytes =
read(fdin,
buf, 1024)) > 0) {
85 }
86
87
88
89
90
93
94
96 fprintf(
stderr,
"Error in PAPI_stop\n");
97 }
98
100 printf("----\n");
103 }
105 return 0;
106}
int open(const char *pathname, int flags, mode_t mode)
ssize_t write(int fd, const void *buf, size_t count)
ssize_t read(int fd, void *buf, size_t count)
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 tests_quiet(int argc, char **argv)
void PAPI_NORETURN test_pass(const char *filename)