69 test_fail( __FILE__, __LINE__,
"PAPI_get_component_info", 0 );
72 if ( cmpinfo->
attach == 0 ) {
74 "Platform does not support attaching", 0 );
92 if ( ptrace( PTRACE_ATTACH,
pid, NULL, NULL ) == -1 ) {
93 perror(
"ptrace(PTRACE_ATTACH)" );
97 perror(
"waitpid()" );
100 if ( WIFSTOPPED(
status ) == 0 )
102 "Child process didnt return true to WIFSTOPPED", 0 );
112 sprintf( add_event_str,
"PAPI_add_event[%s]",
event_name );
125 if ( ptrace( PTRACE_CONT,
pid, NULL, NULL ) == -1 ) {
126 perror(
"ptrace(PTRACE_CONT)" );
129 if ( waitpid(
pid, &
status, 0 ) == -1 ) {
130 perror(
"waitpid()" );
133 if ( WIFSTOPPED(
status ) == 0 ) {
135 "Child process didn't return true to WIFSTOPPED", 0 );
137 if ( WSTOPSIG(
status ) != SIGSTOP ) {
139 "Child process didn't stop on SIGSTOP", 0 );
150 if ( ptrace( PTRACE_CONT,
pid, NULL, NULL ) == -1 ) {
151 perror(
"ptrace(PTRACE_CONT)" );
154 if ( waitpid(
pid, &
status, 0 ) == -1 ) {
155 perror(
"waitpid()" );
158 if ( WIFSTOPPED(
status ) == 0 ) {
160 "Child process didn't return true to WIFSTOPPED", 0 );
162 if ( WSTOPSIG(
status ) != SIGSTOP ) {
164 "Child process didn't stop on SIGSTOP", 0 );
181 if ( ptrace( PTRACE_CONT,
pid, NULL, NULL ) == -1 ) {
182 perror(
"ptrace(PTRACE_CONT)" );
187 if ( waitpid(
pid, &
status, 0 ) == -1 ) {
188 perror(
"waitpid()" );
191 if ( WIFEXITED(
status ) == 0 ) {
193 "Child process didn't return true to WIFEXITED", 0 );
197 printf(
"Test case: 3rd party attach start, stop.\n" );
198 printf(
"-----------------------------------------------\n" );
200 printf(
"Default domain is: %d (%s)\n",
tmp,
203 printf(
"Default granularity is: %d (%s)\n",
tmp,
205 printf(
"Using %d iterations of c += a*b\n",
NUM_FLOPS );
206 printf(
"-------------------------------------------------------------------------\n" );
208 printf(
"Test type : \t 1\n" );
210 sprintf( add_event_str,
"%-12s : \t",
event_name );
212 printf(
TAB1,
"PAPI_TOT_CYC : \t",
values[0][0] );
215 printf(
TAB1,
"Virt usec : \t", elapsed_virt_us );
216 printf(
TAB1,
"Virt cycles : \t", elapsed_virt_cyc );
218 printf(
"-------------------------------------------------------------------------\n" );
220 printf(
"Verification: none\n" );
char event_name[2][PAPI_MAX_STR_LEN]
int PAPI_stop(int EventSet, long long *values)
const PAPI_component_info_t * PAPI_get_component_info(int cidx)
void test_pass(const char *filename)
long long PAPI_get_virt_usec(void)
char * stringify_granularity(int granularity)
long long PAPI_get_virt_cyc(void)
void test_skip(const char *file, int line, const char *call, int retval)
int wait_for_attach_and_loop(void)
int PAPI_library_init(int version)
char * stringify_all_domains(int domains)
unsigned int attach_must_ptrace
int PAPI_get_opt(int option, PAPI_option_t *ptr)
int add_two_events(int *num_events, int *papi_event, int *mask)
int PAPI_event_code_to_name(int EventCode, char *out)
long long PAPI_get_real_usec(void)
int tests_quiet(int argc, char **argv)
void test_fail(const char *file, int line, const char *call, int retval)
int PAPI_attach(int EventSet, unsigned long tid)
long long PAPI_get_real_cyc(void)
int PAPI_start(int EventSet)
static long long values[NUM_EVENTS]
long long ** allocate_test_space(int num_tests, int num_events)
int remove_test_events(int *EventSet, int mask)