+ -B added to get timing info

git-svn-id: trunk@8618 -
This commit is contained in:
florian 2007-09-23 14:36:26 +00:00
parent 4cd15058df
commit f1d131ab83
3 changed files with 56 additions and 2 deletions

1
.gitattributes vendored
View File

@ -7229,6 +7229,7 @@ tests/units/popuperr.pp svneol=native#text/plain
tests/units/win32err.pp svneol=native#text/plain
tests/utils/Makefile svneol=native#text/plain
tests/utils/Makefile.fpc svneol=native#text/plain
tests/utils/bench.pp svneol=native#text/plain
tests/utils/dbdigest.pp svneol=native#text/plain
tests/utils/dbtests.pp svneol=native#text/plain
tests/utils/digest.pp svneol=native#text/plain

39
tests/utils/bench.pp Normal file
View File

@ -0,0 +1,39 @@
{
This file is part of the Free Pascal test suite.
Copyright (c) 1999-2002 by the Free Pascal development team.
This program makes the compilation and
execution of individual test sources.
See the file COPYING.FPC, included in this distribution,
for details about the copyright.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
**********************************************************************}
{$mode objfpc}
unit bench;
interface
function GetMicroSTicks : int64;
implementation
uses
sysutils;
function GetMicroSTicks : int64;
var
h,m,s,s1000 : word;
begin
decodetime(time,h,m,s,s1000);
result:=(int64(h)*3600000+int64(m)*60000+int64(s)*1000+int64(s1000))*1000;
end;
end.

View File

@ -22,7 +22,8 @@ uses
{$endif}
teststr,
testu,
redir;
redir,
bench;
{$ifdef go32v2}
{$define LIMIT83FS}
@ -75,6 +76,7 @@ const
DoAll : boolean = false;
DoUsual : boolean = true;
TargetDir : string = '';
BenchmarkInfo : boolean = false;
ExtraCompilerOpts : string = '';
DelExecutable : boolean = false;
RemoteAddr : string = '';
@ -692,17 +694,22 @@ var
TestRemoteExe,
TestExe : string;
execres : boolean;
EndTicks,
StartTicks : int64;
function ExecuteRemote(const prog,args:string):boolean;
begin
Verbose(V_Debug,'RemoteExecuting '+Prog+' '+args);
StartTicks:=GetMicroSTicks;
ExecuteRemote:=ExecuteRedir(prog,args,'',EXELogFile,'stdout');
EndTicks:=GetMicroSTicks;
end;
function ExecuteEmulated(const prog,args:string):boolean;
begin
Verbose(V_Debug,'EmulatorExecuting '+Prog+' '+args);
StartTicks:=GetMicroSTicks;
ExecuteEmulated:=ExecuteRedir(prog,args,'',FullExeLogFile,'stdout');
EndTicks:=GetMicroSTicks;
end;
begin
@ -756,10 +763,12 @@ begin
{$I+}
ioresult;
{ don't redirect interactive and graph programs }
StartTicks:=GetMicroSTicks;
if Config.IsInteractive or Config.UsesGraph then
execres:=ExecuteRedir(CurrDir+SplitFileName(TestExe),'','','','')
else
execres:=ExecuteRedir(CurrDir+SplitFileName(TestExe),'','',FullExeLogFile,'stdout');
EndTicks:=GetMicroSTicks;
{$I-}
ChDir(OldDir);
{$I+}
@ -768,6 +777,10 @@ begin
{ Error during execution? }
Verbose(V_Debug,'Exitcode '+ToStr(ExecuteResult));
if BenchmarkInfo then
begin
Verbose(V_Normal,'Execution took '+ToStr(EndTicks-StartTicks)+' us');
end;
if (not execres) and (ExecuteResult=0) then
begin
AddLog(FailLogFile,TestName);
@ -833,6 +846,7 @@ var
writeln('dotest [Options] <File>');
writeln;
writeln('Options can be:');
writeln(' -B output benchmark information');
writeln(' -C<compiler> set compiler to use');
writeln(' -V verbose');
writeln(' -E execute test also');