Red Hat axp-list: Linux on Alpha (1995-2022)
 help / color / mirror / Atom feed
* Re: Problems with slow EIDE disk / slow system time
@ 1997-08-20 14:33 Michal Jaegermann
  0 siblings, 0 replies; 5+ messages in thread
From: Michal Jaegermann @ 1997-08-20 14:33 UTC (permalink / raw)


> 
> 
> Is there a possibility to get both, a fast disk throughput and a 
> accurate system time?

Sure.  By not using IDE disks (with prefixes or not).

One of problems with IDE is that these disks eat system resorces
like crazy (not only interrupts but CPU time as well).  So you pay
for cheaper disks by making other components busy doing I/O instead
of a  useful work.  This is unimportant on a single user single-tasking
DOS (and derivatives, like '95) system, but shows up when you really
start multitask.

> Is it secure to use `cron' (maybe every 5 to 10 minutes) to
> synchronize
> the system time with CMOS time? (the differences in time are in the
> order of
> several seconds per minute, if there is intensive hard disk access)

It depends what you are doing on this machine.  If it is used
practically as a single user workstation then results of doing that
should be relatively harmless.

  Michal

--
To unsubscribe: send e-mail to axp-list-request@redhat.com with
'unsubscribe' as the subject.  Do not send it to axp-list@redhat.com

^ permalink raw reply	[flat|nested] 5+ messages in thread
* Re: Problems with slow EIDE disk / slow system time
@ 1997-09-17 13:44 Stefan Schroepfer
  0 siblings, 0 replies; 5+ messages in thread
From: Stefan Schroepfer @ 1997-09-17 13:44 UTC (permalink / raw)


Ronny Ranerup wrote:
> 
> Try this, reads directly from the device. Change MEGS to how many
> megs ram you have, used for flushing the cache...
> 
> /ronny@axis.com/Ronny Ranerup/Axis Communications AB/http://www.axis.com
> 

Ronny: I will try out your code soon (but I'm currently not
at my Alpha).

What I said in my first mail: System time (as reported by
date (1)) is slowed down during disk I/O if certain features
are set with hdparm, so that hdparm itself reports a bogus
value for throughput.
I don't how gettimeofday (which you use in your code to measure
time) is implemented and if you get bogus values, too.

Ever tried using a stopwatch to verify your results?

Stefan Schroepfer
scr@iis.fhg.de

--
To unsubscribe: send e-mail to axp-list-request@redhat.com with
'unsubscribe' as the subject.  Do not send it to axp-list@redhat.com

^ permalink raw reply	[flat|nested] 5+ messages in thread
* Re: Problems with slow EIDE disk / slow system time
@ 1997-09-17 13:09 Ronny Ranerup
  0 siblings, 0 replies; 5+ messages in thread
From: Ronny Ranerup @ 1997-09-17 13:09 UTC (permalink / raw)


Stefan Schroepfer>
>Yes: hdparm does report a higher read rate (using option '-t')
>after setting some flags.
>*BUT* simply counting seconds during a
>  $ hdparm -T /dev/hda       # to avoid caching artifacts
>  $ hdparm -t /dev/hda       # perform timings of device reads
>on an otherwise idle system will show you that disk throughput
>is not as fast as hdparm wants to tell you.
>In fact, only the OS's clock runs slower during disk I/O, as you
>can see if you do a
>  $ clock -u -A -r; date     # '-A' if ARC console
>before and after the two hdparm calls.
>
>> Is there a possibility to get both, a fast disk throughput and a
>> accurate system time?
>
>In my opinion: no. I think it is only possible to slow down system
>time, but not to get fast EIDE disk throughput.

Try this, reads directly from the device. Change MEGS to how many megs ram you have, 
used for flushing the cache...

/ronny@axis.com/Ronny Ranerup/Axis Communications AB/http://www.axis.com

---

#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/time.h>

/* Set to how many megs ram you have */
#define MEGS 128

#define BYTES (1024*5000)

int
main (int argc, char *argv[])
{
  int fd;
  char *buf;
  int i;
  struct timeval start;
  struct timeval end;
  struct timeval diff;
  long int usec = 0;
  char *foo;
  int times;
  int BUFSIZE = 1024*1000;
  int db = 0;
  float min = 100000000;
  float max = 0;
  float average = 0;
  float mbps;
  int reads = 0;

  if (argc != 2) {
    printf("Needs file/device as argument\n");
    exit(1);
  }

  if ((fd = open(argv[1], O_RDONLY)) == -1) {
    perror("open failed");
    exit(1);
  }

  foo = (char*) malloc(1024*1000*MEGS);
  printf("Flushing ram...\n");
  for (i = 0; i < 1024*1000*64; i+=1024) {
    foo[i] = 4;
  }
  free(foo);
  printf("...done\n");
  
  for (BUFSIZE = 1024; BUFSIZE <= BYTES; BUFSIZE*=2) {
    
    if (db) printf("Getting buffer into memory...\n"); 
    buf = (char*) malloc(BUFSIZE);
    for (i = 0; i != BUFSIZE-1; i++) {
      buf[i] = 0;
    }
    if (db) printf("...done\n");
    
    gettimeofday(&start, NULL);
    gettimeofday(&end, NULL);
    
    times = BYTES/BUFSIZE;
    printf("%d bytes per read, %d times = %d bytes.\n", BUFSIZE, times, times*BUFSIZE);
    
    if (db) printf("start\n");
    gettimeofday(&start, NULL);
    
    for (i = 0; i != times; i++) {
      if (read(fd, buf, BUFSIZE) != BUFSIZE) {
	perror("read failed");
	exit(1);
      }
    }
    
    gettimeofday(&end, NULL);
    if (db) printf("end\n");
    
    timeval_subtract(&diff, &end, &start);
    if (db) printf ("%ldsecs %ldusecs\n", diff.tv_sec, diff.tv_usec);
    usec = diff.tv_sec * 1000000 + diff.tv_usec;
    
    mbps = (float)(times*BUFSIZE)/usec;
    printf("%d bytes in %ld usecs. %fMB/s\n\n", times*BUFSIZE, usec, mbps);
    if (mbps > max)
      max = mbps;
    
    if (mbps < min)
      min = mbps;
    
    average += mbps;
    reads++;
  }

  free(buf);
  printf("MB/s min:%f, max:%f, average:%f\n", min, max, average/reads);
}

int
timeval_subtract (struct timeval *result, struct timeval *x, struct timeval *y)
{
       /* Perform the carry for the later subtraction by updating Y. */
  if (x->tv_usec < y->tv_usec) {
    int nsec = (y->tv_usec - x->tv_usec) / 1000000 + 1;
    y->tv_usec -= 1000000 * nsec;
         y->tv_sec += nsec;
  }
  if (x->tv_usec - y->tv_usec > 1000000) {
    int nsec = (y->tv_usec - x->tv_usec) / 1000000;
    y->tv_usec += 1000000 * nsec;
         y->tv_sec -= nsec;
  }
  
  /* Compute the time remaining to wait.
     `tv_usec' is certainly positive. */
       result->tv_sec = x->tv_sec - y->tv_sec;
       result->tv_usec = x->tv_usec - y->tv_usec;
     
       /* Return 1 if result is negative. */
       return x->tv_sec < y->tv_sec;
}

