View unanswered posts | View active topics It is currently Mon Apr 20, 2026 11:18 pm



Reply to topic  [ 2 posts ] 
 TIMER 
Author Message
Gameop
User avatar

Joined: Mon Jan 26, 2009 12:27 am
Posts: 123
Unread post 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.

_________________
Dodger known as Yop Solo, Sysop
twgsdodgerbbs.ath.cx
http://cyberquebec.ca/_layout/?uri=http://cyberquebec.ca/twgsdodgerbbs/


Mon Mar 30, 2009 11:40 pm
Profile
Commander
User avatar

Joined: Fri Jun 09, 2006 2:00 am
Posts: 1401
Location: Canada
Unread post 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

_________________
----------------------------
-= QUANTUM Computing 101: 15 = 3 x 5 ... 48% of the time.


Tue Mar 31, 2009 5:17 am
Profile ICQ YIM
Display posts from previous:  Sort by  
Reply to topic   [ 2 posts ] 

Who is online

Users browsing this forum: No registered users and 12 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by wSTSoftware.