www.ClassicTW.com
http://classictw.com/

Timers for V1 CPC
http://classictw.com/viewtopic.php?f=15&t=33054
Page 1 of 1

Author:  Kaus [ Thu Mar 15, 2012 6:10 pm ]
Post subject:  Timers for V1 CPC

In reference to: viewtopic.php?f=52&t=33014
--------------------------------------
Here is the code I used, for any scripters that want to adapt it to there own command set. I'd be happy to help anyone in regards to capturing there favorite dynamic or set of dynamics once I get my V1 re-installed (VMWARE) for testing purposes.

Many thanks to Dynarri for guidance in the below scripts as well as testing various aspects of TWGS timings throughout the last 3 or so years.
------------------------------------

Advanced command set test
Code:
setVar $file GAMENAME & "_Seconds.txt"
send "tnt1*cb20000*y"
getTimer $startTicks
Waitfor "Command [TL=00:00:00]:[20000]"
#SetVar $TargetMac " n * m" & "5501" & "* a " & "60000" & " * * f  z  1  *  z  c  d  *  < r z a " & "60000" & " * n n * m z " & "4918" & "*yy* "
#SetVar $TargetMac "n*mz" & "5501" & "*nn*za" & "60000" & "**fz1*zcd*<rza" & "60000" & "*nn*mz" & "4918" & "*yy*"
#SetVar $TargetMac "m5501z*z*za60z*z*f1z*cdz*<nnz*m4918z*yyz*"
SetVar $TargetMac "z*z*mz5501z*za60000*z*fz1z*zcdz*<rza60000z*nnz*mz4918z*yyz*"

Send $TargetMac
Waitfor "Command [TL=00:00:00]:[4918]"
getTimer $stopTicks
setVar $durationTicks ($stopTicks - $startTicks)
setPrecision 18
setVar $seconds ($durationTicks / 2000000000)
setPrecision 0
echo ANSI_15 & "**Time lapse in Seconds: " $seconds "*"
send "l2*"
Write $file $seconds & " 99 CPC overload on Z buffering v2"

----------
Colonizer Timer

Code:
#-------------INT Variables--------------
SetVar $Idx 1
setVar $file GAMENAME & "_Seconds.txt"
Delete $file
#------------Check to see if we can start-----
:LetsGo
Gettime $StartDaTest
ReplaceText $StartDaTest ":" " "
Getword $StartDaTest $Started 2
SetDelaytrigger EMCPU :EMCPU 100
pause

:EMCPU
Gettime $StartDaTest
ReplaceText $StartDaTest ":" " "
Getword $StartDaTest $Started2 2

If ($Started = $Started2)
Echo ANSI_15 "* Waiting to go!"
  goto :LetsGo
End
Echo ANSI_12 "* Started The Test!!!!"


GetTime $StartedTest

Gettime $Stop
Replacetext $Stop ":" " "
Getword $Stop $Stoploop 2

#--Change this variable to increase time of test---
Add $Stoploop 10

#------------While Start-------------------
While ($whileloop < $stoploop)
:Start
Send "L 1 * "
Waitfor "There are currently"
Getword CURRENTLINE $Timed 4
Send "q"
Send "L 1 * "
Waitfor "There are currently"
Getword CURRENTLINE $Timed2 4

If ($Idx = 1)
SetVar $StartColo $Timed
end

Send "q"
If ($Timed = $Timed2)
goto :Start
  else
   goto :Cont
end

:Cont
If ($Timed <> $Timed2)
Gettime $start s:zzz
SetVar $Timed3 ($Timed2+1)
While ($Timed2 <= ($Timed3))
  Send "L 1 * "
   Waitfor "There are currently"
   Getword CURRENTLINE $Timed2 4
  Send "q"
end
Gettime $stop s:szzz
end

Replacetext $Start ":" " "
Replacetext $Stop ":" " "

Getword $start $SecTimer 1
Getword $start $MilliSecTimer 2
Getword $stop $SecTimer2 1
Getword $stop $MilliSecTimer2 2

setVar $SecDuration ($SecTimer2 - $SecTimer)
SetVar $MilliSecDuration ($MilliSecTimer2 - $MilliSecTimer)
Divide $SecDuration 2
Divide $MilliSecDuration 2
Write $file "Time lapsed " & $SecDuration & ":"  & $MilliSecDuration
Add $Idx 1

GetTime $Check
Replacetext $check ":" " "
Getword $Check $Whileloop 2
END

#-------------Ended While Loop Spit out the Results---------------------
SetVar $StopColo $Timed2
GetTime $EndedTest
echo ANSI_15 "* " ($StopColo - $StartColo) " :Total Colos Regened" "*"
echo ANSI_12 "*" $StartedTest "*" $EndedTest
Halt

----------------------------
Basic command test
Code:
setVar $file GAMENAME & "_Seconds.txt"
SetVar $MAC "#cf1*2*f2*1*f1*2*@q"
Send $Mac
Waitfor "Who's Online"
getTimer $startTicks
Waitfor "Average Interval Lag:"
getTimer $stopTicks
setVar $durationTicks ($stopTicks - $startTicks)
setPrecision 18
setVar $seconds ($durationTicks / 2000000000)
setPrecision 0
echo ANSI_15 & "**Time lapse in Seconds: " $seconds "*"
Send "*"
Write $file $seconds & " 99 CPC Basic CF Macro " & $MAC


Attachments:
ColoTimer2.ts [2.01 KiB]
Downloaded 622 times
CPCTest.ts [870 Bytes]
Downloaded 662 times
CPCcfTest.ts [438 Bytes]
Downloaded 636 times

Author:  Helix [ Thu Mar 15, 2012 6:20 pm ]
Post subject:  Re: Timers for V1 CPC

Excellent work. I have v1.03 set up in a VM with the exact same settings as my v2.x vm server.

I am running 2 WinXPsp3 vmware machines with 8gig hdds on a windows 7 64 bit machine with 8gigs of ram.

How many cycles should we be running for each test? 100? 1000? more?

H

Author:  John Pritchett [ Thu Mar 15, 2012 6:39 pm ]
Post subject:  Re: Timers for V1 CPC

Well, the balance is getting enough cycles that you get an accurate average time, but not so much that it takes too long to run a single test. These things run fast enough that I'd think thousands would be fast and still give good statistical results.

Author:  Kaus [ Thu Mar 15, 2012 6:41 pm ]
Post subject:  Re: Timers for V1 CPC

Helix wrote:
Excellent work. I have v1.03 set up in a VM with the exact same settings as my v2.x vm server.

I am running 2 WinXPsp3 vmware machines with 8gig hdds on a windows 7 64 bit machine with 8gigs of ram.

How many cycles should we be running for each test? 100? 1000? more?

H


That really depends on your desired sample size. When Dynarri and I were testing for advanced script design we ran usually about 100. Youll start to see patterns after about 10, imo the third routine is the most solid and one of my later revisions. Whereas the second routine shows a good set for timing, and the first works but if i was to rewrite it i would use @ instead of a sector #.

Adapt as needed.

Author:  John Pritchett [ Thu Mar 15, 2012 6:43 pm ]
Post subject:  Re: Timers for V1 CPC

I think this is obvious, but just in case, these timings should be measured on a local connection, because we don't want to factor in connection speeds. I don't think CPU speed is that important, but it's probably best to use a machine that's pretty standard for the last year or two as opposed to something out dated or top of the line today.

Page 1 of 1 All times are UTC - 5 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/