| 1 |
'\" |
| 2 |
'\" Copyright (c) 1993 The Regents of the University of California. |
| 3 |
'\" Copyright (c) 1994-1996 Sun Microsystems, Inc. |
| 4 |
'\" |
| 5 |
'\" See the file "license.terms" for information on usage and redistribution |
| 6 |
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. |
| 7 |
'\" |
| 8 |
.TH time n "" Tcl "Tcl Built-In Commands" |
| 9 |
.so man.macros |
| 10 |
.BS |
| 11 |
'\" Note: do not modify the .SH NAME line immediately below! |
| 12 |
.SH NAME |
| 13 |
time \- Time the execution of a script |
| 14 |
.SH SYNOPSIS |
| 15 |
\fBtime \fIscript\fR ?\fIcount\fR? |
| 16 |
.BE |
| 17 |
.SH DESCRIPTION |
| 18 |
.PP |
| 19 |
This command will call the Tcl interpreter \fIcount\fR |
| 20 |
times to evaluate \fIscript\fR (or once if \fIcount\fR is not |
| 21 |
specified). It will then return a string of the form |
| 22 |
.PP |
| 23 |
.CS |
| 24 |
\fB503.2 microseconds per iteration\fR |
| 25 |
.CE |
| 26 |
.PP |
| 27 |
which indicates the average amount of time required per iteration, |
| 28 |
in microseconds. |
| 29 |
Time is measured in elapsed time, not CPU time. |
| 30 |
.SH EXAMPLE |
| 31 |
Estimate how long it takes for a simple Tcl \fBfor\fR loop to count to |
| 32 |
a thousand: |
| 33 |
.PP |
| 34 |
.CS |
| 35 |
time { |
| 36 |
for {set i 0} {$i<1000} {incr i} { |
| 37 |
# empty body |
| 38 |
} |
| 39 |
} |
| 40 |
.CE |
| 41 |
.SH "SEE ALSO" |
| 42 |
clock(n) |
| 43 |
.SH KEYWORDS |
| 44 |
script, time |
| 45 |
.\" Local Variables: |
| 46 |
.\" mode: nroff |
| 47 |
.\" End: |