예제 #1
0
int main(int argc,char **argv)
{
    struct sockaddr_atmpvc addr;
    struct atm_qos qos;
    int s;

    if (argc != 2) usage(argv[0]);
    if ((s = socket(PF_ATMPVC,SOCK_DGRAM,0)) < 0) {
	perror("socket");
	return 1;
    }
    memset(&addr,0,sizeof(addr));
    if (text2atm(argv[1],(struct sockaddr *) &addr,sizeof(addr),T2A_PVC) < 0)
	usage(argv[0]);
    memset(&qos,0,sizeof(qos));
    qos.aal = ATM_AAL5;
    qos.txtp.traffic_class = qos.rxtp.traffic_class = ATM_UBR;
    qos.txtp.max_sdu = qos.rxtp.max_sdu = MAX_SDU;
    if (setsockopt(s,SOL_ATM,SO_ATMQOS,&qos,sizeof(qos)) < 0) {
	perror("setsockopt SO_ATMQOS");
	return 1;
    }
    if (connect(s,(struct sockaddr *) &addr,sizeof(addr)) < 0) {
	perror("connect");
	return 1;
    }
    srandom(0); /* we want it to be deterministic */
    torture(s);
    return 0;
}
예제 #2
0
static void
torture_test (void)
{
	int i;

	srand (getpid () * time (NULL));

	for (i = 0; i < 500; i++) {
		if (fork () == 0) {
			torture ();
			_exit (0);
		}
		usleep (1000);
	}
}
예제 #3
0
파일: menu.c 프로젝트: rudimeier/mprime
void test_welcome (void)
{
	int	m_join = 1;

/* Set global flag indicating startup is in progress.  This will delay */
/* starting any communication with the server until the user has confirmed */
/* he wants to use primenet and he has selected his work preferences. */
	
	STARTUP_IN_PROGRESS = 1;

	outputLongLine ("\nWelcome to GIMPS, the hunt for huge prime numbers.  You will be asked a few simple questions and then the program will contact the primenet server to get some work for your computer.  Good luck!\n");
	outputLongLine ("\nAttention OVERCLOCKERS!!  Mprime has gained a reputation as a useful stress testing tool for people that enjoy pushing their hardware to the limit.  You are more than welcome to use this software for that purpose.  Please select the stress testing choice below to avoid interfering with the PrimeNet server.  Use the Options/Torture Test menu choice for your stress tests.  Also, read the stress.txt file.\n");
	outputLongLine ("\nIf you want to both join GIMPS and run stress tests, then Join GIMPS and answer the questions.  After the server gets some work for you, stop mprime, then run mprime -m and choose Options/Torture Test.\n\n");
	askYN ("Join Gimps? (Y=Yes, N=Just stress testing)", &m_join);
	if (m_join) {
		STRESS_TESTER = 0;
		IniWriteInt (INI_FILE, "StressTester", 0);
		USE_PRIMENET = 1;
		IniWriteInt (INI_FILE, "UsePrimenet", 1);
		test_primenet ();
		if (USE_PRIMENET && STARTUP_IN_PROGRESS) options_cpu ();
		if (USE_PRIMENET && STARTUP_IN_PROGRESS) test_worker_threads ();
		if (USE_PRIMENET && STARTUP_IN_PROGRESS) {
			STARTUP_IN_PROGRESS = 0;
			set_comm_timers ();
			linuxContinue (NULL, ALL_WORKERS, FALSE);
		} else
			STARTUP_IN_PROGRESS = 0;
	} else {
		STRESS_TESTER = 1;
		IniWriteInt (INI_FILE, "StressTester", 1);
		USE_PRIMENET = 0;
		IniWriteInt (INI_FILE, "UsePrimenet", USE_PRIMENET = 0);
		STARTUP_IN_PROGRESS = 0;
		torture ();
	}
	main_menu ();
}
예제 #4
0
파일: menu.c 프로젝트: rudimeier/mprime
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;
}