How to get execution time of an AppleScript?
Here is one AppleScript solution that you may be interested in.
set startTime to current date

-- Your Code Here

set timeTaken to ((current date) - startTime as string) &amp; &quot; Seconds&quot;

activate
display alert &quot;Script Timer&quot; message &quot;Running This Code Took &quot; &amp; ¬
    timeTaken buttons {&quot;OK&quot;} giving up after 5

This is just a general solution which will return the value in seconds (whole).  This will not return fractions of seconds.