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

46 lines
1.4 KiB
Plaintext

html "<table bgcolor=wheat border=1><tr><td align=center colspan=2>Rate Counter</td></tr>
<tr><td>Run Job Times</td><td>"
textbox #runTimes,"10",3
html "</tr><tr><td align=center colspan=2>"
button #r,"Run", [runIt]
html " "
button #a, "Average", [ave]
html "</td></tr></table>"
wait
[runIt]
runTimes = min(10,val(#runTimes contents$()))
count = count + 1
print "-------- Run Number ";count;" ----------------"
print "Run jobs";runTimes;" times, reporting each"
for i = 1 to runTimes
' -----------------------------------------------------------------
' Normally we use a RUN() command to run another program
' but for test pruporse we have a routine that simply loops a bunch
' -----------------------------------------------------------------
begTime = time$("ms")
theRun = bogusProg()
endTime = time$("ms")
lapsTime = endTime - begTime
print "Job #";i;" Elapsed time, ms ";lapsTime;" ";1000/lapsTime; " ticks per second"
next
aveTime = (endTime-startTime)/runTimes
totAveTime = totAveTime + aveTime
print "Average time, ms, is ";aveTime;" "; 1000/((endTime-startTime)/runTimes); " ticks per second"
wait
[ave]
print "---------------------------------"
print "Total average time:";aveTime/count
function bogusProg()
for i = 1 to 10000
sini = sini + sin(i)
tani = tani + tan(i)
cpsi = cosi + cos(i)
next
end function