| www.ClassicTW.com https://mail.black-squirrel.com/ |
|
| TIMER https://mail.black-squirrel.com/viewtopic.php?f=15&t=21748 |
Page 1 of 1 |
| Author: | Yop_Solo [ Mon Mar 30, 2009 11:40 pm ] |
| Post subject: | TIMER |
Could someone give me the command to set a timer that can count from 0 to illimited... So I will be able to add it in my script to know how long the script take to run all. |
|
| Author: | LoneStar [ Tue Mar 31, 2009 5:17 am ] |
| Post subject: | Re: TIMER |
getTimer Purpose: Retrieves the Time Stamp Counter (RDTSC), which is the number of CPU ticks since power on. Syntax: getTimer var var: A variable to hold the tick count. Notes: The result of this command is a 64-bit Integer. To measure the duration of an event in seconds, you will need to know the CPU speed in Hz. To simply compare routines to see which is faster, there is no reason to do the conversion to seconds. Merely get the duration for the first routine, then for the second routine, and whichever has the smaller number of Ticks for the interval is the faster routine. Example: Code: getTimer $startTicks # Perform some routine here getTimer $stopTicks setVar $durationTicks ($stopTicks - $startTicks) # Now divide by CPU Hz if you need to convert Ticks to seconds. (2.2 GHz here) # You will need to set the precision according to your desired accuracy, before dividing. setPrecision 18 setVar $seconds ($durationTicks / 2200000000) setPrecision 0 echo "*Time lapse in Seconds: " $seconds "*" As taken from the script.html included with TWX Proxy |
|
| Page 1 of 1 | All times are UTC - 5 hours |
| Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |
|