RosettaCodeData/Task/Rate-counter/BBC-BASIC/rate-counter.basic

27 lines
729 B
Plaintext

PRINT "Method 1: Calculate reciprocal of elapsed time:"
FOR trial% = 1 TO 3
start% = TIME
PROCtasktomeasure
finish% = TIME
PRINT "Rate = "; 100 / (finish%-start%) " per second"
NEXT trial%
PRINT '"Method 2: Count completed tasks in one second:"
FOR trial% = 1 TO 3
runs% = 0
finish% = TIME + 100
REPEAT
PROCtasktomeasure
IF TIME < finish% runs% += 1
UNTIL TIME >= finish%
PRINT "Rate = "; runs% " per second"
NEXT trial%
END
REM This is an example, replace with the task you want to measure
DEF PROCtasktomeasure
LOCAL i%
FOR i% = 1 TO 1000000
NEXT
ENDPROC