--
To unsubscribe: send e-mail to axp-list-request@redhat.com with
'unsubscribe' as the subject.  Do not send it to axp-list@redhat.com

^ permalink raw reply	[flat|nested] 5+ messages in thread
* Re: Problems with slow EIDE disk / slow system time
@ 1997-09-17 12:01 Stefan Schroepfer
  0 siblings, 0 replies; 5+ messages in thread
From: Stefan Schroepfer @ 1997-09-17 12:01 UTC (permalink / raw)


Stefan Illy wrote (Aug 20 1997):
> 
> We use a 4 GByte EIDE harddisk in our PC164/21164 based system.

Me too.

> The throughput of the EIDE disk is quite slow (approx 1.5 MByte/sec).
> With `/sbin/hdparm -c 1 -m 16 /dev/hdc' (32 bit mode, multicount=16),
> we get a much better performance of approx 7 MByte/sec.
> 
> According to the FAQ, one should also use the hdparm-flag `-u 1'
> (unmask IRQ on), to avoid the system time running slow (this is the
> case on our system).
> Unfortunately, running `hdparm -u 1 -c 1 -m 16' slows the EIDE disk
> down to approx. 1.7 MByte/sec :-(

Yes: hdparm does report a higher read rate (using option '-t')
after setting some flags.
*BUT* simply counting seconds during a
  $ hdparm -T /dev/hda       # to avoid caching artifacts
  $ hdparm -t /dev/hda       # perform timings of device reads
on an otherwise idle system will show you that disk throughput
is not as fast as hdparm wants to tell you.
In fact, only the OS's clock runs slower during disk I/O, as you
can see if you do a
  $ clock -u -A -r; date     # '-A' if ARC console
before and after the two hdparm calls.

> Is there a possibility to get both, a fast disk throughput and a
> accurate system time?

In my opinion: no. I think it is only possible to slow down system
time, but not to get fast EIDE disk throughput.

Cheers, Stefan Schroepfer
scr@iis.fhg.de

--
To unsubscribe: send e-mail to axp-list-request@redhat.com with
'unsubscribe' as the subject.  Do not send it to axp-list@redhat.com

^ permalink raw reply	[flat|nested] 5+ messages in thread
* Problems with slow EIDE disk / slow system time
@ 1997-08-20  9:36 Stefan Illy
  0 siblings, 0 replies; 5+ messages in thread
From: Stefan Illy @ 1997-08-20  9:36 UTC (permalink / raw)


We use a 4 GByte EIDE harddisk in our PC164/21164 based system.

The throughput of the EIDE disk is quite slow (approx 1.5 MByte/sec).
With `/sbin/hdparm -c 1 -m 16 /dev/hdc' (32 bit mode, multicount=16),
we get a much better performance of approx 7 MByte/sec.

