27{
28
34 int numcmp,cid,example_cid=-1;
35 int code;
37
38
40
41
45 }
46
48 printf( "Testing simultaneous component use with PAPI %d.%d.%d\n",
52 }
53
54
55
57 for( cid=0; cid<numcmp; cid++) {
60 "PAPI_get_component_info failed\n", 0);
61 }
63 printf("\tComponent %d - %d events - %s\n", cid,
66 }
67 if (strstr(cmpinfo->
name,
"example")) {
68
69 example_cid=cid;
70 }
71 }
72
73
74 if (example_cid<0) {
76 "Example component not found\n", 0);
77 }
78
80 printf("\nFound Example Component at id %d\n",example_cid);
81 }
82
83
84
85
89 "PAPI_create_eventset() failed\n",
retval );
90 }
91
95 "EXAMPLE_ZERO not found\n",
retval );
96 }
97
101 "PAPI_add_events failed\n",
retval );
102 }
103
104
105
106
110 "PAPI_create_eventset() failed\n",
retval );
111 }
112
116 "PAPI_TOT_CYC not available\n",
retval );
117 }
118
122 "NO CPU component found\n",
retval );
123 }
124
125 if (!
quiet) printf(
"\nStarting EXAMPLE_CONSTANT and PAPI_TOT_CYC at the same time\n");
126
127
131 "PAPI_start failed\n",
retval );
132 }
133
134
138 "PAPI_start failed\n",
retval );
139 }
140
141
142
143
144
148 }
149
150
154 }
155
156 if (!
quiet) printf(
"Stopping EXAMPLE_CONSTANT and PAPI_TOT_CYC\n\n");
157
158
159 if (!
quiet) printf(
"Results from EXAMPLE_CONSTANT: %lld\n",values1[0]);
160
161 if (values1[0]!=42) {
162 test_fail( __FILE__, __LINE__,
"Result should be 42!\n", 0);
163 }
164
165 if (!
quiet) printf(
"Results from PAPI_TOT_CYC: %lld\n\n",values2[0]);
166
167 if (values2[0]<1) {
168 test_fail( __FILE__, __LINE__,
"Result should greater than 0\n", 0);
169 }
170
171
175 }
176
180 }
181
182
186 }
187
189
190 return 0;
191}
add PAPI preset or native hardware event to an event set
Empty and destroy an EventSet.
Create a new empty PAPI EventSet.
Empty and destroy an EventSet.
Convert a name to a numeric hardware event code.
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.
#define PAPI_VERSION_REVISION(x)
#define PAPI_VERSION_MAJOR(x)
#define PAPI_VERSION_MINOR(x)
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]