Subject: Re: sucky performance on i386/1.3I
To: Neil A. Carson <neil@causality.com>
From: Perry E. Metzger <perry@piermont.com>
List: tech-kern
Date: 01/22/1999 16:32:03
"Neil A. Carson" <neil@causality.com> writes:
> > That sounds like the bug.
> >
> > Have you tried Ragge's test program?
>
> No, I've not seen it posted. Might have been daydreaming.
> N.
#include <sys/time.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <err.h>
#include <signal.h>
#include <stdio.h>
#include <unistd.h>
void
exitera(int i)
{
exit(1);
}
int
main(int argc, char **argv)
{
struct itimerval timer;
pid_t pid;
int status;
int i;
for (i = 0;;i++) {
printf("forking... %d\n", i);
if ((pid = fork()) < 0)
errx(1, "parent: couldn't fork");
else if (pid == 0) {
/* child */
signal(SIGALRM, exitera);
timer.it_interval.tv_sec = 0;
timer.it_interval.tv_usec = 0;
timer.it_value.tv_sec = 0;
timer.it_value.tv_usec = 250000;
if (setitimer(ITIMER_REAL, &timer, NULL) < 0)
errx(1, "child, invalid time");
for(;;);
}
if (wait(&status) != pid)
errx(1, "parent: child error");
}
}