home *** CD-ROM | disk | FTP | other *** search
- * Program..: BNCHMK_1.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 a single dBASE
- * command.
- *
- SET TALK OFF
- DO WHILE .T.
- n1 = 1
- n2 = 0
- ?
- ? 'Enter a command to execute, or RETURN to exit:'
- ACCEPT '--> ' TO command
- IF '' = command
- SET TALK ON
- RETURN
- ENDIF
- ?
- ?
- ?
- ?
- *
- * Toggle switch algorithm...
- 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
- *
- *
- 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 command-------------------
-
- &command
-
- *----------------End of timed command---------------------
- 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_1.prg