Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 29 Apr 2005 15:26:34 +0400
From:      "Andrew L. Neporada" <andr@dgap.mipt.ru>
To:        freebsd-hackers@freebsd.org
Subject:   open("/dev/cuaaX") is slow
Message-ID:  <20050429112634.GA63285@nas.dgap.mipt.ru>

next in thread | raw e-mail | index | archive | help

--W/nzBZO5zC0uMSeA
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

Hi, hackers!

It seems that reopening /dev/cuaaX devices after close() takes exactly
3 seconds on FreeBSD 4.10 (sorry, I've no 5.x systems available at the 
moment).

Here is output of attached program:
open() time: 155 us
open() time: 2995729 us
open() time: 2999811 us
open() time: 2999608 us
open() time: 2999711 us
open() time: 2999720 us
open() time: 2999713 us
open() time: 2999744 us
open() time: 2999673 us
open() time: 2999706 us

Is this 3 second delay necessary? Can I get rid of it?

				Andrew.

--W/nzBZO5zC0uMSeA
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="siotest.c"

#include <sys/time.h>
#include <stdio.h>
#include <fcntl.h>

int
main(void) {
	int		fd, i;
	long		us;
	struct timeval	tv1, tv2;

	for (i = 0; i < 10; i++) {
		gettimeofday(&tv1, NULL);
		fd = open("/dev/cuaa0", O_RDWR);
		gettimeofday(&tv2, NULL);
		us = (tv2.tv_sec - tv1.tv_sec) * 1000000 +
		     (tv2.tv_usec - tv1.tv_usec);
		printf("open() time: %d us\n", us);
		if (fd == -1) {
			perror("open");
			exit(1);
		}
		close(fd);
	}
}

--W/nzBZO5zC0uMSeA--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050429112634.GA63285>