Measure CPU time
This functionality does not run in MATLAB.
a1, a2, …)
time() returns the total CPU time that was
spent by the current MuPAD® process. It is measured in in milliseconds.
time(a1, a2, ...) returns the CPU time needed
by the current MuPAD process to evaluate all arguments.
The result of
time() comprises all computation
time spent by the MuPAD process. This includes the time for system
initialization and reading input (parsing). However, it excludes the
time spent by other external processes, even if they were spawned
from inside the MuPAD session or if they were started by a
system command. Further,
in an interactive session, the idle time between the execution of MuPAD commands
If there are no running external process besides MuPAD,
the timings returned by
rtime(a1, a2, ...) and
a2, ...) roughly coincide.
The time returned by
time is computed in
a system-dependent way, usually counting the number of clock ticks
of the system clock. Hence, the result is a multiple of the system's
time unit and cannot be more precise than one such unit. The time
unit is 10 milliseconds for many UNIX® systems.
On computers without "time-sharing", such as the Macintosh computer, real time and CPU time roughly coincide.
time is a function of the system kernel.
Do a time measurement and assign the computed value to an identifier at the same time. Note that the assignment needs extra parenthesis when passed as argument:
time((a := int(exp(x)*sin(x), x)))
Alternatively, measure time for groups of statements as follows:
t0 := time(): command1 command2 ... time() - t0
To obtain a more convenient output, multiply the measured time by the appropriate time unit:
time(isprime(2^1000000000 - 1))*unit::msec
stringlib::formatTime(time(isprime(2^1000000000 - 1)))
Arbitrary MuPAD objects
Nonnegative integer giving the elapsed time in milliseconds.