23 {
25 const char*
names[
NUM_EVENTS] = {
"READ_CALLS",
"READ_BYTES",
"READ_BLOCK_SIZE",
"READ_USEC",
"SEEK_CALLS",
"SEEK_USEC",
"SEEK_ABS_STRIDE_SIZE"};
27
28 char *infile = "/etc/group";
29
30
32
35 fprintf(
stderr,
"PAPI_library_init version mismatch\n");
36 exit(1);
37 }
38
39
41 fprintf(
stderr,
"Error creating event set\n");
42 exit(2);
43 }
44
45 int fdin;
46 if (!
TESTS_QUIET) printf(
"This program will do a strided read %s and write it to stdout\n", infile);
48 int e;
49 int event_code;
53 fprintf(
stderr,
"Error getting code for %s\n",
names[e]);
54 exit(2);
55 }
58 fprintf(
stderr,
"Error adding %s to event set\n",
names[e]);
59 exit(2);
60 }
61 }
62
63
65 fprintf(
stderr,
"Error in PAPI_start\n");
66 exit(1);
67 }
68
69 fdin=
open(infile, O_RDONLY);
70 if (fdin < 0) perror("Could not open file for reading: \n");
71 int bytes = 0;
73
74
75
76
77
78
79 while ((bytes =
read(fdin,
buf, 32)) > 0) {
81 lseek(fdin, 16, SEEK_CUR);
82 }
83
84
85
86
87
89
90
92 fprintf(
stderr,
"Error in PAPI_stop\n");
93 }
94
96 printf("----\n");
99 }
101 return 0;
102}
int open(const char *pathname, int flags, mode_t mode)
off_t lseek(int fd, off_t offset, int whence)
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)