[Next][Prev] [Right] [Left] [Up] [Index] [Root]
Return the CPU time (as a real number of default precision)
used since the beginning of the Magma session.
Note that for the MSDOS version, this is the real time used
since the beginning of the session (necessarily, since
process CPU time is not available).
Return the CPU time (as a real number of default precision)
used since time t. Time starts at 0.0 at the beginning
of a Magma session.
Return the absolute real time (as a real number of default precision),
which is the number of seconds since 00:00:00 GMT, January 1, 1970.
For the MSDOS version, this is the real time used
since the beginning of the session.
Return the real time (as a real number of default precision)
elapsed since time t.
Execute the statement and print the time taken when the statement is
completed.
vtime flag, n: statement:
If the verbose flag flag (see the function SetVerbose)
has a level greater than or equal to n, execute the statement and print
the time taken when the statement is completed. If the flag has
level 0 (i.e., is not turned on), still execute the statement, but
do not print the timing. In the first form of this statement, where
a specific level is not given, n is taken to be 1.
This statement is useful in Magma code
found in packages
where one wants to print the timing of some sub-algorithm if and only if
an appropriate verbose flag is turned on.
The time command can be used to time a single statement.
> n := 2^109-1;
> time Factorization(n);
[<745988807, 1>, <870035986098720987332873, 1>]
Time: 0.149
Alternatively, we can extract the current time t and use Cputime.
This method can be used to time the execution of several statements.
> m := 2^111-1;
> n := 2^113-1;
> t := Cputime();
> Factorization(m);
[<7, 1>, <223, 1>, <321679, 1>, <26295457, 1>, <319020217, 1>, <616318177, 1>]
> Factorization(n);
[<3391, 1>, <23279, 1>, <65993, 1>, <1868569, 1>, <1066818132868207, 1>]
> Cputime(t);
0.121
We illustrate a simple use of vtime with vprint within a function.
> function MyFunc(G)
> vprint User1: "Computing order...";
> vtime User1: o := #G;
> return o;
> end function;
> SetVerbose("User1", 0);
> MyFunc(Sym(4));
24
> SetVerbose("User1", 1);
> MyFunc(Sym(4));
Computing order...
Time: 0.000
24
[Next][Prev] [Right] [Left] [Up] [Index] [Root]