Measure real time
MuPAD® notebooks are not recommended. Use MATLAB® live scripts instead.
MATLAB live scripts support most MuPAD functionality, though there are some differences. For more information, see Convert MuPAD Notebooks to MATLAB Live Scripts.
a1, a2, …)
rtime() returns the real time that elapsed
since the start of the current MuPAD® session. It is measured
rtime(a1, a2, ...) returns the real time
needed to evaluate all arguments.
The result of
rtime is the real time. Thus,
be used to measure the total time spent by the MuPAD process
as well as by external processes spawned from inside the MuPAD session.
Note that an interactive call of
rtime() is not
very useful because the idle time is included. However,
a2, ...) often yields a useful and more realistic timing
time(a1, a2, ...) if the evaluation of the
arguments spawns external processes. For example, it can be useful
for measuring time for numerical computations because some routines
numeric library call external numerical
tools using hardware floats.
If there are no running external processes besides MuPAD,
the timings returned by
rtime(a1, a2, ...) and
a2, ...) roughly coincide.
On computers without “time-sharing”, such as the Macintosh computer, real time and CPU time roughly coincide.
rtime is a function of the system kernel.
rtime to compute the elapsed hours, minutes
and seconds since this session was started:
t := rtime()/1000: h := trunc(t/3600): m := trunc(t/60 - h*60): s := trunc(t - m*60 - h*3600):
print(Unquoted, "This session is running for " . h . " hours, " . m . " minutes and " . s . " seconds.")
This session is running for 0 hours, 0 minutes and 10 seconds.
delete t, h, m, s:
Arbitrary MuPAD objects
Nonnegative integer giving the elapsed time in milliseconds.