void main(int argc, char *argv[]) { test_init(); int port = atoi(argv[1]); int sockfd = DI_init_measurer(port); char line[256]; sprintf(line, "(set_target %s)",argv[2]); DI_send_request(sockfd, line); test_start(sockfd); test_measurement(sockfd, "(measure (var \"a\"))", ME_measurement_create_string("45")); test_measurement(sockfd, "(measure (var \"b\"))", ME_measurement_create_string("2")); test_continue(sockfd); test_measurement(sockfd, "(measure (var \"a\"))", ME_measurement_create_string("46")); test_measurement(sockfd, "(measure (var \"b\"))", ME_measurement_create_string("2")); DI_send_request(sockfd, "(quit)"); close(sockfd); test_close(); }
int main(int argc , char ** argv) { test_create(); test_min_realisations(); test_continue(); test_current_module_options(); test_stop_long_running(); exit(0); }
int main(int argc , char ** argv) { test_create(); test_min_realisations(); test_continue(); { const char * num_realizations_str = "NUM_REALIZATIONS 80\n"; const char * min_realizations_str = "MIN_REALIZATIONS 10%%\n"; int min_realizations = 8; test_min_realizations_percent(num_realizations_str, min_realizations_str, min_realizations); } { const char * num_realizations_str = "NUM_REALIZATIONS 8\n"; const char * min_realizations_str = "MIN_REALIZATIONS 50%%\n"; int min_realizations = 4; test_min_realizations_percent(num_realizations_str, min_realizations_str, min_realizations); } { const char * num_realizations_str = "NUM_REALIZATIONS 80\n"; const char * min_realizations_str = "MIN_REALIZATIONS 2\n"; int min_realizations = 2; test_min_realizations_percent(num_realizations_str, min_realizations_str, min_realizations); } { const char * num_realizations_str = "NUM_REALIZATIONS 8\n"; const char * min_realizations_str = "MIN_REALIZATIONS 10%%\n"; int min_realizations = 0; test_min_realizations_percent(num_realizations_str, min_realizations_str, min_realizations); } { const char * num_realizations_str = "NUM_REALIZATIONS 900\n"; const char * min_realizations_str = "MIN_REALIZATIONS 10 \n"; int min_realizations = 10; test_min_realizations_percent(num_realizations_str, min_realizations_str, min_realizations); } { const char * num_realizations_str = "NUM_REALIZATIONS 900\n"; int min_realizations = 0; test_min_realizations_percent(num_realizations_str, "", min_realizations); } test_current_module_options(); test_stop_long_running(); exit(0); }
int main( int argc, char **argv ) { int retval; int code = PAPI_TOT_CYC, last; char event_name[PAPI_MAX_STR_LEN]; const PAPI_hw_info_t *hwinfo = NULL; const PAPI_component_info_t *cmp_info; tests_quiet( argc, argv ); /* Set TESTS_QUIET variable */ retval = PAPI_library_init( PAPI_VER_CURRENT ); if ( retval != PAPI_VER_CURRENT ) test_fail( __FILE__, __LINE__, "PAPI_library_init", retval ); retval = papi_print_header ( "Test case code2name.c: Check limits and indexing of event tables.\n", &hwinfo ); if ( retval != PAPI_OK ) test_fail( __FILE__, __LINE__, "PAPI_get_hardware_info", 2 ); printf( "Looking for PAPI_TOT_CYC...\n" ); retval = PAPI_event_code_to_name( code, event_name ); if ( retval != PAPI_OK ) test_fail( __FILE__, __LINE__, "PAPI_event_code_to_name", retval ); printf( "Found |%s|\n", event_name ); code = PAPI_FP_OPS; printf( "Looking for highest defined preset event (PAPI_FP_OPS): 0x%x...\n", code ); retval = PAPI_event_code_to_name( code, event_name ); if ( retval != PAPI_OK ) test_fail( __FILE__, __LINE__, "PAPI_event_code_to_name", retval ); printf( "Found |%s|\n", event_name ); code = PAPI_PRESET_MASK | ( PAPI_MAX_PRESET_EVENTS - 1 ); printf( "Looking for highest allocated preset event: 0x%x...\n", code ); retval = PAPI_event_code_to_name( code, event_name ); if ( retval != PAPI_OK ) test_continue( "PAPI_event_code_to_name", retval ); else printf( "Found |%s|\n", event_name ); code = PAPI_PRESET_MASK | ( int ) PAPI_NATIVE_AND_MASK; printf( "Looking for highest possible preset event: 0x%x...\n", code ); retval = PAPI_event_code_to_name( code, event_name ); if ( retval != PAPI_OK ) test_continue( "PAPI_event_code_to_name", retval ); else printf( "Found |%s|\n", event_name ); /* Find the first defined native event */ /* For platform independence, always ASK FOR the first event */ /* Don't just assume it'll be the first numeric value */ code = PAPI_NATIVE_MASK; PAPI_enum_event( &code, PAPI_ENUM_FIRST ); printf( "Looking for first native event: 0x%x...\n", code ); retval = PAPI_event_code_to_name( code, event_name ); if ( retval != PAPI_OK ) { test_fail( __FILE__, __LINE__, "PAPI_event_code_to_name", retval ); } else { printf( "Found |%s|\n", event_name ); } /* Find the last defined native event */ cmp_info = PAPI_get_component_info( 0 ); if ( cmp_info == NULL ) test_fail( __FILE__, __LINE__, "PAPI_get_component_info", PAPI_ESBSTR ); code = PAPI_NATIVE_MASK; PAPI_enum_event( &code, PAPI_ENUM_FIRST ); while ( PAPI_enum_event( &code, PAPI_ENUM_EVENTS ) == PAPI_OK ) { last=code; } code = last; printf( "Looking for last native event: 0x%x...\n", code ); retval = PAPI_event_code_to_name( code, event_name ); if ( retval != PAPI_OK ) { test_fail( __FILE__, __LINE__, "PAPI_event_code_to_name", retval ); } else { printf( "Found |%s|\n", event_name ); } /* Highly doubtful we have this many natives */ /* Turn on all bits *except* PRESET bit and COMPONENT bits */ code = PAPI_PRESET_AND_MASK & PAPI_COMPONENT_AND_MASK; printf( "Looking for highest definable native event: 0x%x...\n", code ); retval = PAPI_event_code_to_name( code, event_name ); if ( retval != PAPI_OK ) test_continue( "PAPI_event_code_to_name", retval ); else printf( "Found |%s|\n", event_name ); if ( ( retval == PAPI_ENOEVNT ) || ( retval == PAPI_OK ) ) test_pass( __FILE__, 0, 0 ); test_fail( __FILE__, __LINE__, "PAPI_event_code_to_name", PAPI_EBUG ); exit( 1 ); }
void test_continue_or_stop (void) { outputLongLine ("Do you want to start some workers? "); if (askYesNo ('Y')) test_continue (); else test_stop (); }
void main_menu (void) { unsigned long choice; mloop: if (THREAD_KILL) return; printf ("\t Main Menu\n"); loop: printf ("\n"); printf ("\t 1. Test/Primenet\n"); printf ("\t 2. Test/Worker threads\n"); printf ("\t 3. Test/Status\n"); if (WORKER_THREADS_ACTIVE && active_workers_count () < WORKER_THREADS_ACTIVE) printf ("\t 4. Test/Continue or Stop\n"); else if (!WORKER_THREADS_ACTIVE || WORKER_THREADS_STOPPING) printf ("\t 4. Test/Continue\n"); else printf ("\t 4. Test/Stop\n"); printf ("\t 5. Test/Exit\n"); printf ("\t 6. Advanced/Test\n"); printf ("\t 7. Advanced/Time\n"); printf ("\t 8. Advanced/P-1\n"); printf ("\t 9. Advanced/ECM\n"); printf ("\t10. Advanced/Manual Communication\n"); printf ("\t11. Advanced/Unreserve Exponent\n"); printf ("\t12. Advanced/Quit Gimps\n"); printf ("\t13. Options/CPU\n"); printf ("\t14. Options/Preferences\n"); printf ("\t15. Options/Torture Test\n"); printf ("\t16. Options/Benchmark\n"); printf ("\t17. Help/About\n"); printf ("\t18. Help/About PrimeNet Server\n"); printf ("Your choice: "); choice = get_number (0); if (choice <= 0 || choice >= 19) { printf ("\t Invalid choice\n"); goto loop; } /* Display the main menu and switch off the users choice */ printf ("\n"); switch (choice) { /* Test/Primenet dialog */ case 1: test_primenet (); break; /* Test/User Information dialog */ case 2: test_worker_threads (); break; /* Test/Status message */ case 3: test_status (); askOK (); break; /* Test/Continue or Stop or Test/Continue or Test/Stop */ case 4: if (WORKER_THREADS_ACTIVE && active_workers_count () < WORKER_THREADS_ACTIVE) test_continue_or_stop (); else if (NUM_WORKER_THREADS > 1 && active_workers_count () < WORKER_THREADS_ACTIVE - 1) test_continue (); else if (!WORKER_THREADS_ACTIVE || WORKER_THREADS_STOPPING) { while (WORKER_THREADS_STOPPING) Sleep (50); linuxContinue ("Another mprime is running.\n", ALL_WORKERS, FALSE); } else if (active_workers_count () > 1) test_stop (); else stop_workers_for_escape (); break; /* Test/Exit */ case 5: { int counter = 0; if (WORKER_THREADS_ACTIVE && !WORKER_THREADS_STOPPING) stop_workers_for_escape (); while (WORKER_THREADS_STOPPING) { if (counter++ % 100 == 0) printf ("Waiting for worker threads to stop.\n"); Sleep (50); } } return; /* Advanced/Test dialog */ case 6: advanced_test (); break; /* Advanced/Time dialog */ case 7: advanced_time (); break; /* Advanced/P-1 dialog */ case 8: advanced_pminus1 (); break; /* Advanced/ECM dialog */ case 9: advanced_ecm (); break; /* Advanced/Manual Communication dialog */ case 10: advanced_manualcomm (); break; /* Advanced/Unreserve exponent dialog */ case 11: advanced_unreserve (); break; /* Advanced/Quit Gimps dialog */ case 12: advanced_quit (); break; /* Options/CPU dialog */ case 13: options_cpu (); break; /* Options/Preferences dialog */ case 14: options_preferences (); break; /* Options/Torture Test */ case 15: torture (); askOK (); break; /* Options/Benchmark Test */ case 16: LaunchBench (); askOK (); break; /* Help/About */ case 17: help_about (); break; /* Help/About PrimeNet Server */ case 18: help_about_server (); break; } goto mloop; }