Author: Robert Hyatt
Date: 17:10:54 05/06/04
Go up one level in this thread
On May 06, 2004 at 17:49:52, Dieter Buerssner wrote:
>On May 05, 2004 at 11:53:33, Robert Hyatt wrote:
>
>> for (i=0;i<33000;i++);
> ^Oops!
>
>You measured the time of an empty loop.
>
>Regards,
>Dieter
Actually I didn't. I just copied the file from the wrong directory. I had
found that glitch when I first wrote it, but I needed to run the test in a big
directory with lots of files to make it meaningful...
Here is another run:
crafty% time ./tstopen
0.020u 0.070s 0:00.08 112.5% 0+0k 0+0io 72pf+0w
Here is the correct source:
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <string.h>
main() {
char fname[6];
int fd;
int i;
for (i=0;i<33000;i++) {
sprintf(fname,"%d",i);
fd = open(fname,O_RDONLY);
if (fd > 0) {
write(fd,fname,strlen(fname));
close(fd);
}
}
}
Bob
This page took 0 seconds to execute
Last modified: Thu, 15 Apr 21 08:11:13 -0700
Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.