How do I time a script?

Hello!

Is there any way that I can time the duration of an applescript subroutine? I’m looking for a way of timing a selection of filesystem events running one after another as part of a network performance testing suite.

If it could return the time duration as a variable, all the better.

Thanks in advance! :slight_smile:

Model: Powerbook Titanium 800
Browser: Firefox 1.0.3
Operating System: Mac OS X (10.4)


set StartTime to current date
MySubroutine()--Example handler
set EndTime to current date
set SubRoutineTimeDuration to (EndTime - StartTime)

on MySubroutine()
	read (choose file)
end MySubroutine

Get the date, run the routine, and get the date again. Subtract end time to start time to get duration. The return is in seconds. Here is a post on returning fractions of seconds:
http://bbs.applescript.net/viewtopic.php?id=13445
SC

That’s fantastic!

Thanks for your help!! :slight_smile: