this some tests with timings:
goes up to 200 frames and more eg 1000 calculates itself
Code: Select all
@echo off
setlocal enabledelayedexpansion
prompt $g$s
:setCheckframes
set /a Frames = %1 &:: soll je sekunde
if !frames! lss 1 set /a Frames = 5
set frames
set /a Stops =20 &:: 10251 mit 2 Runden = 50 Hertz
set /a Rounds =frames *2
if !rounds! gtr 50 set /a rounds =10
set /a kFrames =0 ,x =0 ,loops =0 ,n=0
set "permille= x "
@rem :: @ &rem :: to many
@rem :: set /a /1 2>nul &rem :: 770 5-fps (1x 22% ) &rem :: 390 5-fps (2x 22%) (CPU)
@rem :: "Kein Befehl" 2>nul &rem :: 145 5-fps (1x 23% )
:Checkframes
:: reale milliseconds
set /a "StrTime = 1000 *(60*(60*(!time:~-11,2! %%24) +60!time:~-8,2! %%60) +60!time:~-5,2! %%60) +100!time:~-2!0 %%1000"
set /a "t = !time:~-4,1!"
:echo %strtime%
for /L %%i in (1 1 %rounds%) do (for /L %%N in (0 1 %stops%) do rem comment
) & (
set /a x+=1 &<nul set /p =.&if !t! neq !time:~^-4^,1! title !time! frames: !x! per second !permille!/1000 !stops! .&set /a "t=!time:~-4,1! ,x=0"
)
set /a "EndTime = 1000 *(60*(60*(!time:~-11,2! %%24) +60!time:~-8,2! %%60) +60!time:~-5,2! %%60) +100!time:~-2!1 %%1000"
:echo on
set /a ms = (EndTime +86400000) %% 86400000 - StrTime
set /a stops = stops *1000 *rounds /ms /frames ,permille = frames *ms /rounds
rem some tests
:: rem smooth ovr 0,3 sek ; max x %
:if defined chkone if ms lss 300 set /a rounds = frames *ms /permille
:: rem small unr 2 sek
::if !stops! lss 1 set /a rounds = rounds *1000 /permille, stops =stops + stops /rounds +1
:if !stops! gtr !rounds! if !permille! gtr 1100 set /a rounds = rounds *1000 /permille, stops =stops - stops /rounds +1
:nostops
if !perMille! neq 1000 goto :Checkframes
set /a loops +=1
if !loops! lss 10 goto :Checkframes
echo(
pause
exit /b
and for other tests
Code: Select all
@echo off & setlocal EnableDelayedExpansion
rem Reference test
rem 35.3365
echo ERROR x ca 3.500
set t0=%time%
For /L %%i in (1,1,3534) do set /a /1 2>nul
call :difftime "%t0%" "%time%" t1
rem ::::::::::::::::::::::::::::::::::::::::
rem 813.0081
Echo Komment x ca 81.300
set t0=%time%
For /L %%i in (1,1,81301) do rem this is a comment
call :difftime "%t0%" "%time%" t2
rem ::::::::::::::::::::::::::::::::::::::::
rem 1267.4271
Echo rem x ca 126.700
set t0=%time%
For /L %%i in (1,1,126742) do rem
call :difftime "%t0%" "%time%" t3
rem ::::::::::::::::::::::::::::::::::::::::
rem 4807.6923
echo @ x ca 480.800
set t0=%time%
For /L %%i in (1,1,480769) do @
call :difftime "%t0%" "%time%" t4
rem ::::::::::::::::::::::::::::::::::::::::
rem 5.8139
echo KEIN Befehl x ca 580
set t0=%time%
For /L %%i in (1,1,581) do "kein befehl" 2>nul
call :difftime "%t0%" "%time%" t5
rem :::::::::::::::::::::::::::::::::::::::
echo ping -n 1 x 22
set t0=%time%
for /L %%i in (1 1 22) do ping -n 1 localhost >nul
call :difftime "%t0%" "%time%" t6
rem :::::::::::::::::::::::::::::::::::::::
echo ping -n 2
set t0=%time%
for /L %%i in (1 1 1) do ping -n 2 localhost >nul
call :difftime "%t0%" "%time%" t7
rem calculate percent
set /a p1=100-t1*100/t2
echo %t1% is %p1%%% more speed than %t2%
set /a p1=100-t1*100/t3
echo %t1% is %p1%%% more speed than %t3%
set /a p1=100-t1*100/t4
echo %t1% is %p1%%% more speed than %t4%
set /a p1=100-t1*100/t5
echo %t1% is %p1%%% more speed than %t5%
set /a p1=100-t1*100/t6
echo %t1% is %p1%%% more speed than %t6%
set /a p1=100-t1*100/t7
echo %t1% is %p1%%% more speed than %t7%
exit /b
:difftime
setlocal
set t0=%~1
set t1=%~2
for /F "tokens=1-8 delims=:.," %%a in ("%t0: =0%:%t1: =0%") do set /a "a=(((1%%e-1%%a)*60)+1%%f-1%%b)*6000+1%%g%%h-1%%c%%d, a+=(a>>31) & 8640000"
echo %t0% - %t1% elapsed %a% cs
endlocal & set %3=%a%
exit /b