home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 2001 June
/
PCWorld_2001-06_cd.bin
/
Software
/
Vyzkuste
/
bench12
/
BENCH.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1999-04-14
|
2KB
|
84 lines
{$A+,B-,D-,E-,F-,G+,I-,L-,N-,O-,P-,Q-,R-,S-,T-,V-,X+,Y-}
{$M 65520,0,0}
uses dos;
const bsize=32768;
var
b:array[1..bsize] of byte;
s1,s2:string;
f1:file;
rep:word;
bnum,blen,btim:longint;
d2:longint;
d:searchrec;
i:longint;
label y,x;
procedure error(s:string);
begin
writeln(#10#13+s);
halt;
end;
function gtime:word;assembler;
asm
mov ax,0
int 1ah
mov ax,dx
end;
var tmv:integer;
begin
filemode:=0;
writeln('Benchmark disku v1.2 by Martin Petricek');
Writeln(' Syntaxe je BENCH <soubor k testu> [pocet opakovani]');
if paramcount=0 then s2:='*.*'else s2:=paramstr(1);
s1:=paramstr(2);
if paramcount>1 then val(s1,rep,tmv) else rep:=1;
if tmv<>0 then rep:=1;
Writeln('Pocet opakovani: ',rep);
bnum:=0;
blen:=0;
btim:=0;
FindFirst(s2,$3f,D);
while DosError = 0 do
begin
if d.attr=$10 then goto y;
s1:=d.name;
i:=gtime;
for tmv:=1 to rep do
begin
Write('Ctu: '+s1);
assign(f1,s1);
reset(f1,1);
if ioresult <> 0 then error('Nelze otevrit "'+s1+'"!');
d2:=filesize(f1);
write(', delka: ',d2);
inc(blen,d2);
inc(bnum);
x:
if d2< bsize then
begin
blockread(f1,b,d2);
if ioresult <>0 then error('Chyba pri cteni!');
end
else
begin
d2:=d2-bsize;
blockread(f1,b,bsize);
if ioresult <>0 then error('Chyba pri cteni!');
goto x;
end;
close(f1);
writeln;
end;
btim:=btim+gtime-i;
y:
FindNext(D);
end;
if bnum=0 then error('Zadny soubor nenalezen!');
Writeln('Celkovy pocet prectenych souboru:',bnum);
Writeln('Celkova velikost vsech souboru:',blen,' b');
Writeln('Cas na precteni vsech souboru:',btim /18.2:7:2,' s');
if btim <>0 then Writeln('Rychlost disku:',blen/(btim /0.0182):5:1,' KB/s')
else Writeln('Rychlost disku: Nemeritelna - Zkuste vetsi soubor')
end.