According to the FAQ, one should also use the hdparm-flag `-u 1' 
(unmask IRQ on), to avoid the system time running slow (this is the case
on our system).
Unfortunately, running `hdparm -u 1 -c 1 -m 16' slows the EIDE disk down to 
approx. 1.7 MByte/sec :-(

Is there a possibility to get both, a fast disk throughput and a 
accurate system time?

Is it possible to enable DMA or PIO mode on PC164 based systems?
(the IDE chipset on the PC164 is CMD646, but the kernel supports only
CMD640)

Is it secure to use `cron' (maybe every 5 to 10 minutes) to synchronize 
the system time with CMOS time? (the differences in time are in the order of
several seconds per minute, if there is intensive hard disk access)

Thank you very much,

Stefan

-- 
Stefan Illy
Institut fuer Technische Physik
Forschungszentrum Karlsruhe             e-mail: illy@itpgyro1.fzk.de
Postfach 3640                           phone:  (+49) 07247/82-4165
D-76021 Karlsruhe, Germany              fax:    (+49) 07247/82-2849

--
To unsubscribe: send e-mail to axp-list-request@redhat.com with
'unsubscribe' as the subject.  Do not send it to axp-list@redhat.com

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~1997-09-17 13:44 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1997-08-20 14:33 Problems with slow EIDE disk / slow system time Michal Jaegermann
  -- strict thread matches above, loose matches on Subject: below --
1997-09-17 13:44 Stefan Schroepfer
1997-09-17 13:09 Ronny Ranerup
1997-09-17 12:01 Stefan Schroepfer
1997-08-20  9:36 Stefan Illy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox