total CPU time used for the session
(optional) : use real to specify real time instead of cpu time
The time command returns the total CPU time used since the start of the Maple session. The units are in seconds and the value returned is a floating-point number.
The time(x) calling sequence returns the time taken to evaluate the expression x.
The time[real] command returns the real time elapsed since kernel startup, in seconds.
The time[real](x) calling sequence returns the real time used to evaluate expression x.
Note that when constructing certain data structures, Maple does some automatic simplifications. For example, Maple recognizes that the expression 3^2 can be exactly represented in its expanded form (9), and so automatically and immediately does the expansion. Since this computation is done at simplification time, and because the time() command only records CPU time elapsed during evaluation (not simplification), the expansion does not register as having taken any time.
To time particular statements or groups of statements, one method would be the following:
st := time():
... statements to be timed ...:
time() - st;
Note the use of a colon to prevent the display of an uninteresting value; it is the value time() - st which gives the desired information.
The time command is thread-safe as of Maple 15.
For more information on thread safety, see index/threadsafe.
To illustrate the difference between time elapsed including simplification of data structures, consider the following example.
The following records only the time to evaluate the expression after the data structure is already created.
The following is the same computation but it also records the time used to create the data structure.
st ≔ time⁡:31000000:time⁡−st
The following is the same computation as the one above, but records real time used instead of cpu time.
st ≔ timereal⁡:31000000:timereal⁡−st
Download Help Document