
#ifdef	KSOS
#define	F_ERROR	-1L
#define	F_CHILD	0L
#else	KSOS
#define	F_ERROR	-1
#define	F_CHILD	0
#endif	KSOS

char gfiden[] "TEST1";
unsigned	int	t_start[2];
unsigned	int	t_end[2];


long	totaltime	0L;


int status;

main (argc,argv)
int  argc;
char **argv;
{
	register	int	i;
	register	int	k;
	register	int	n;

#ifdef	KSOS
	long	pid;
	long	wpid;
	long	fork ();
	long	wait ();
#else	KSOS
	int	pid;
	int	wpid;
#endif	KSOS

	if (argc != 2)
	{
		printf ("Usage:\n\tTEST1 <# of process creations>\n");
		exit ();
	}
	else
	{
		n = atoi (argv[1]);
	}

	printf ("Test 1: Process Creation (%d interactions)\n", n);

	timeon ();
	for (i = 0; i < n; i++)
	{
		if ((pid = fork ()) == F_ERROR)
		{
			printf ("Cant create process (%d)\n", i);
			exit ();
		}
		else if (pid == F_CHILD)
		{
		}
		else
		{
			exit ();
		}
	}

	timeoff ();
	printf ("Test 1: %d process creations in %D secs\n", 
		n,
		totaltime
		);
}

timeon()
{
	time (t_start);
	printf ("Test 1: Starting ... %s", ctime (t_start));
}

timeoff()
{
	time(t_end);
	totaltime += (32768 * (t_end[0] - t_start[0])) +
			((t_end[1] - t_start[1]));
	printf ("Test 1: Ending ... %s", ctime (t_end));
}

