delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/1998/03/19/05:08:29

From: Martin Stromberg <Martin DOT Stromberg AT lu DOT erisoft DOT se>
Message-Id: <199803191008.LAA09478@propus.lu.erisoft.se>
Subject: Re: Where to get the latest sources for djtar
To: eliz AT is DOT elta DOT co DOT il (Eli Zaretskii)
Date: Thu, 19 Mar 1998 11:08:29 +0100 (MET)
Cc: djgpp-workers AT delorie DOT com (DJGPP-WORKERS)
In-Reply-To: <Pine.SUN.3.91.980318165211.21959B-100000@is> from "Eli Zaretskii" at Mar 18, 98 05:09:18 pm
MIME-Version: 1.0

> 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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019