60{
70
71
72
79
80
82
83
84
85
89
91 test_fail( __FILE__, __LINE__,
"PAPI_get_component_info", 0 );
92
93 if ( cmpinfo->
attach == 0 )
94 test_skip( __FILE__, __LINE__,
"Platform does not support attaching",
95 0 );
96
99 test_fail( __FILE__, __LINE__,
"PAPI_get_hardware_info", 0 );
100
101
102
103
107
108
109
112 test_fail( __FILE__, __LINE__,
"PAPI_assign_eventset_component",
114
119 }
120
123 if (!
quiet) printf(
"Problem adding PAPI_TOT_CYC\n");
125 }
126
128
133 }
134
137 }
138
140
142
144
146
148
150 pid_t child = wait( &status );
151 if (!
quiet) printf(
"Debugger exited wait() with %d\n",child );
152 if (WIFSTOPPED( status ))
153 {
154 if (!
quiet) printf(
"Child has stopped due to signal %d (%s)\n",
155 WSTOPSIG( status ), strsignal(WSTOPSIG( status )) );
156 }
157 if (WIFSIGNALED( status ))
158 {
159 if (!
quiet) printf(
"Child %ld received signal %d (%s)\n",
160 (long)child,
161 WTERMSIG(status) , strsignal(WTERMSIG( status )) );
162 }
164
168
169 if (!
quiet) printf(
"Continuing\n");
170#if defined(__FreeBSD__)
171 if ( ptrace( PT_CONTINUE,
pid, (
vptr_t) 1, 0 ) == -1 ) {
172#else
173 if ( ptrace( PTRACE_CONT,
pid, NULL, NULL ) == -1 ) {
174#endif
175 perror( "ptrace(PTRACE_CONT)" );
176 return 1;
177 }
178
179
180 do {
181 child = wait( &status );
182 if (!
quiet) printf(
"Debugger exited wait() with %d\n", child);
183 if (WIFSTOPPED( status ))
184 {
185 if (!
quiet) printf(
"Child has stopped due to signal %d (%s)\n",
186 WSTOPSIG( status ), strsignal(WSTOPSIG( status )) );
187 }
188 if (WIFSIGNALED( status ))
189 {
190 if (!
quiet) printf(
"Child %ld received signal %d (%s)\n",
191 (long)child,
192 WTERMSIG(status) , strsignal(WTERMSIG( status )) );
193 }
194 } while (!WIFEXITED( status ));
195
196 if (!
quiet) printf(
"Child exited with value %d\n",WEXITSTATUS(status));
197 if (WEXITSTATUS(status) != 0) {
199 }
203
205
207
209
211
215
219
221 printf( "Test case: 3rd party attach start, stop.\n" );
222 printf( "-----------------------------------------------\n" );
226 printf(
"Default granularity is: %d (%s)\n",
tmp,
228 printf(
"Using %d iterations of c += a*b\n",
NUM_FLOPS );
229 printf( "-------------------------------------------------------------------------\n" );
230
231 printf( "Test type : \t 1\n" );
232
233 printf(
TAB1,
"PAPI_TOT_CYC : \t", (
values[0] )[0] );
237 printf(
TAB1,
"Virt usec : \t", elapsed_virt_us );
238 printf(
TAB1,
"Virt cycles : \t", elapsed_virt_cyc );
239
240 printf( "-------------------------------------------------------------------------\n" );
241
242 printf( "Verification: none\n" );
243 }
244
246
247 return 0;
248
249}
static int wait_for_attach_and_loop(void)
static const PAPI_hw_info_t * hw_info
add PAPI preset or native hardware event to an event set
add PAPI preset or native hardware event by name to an EventSet
Assign a component index to an existing but empty EventSet.
Attach PAPI event set to the specified thread id.
Empty and destroy an EventSet.
Create a new empty PAPI EventSet.
Empty and destroy an EventSet.
get information about a specific software component
get information about the system hardware
Get PAPI library or event set options.
get real time counter value in clock cycles Returns the total real time passed since some arbitrary s...
get real time counter value in microseconds
get virtual time counter value in clock cycles
get virtual time counter values in microseconds
initialize the PAPI library.
Start counting hardware events in an event set.
Stop counting hardware events in an event set.
Returns a string describing the PAPI error code.
char event_name[2][PAPI_MAX_STR_LEN]
static long long values[NUM_EVENTS]
int tests_quiet(int argc, char **argv)
char * stringify_all_domains(int domains)
char * stringify_granularity(int granularity)
void PAPI_NORETURN test_fail(const char *file, int line, const char *call, int retval)
long long ** allocate_test_space(int num_tests, int num_events)
void PAPI_NORETURN test_pass(const char *filename)
void PAPI_NORETURN test_skip(const char *file, int line, const char *call, int retval)
unsigned int attach_must_ptrace