Mail Archives: djgpp-workers/1998/03/19/05:08:29
> Your test program gets overly optimistic results because in most
> configurations the FAT of the disk(s) is question will be in the disk
> cache after the first call. Try inserting a call to `_flush_disk_cache'
> libc function between each two calls, and I think you will see a *big*
> difference.
Ok, I've tried that. I still get the same results from access() as statfs().
I've turned of SMARTDRV as well.
C: is 128MB and D: is 650MB big on my hard disk.
Anyway this is irrelevant as I described in my previous post djgpp-workers.
Please try it yourself,
MartinS
#include <time.h>
#include <stdio.h>
#include <errno.h>
#include <unistd.h>
#include <sys/vfs.h>
int main(int argc
,char **argv
)
{
char *b;
FILE *f;
int i;
int ret;
struct statfs sfs;
time_t t1, t2;
if(1 < argc)
{
printf("Testing access.\n");
t1 = time(NULL);
for(i = 0; i < 10000; i++)
{
_flush_disk_cache();
ret = access("c:/", D_OK);
_flush_disk_cache();
ret = access("d:/", D_OK);
/* _flush_disk_cache();
ret = access("e:/", D_OK);*/
}
t2 = time(NULL);
}
else
{
printf("Testing statfs.\n");
t1 = time(NULL);
for(i = 0; i < 10000; i++)
{
_flush_disk_cache();
ret = statfs("c:", &sfs);
_flush_disk_cache();
ret = statfs("d:", &sfs);
/* _flush_disk_cache();
ret = statfs("e:", &sfs);*/
}
t2 = time(NULL);
}
printf("ret = %d, errno = %d, t1 = %ld, t2 = %ld, t2-t1 = %ld.\n",
ret, errno, t1, t2, t2-t1);
return(0);
}
- Raw text -