<p>I want to see how long a function takes to run. What's the easiest way to do this in PLT-Scheme? Ideally I'd want to be able to do something like this:</p>

<pre><code>&gt; (define (loopy times)
  (if (zero? times)
      0
      (loopy (sub1 times)))) 
&gt; (loopy 5000000)
0                      ;(after about a second)
&gt; (timed (loopy 5000000))
Took: 0.93 seconds
0
&gt; 
</code></pre>

<p>It doesn't matter if I'd have to use some other syntax like <code>(timed loopy 5000000)</code> or <code>(timed '(loopy 5000000))</code>, or if it returns the time taken in a cons or something.</p>

Found it...
From the
online documentation
:
```
(time-apply proc arg-list)
```
invokes the procedure proc with the arguments in arg-list. Four values are returned: a list containing the result(s) of applying proc, the number of milliseconds of CPU time required to obtain this result, the number of ``real'' milliseconds required for the result, and the number of milliseconds of CPU time (included in the first result) spent on garbage collection.
Example usage:
```
```
> (time-apply loopy '(5000000))
(0)
621
887
0
```
```