26{
29 int code;
33 int total_events=0;
34 int r;
36
37
39
40
44 }
45
47 printf("Trying all appio events\n");
48 }
49
51
52 for(cid=0; cid<numcmp; cid++) {
53
55 test_fail(__FILE__, __LINE__,
"PAPI_get_component_info failed\n",-1);
56 }
57
59 printf("Component %d - %d events - %s\n", cid,
61 }
62
63 if ( strstr(cmpinfo->
name,
"appio") == NULL) {
64 continue;
65 }
66
68
70
72
76 }
77
79
83 }
84
86 printf(
"Added event %s (code=%#x)\n",
event_names[total_events], code);
87 }
88 event_codes[total_events++] = code;
90 }
91
92 }
93
94 int fdin,fdout;
95 const char* infile = "/etc/group";
96 printf("This program will read %s and write it to /dev/null\n", infile);
97 int bytes = 0;
99
103 }
104
108 }
109
110 fdin=
open(infile, O_RDONLY);
111 if (fdin < 0) perror("Could not open file for reading: \n");
112 fdout =
open(
"/dev/null", O_WRONLY);
113 if (fdout < 0) perror("Could not open /dev/null for writing: \n");
114
115 while ((bytes =
read(fdin,
buf, 1024)) > 0) {
117 }
118
122 }
125
128 for (
i=0;
i<total_events;
i++ ) {
129 printf("%#x %-24s = %lld\n",
131 }
132 }
133
137 }
138
142 }
143
144 if (total_events==0) {
145 test_skip(__FILE__,__LINE__,
"No appio events found", 0);
146 }
147
149
153 }
154
158 }
159 return 0;
160}
static const char * event_names[2]
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)
#define MAX_EVENTS
Prints the value of every appio event (by code)
add multiple PAPI presets or native hardware events to an event set
Empty and destroy an EventSet.
Create a new empty PAPI EventSet.
Empty and destroy an EventSet.
Enumerate PAPI preset or native events for a given component.
Convert a numeric hardware event code to a name.
get information about a specific software component
initialize the PAPI library.
Get the number of components available on the system.
Start counting hardware events in an event set.
Stop counting hardware events in an event set.
volatile int buf[CACHE_FLUSH_BUFFER_SIZE_INTS]
int tests_quiet(int argc, char **argv)
void PAPI_NORETURN test_fail(const char *file, int line, const char *call, int retval)
void PAPI_NORETURN test_pass(const char *filename)
void PAPI_NORETURN test_skip(const char *file, int line, const char *call, int retval)
char name[PAPI_MAX_STR_LEN]