24int main(
int argc,
char** argv) {
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"};
29 char *infile =
"/etc/group";
36 fprintf(
stderr,
"PAPI_library_init version mismatch\n");
42 fprintf(
stderr,
"Error creating event set\n");
47 if (!
TESTS_QUIET) printf(
"This program will read %s and write it to /dev/null\n", infile);
54 fprintf(
stderr,
"Error getting code for %s\n",
names[e]);
59 fprintf(
stderr,
"Error adding %s to event set\n",
names[e]);
66 fprintf(
stderr,
"Error in PAPI_start\n");
70 fdin=
open(infile, O_RDONLY);
71 if (fdin < 0) perror(
"Could not open file for reading: \n");
73 fdout=
open(
"/dev/null", O_WRONLY);
74 if (fdout < 0) perror(
"Could not open file for writing: \n");
83 while ((bytes =
read(fdin,
buf, 1024)) > 0) {
96 fprintf(
stderr,
"Error in PAPI_stop\n");
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]
Return codes and api definitions.
int tests_quiet(int argc, char **argv)
void PAPI_NORETURN test_pass(const char *filename)