home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Software Du Jour
/
SoftwareDuJour.iso
/
BUSINESS
/
DBASE
/
DBAPG.ARC
/
BNCHMK_2.PRG
< prev
next >
Wrap
Text File
|
1984-12-17
|
3KB
|
115 lines
* Program..: BNCHMK_2.PRG
* Author...: Tom Rettig
* Date.....: May 21, 1984
* Notice...: Copyright 1984 by Ashton-Tate. All rights reserved.
* Version..: dBASE III, version 1.00, 14 Jun 1984
* Notes....: For measuring the execution time of various dBASE
* commands.
*
SET TALK OFF
DO WHILE .T.
STORE 0 TO n1, n2
?
INPUT 'Enter number of executions, RETURN to exit --> ' TO n1
*
IF n1 = 0
SET TALK ON
RETURN
ENDIF
?
?
?
?
*
* Toggle switch algorithm for setting TALK during the timing...
SET BELL OFF
@ 22, 0 SAY "Talk is set "
@ 23, 0 SAY "Press SPACE to change, or RETURN to continue."
SET COLOR TO 15/0
@ 22,12 SAY "OFF"
toggle = ' '
is_on = .F.
DO WHILE .NOT. toggle $ '?'
STORE '?' TO toggle
SET COLOR TO 0/0
@ 22,15 GET toggle
READ
CLEAR GETS
SET COLOR TO 15/0
DO CASE
CASE toggle = ' ' .AND. is_on
@ 22,12 SAY "OFF"
is_on = .F.
CASE toggle = ' ' .AND. (.NOT. is_on)
@ 22,12 SAY "ON "
is_on = .T.
ENDCASE
ENDDO
@ 23,0
IF is_on
SET TALK ON
ENDIF
SET BELL ON
SET COLOR TO 7/0
*
*--------------Initialize memvars used in timing loop---------
*--------------End initialization of memvars------------------
*
WAIT 'Press any key to START, <Ctrl-Break> to cancel...'
@ 23,0
?
? CHR(7) + 'Time started...'
*
* Get start time...
t1 = TIME()
*
* Timing loop...
DO WHILE n2 < n1
*----------------Start of timed commands-------------------
*----------------End of timed commands---------------------
n2 = n2+1
ENDDO
*
* Get end time...
t2 = TIME()
*
? CHR(7) + '***DONE***'
?
? ' hh:mm:ss'
? ' Start:', t1
? ' Finish:', t2
? ' --------'
*
* Elapsed time algorithm:
IF is_on
SET TALK OFF
ENDIF
*
* Convert start and end times to numeric seconds; es = elapsed seconds...
es = ( VAL(t2)*3600 + VAL(SUBSTR(t2,4))*60 + VAL(SUBSTR(t2,7)) ) -;
( VAL(t1)*3600 + VAL(SUBSTR(t1,4))*60 + VAL(SUBSTR(t1,7)) )
*
* Convert elapsed seconds to 'hh:mm:ss', and add leading zeros...
et = SUBSTR(STR( INT(es/3600) +100,3),2) +':'+;
SUBSTR(STR( INT(es/ 60) - ( INT(es/3600)*60 ) +100,3),2) +':'+;
SUBSTR(STR( es - ( INT(es/ 60)*60 ) +100,3),2)
*
* Based on the algorithm:
* hh = INT( es / 3600 )
* mm = INT( es / 60 ) - (hr*60)
* ss = es - (mn*60) - (hr*3600)
* et = SUBSTR(STR(hh+100,3),2) +':'+ SUBSTR(STR(mm+100,3),2) +':'+ ;
* SUBSTR(STR(ss+100,3),2)
*
*
? 'Elapsed:', et
?
ENDDO [WHILE .T.]
*
* EOF: Bnchmk_2.prg