Author Message

Hello

I wanted to check how fast my computer reads and writes to the disk. I
wrote a small program which first writes a file with blockwrite and then
reads the file with blockread. To get the time I used gettime.

The result is stunning! Too good to be believable, about 100 MB /sec.
:-) I have tried to "debug" the code 100 times, without result... It is
actually fast because the program creates a very big file in a short
time. But I don't trust it.

I would really appreciate some help/thoughts.

/Tobz

If you want to look at my code:

procedure skriv_las_hastighet(var skriv, las : double; antal_ganger64k :
integer);
var
fil_p : file;
p : pointer;
h,min,sec,hund : word;
a : real;
index : integer;
begin
assign(fil_p,'data.tmp');
rewrite(fil_p,1);
getmem(p,64000);

gettime(h,min,sec,hund);
a:=(h*60*60*100)+(min*60*100)+(sec*100)+(hund);
for index:=1 to antal_ganger64k do
blockwrite(fil_p,mem[seg(p^):ofs(p^)],64000);

gettime(h,min,sec,hund);
skriv:=(h*60*60*100)+(min*60*100)+(sec*100)+(hund)-a;

reset(fil_p,1);
gettime(h,min,sec,hund);
a:=(h*60*60*100)+(min*60*100)+(sec*100)+(hund);
for index:=1 to antal_ganger64k do

gettime(h,min,sec,hund);
las:=(h*60*60*100)+(min*60*100)+(sec*100)+(hund)-a;

close(fil_p);
end;

Wed, 18 Jun 1902 08:00:00 GMT
Quote:

> I wanted to check how fast my computer reads and writes to the disk. I
> wrote a small program which first writes a file with blockwrite and then
> reads the file with blockread. To get the time I used gettime.

> The result is stunning! Too good to be believable, about 100 MB /sec.
> :-) I have tried to "debug" the code 100 times, without result... It is
> actually fast because the program creates a very big file in a short
> time. But I don't trust it.

It seems that you tested the disk cache of your computer. :-)
Btw:
reset(fil_p,1);
must be replaced by
Seek(fil_p,0);
--
Franz Glaser, Glasau 3, A-4191 Vorderweissenbach Austria +43-7219-7035-0
Muehlviertler Elektronik Glaser.  Industrial control and instrumentation

http://www.geocities.com/~franzglaser/ http://members.xoom.com/f_glaser/

Wed, 18 Jun 1902 08:00:00 GMT

Quote:

>The result is stunning! Too good to be believable, about 100 MB /sec.
>:-) I have tried to "debug" the code 100 times, without result... It is
>actually fast because the program creates a very big file in a short
>time. But I don't trust it.
>I would really appreciate some help/thoughts.

Clearly your data was cached in some way. Perhaps you're running the
programs under windows? Perhaps you are running a disk cache program
under DOS? You should go to a DOS environment, without disk caches, if
you really want to test diskspeed this way. However, your test will be
incomplete since you'll be testen old 16-bit disk access only.

Perhaps you should modify your test program; use something which
hasn't been read, or just written, for the read test. Even better;
access the disk at a lower level (although Windows will complain if
you try that).

A better way to compare disk speed is to simply duplicate a file of
250 MB on the (defragmented) disk and time it using a stopwatch. :-)
(it's too big for a cache, and you'll be reading & writing).

Peter de Jong

Wed, 18 Jun 1902 08:00:00 GMT

Quote:

> I wanted to check how fast my computer reads and writes to the disk. I
> wrote a small program which first writes a file with blockwrite and then
> reads the file with blockread. To get the time I used gettime.

> The result is stunning! Too good to be believable, about 100 MB /sec.
> :-) I have tried to "debug" the code 100 times, without result... It is
> actually fast because the program creates a very big file in a short
> time. But I don't trust it.

The data you have written to the disk is still in the cache when you read it
again, that's why you get such a high data transfer rate. I don't know what
you are measuring, but certainly not the disk speed.

Wed, 18 Jun 1902 08:00:00 GMT

Quote:

> The result is stunning! Too good to be believable, about 100 MB /sec.
> :-) I have tried to "debug" the code 100 times, without result... It is
> actually fast because the program creates a very big file in a short
> time. But I don't trust it.

You didn't mention what Pascal you're using, but if it's a dos/real mode
one, the trouble may be your 'integer's.  If they're short int, just maybe
they're wrapping...

That is, if it wasn't the disk cache problem :)

Steve

Wed, 18 Jun 1902 08:00:00 GMT

 Page 1 of 1 [ 5 post ]

Relevant Pages