Top
Back: 5.3.7 short
Forward: 5.3.9 TRACE
FastBack: 5. Functions and system variables
FastForward: 6. Tricks and pitfalls
Up: 5.3 System variables
Top: Singular 2-0-4 Manual
Contents: Table of Contents
Index: F. Index
About: About This Document

5.3.8 timer

Type:

int

Purpose:
  1. the CPU time (i.e, user and system time) used for each command is printed if timer >0 , if this time is bigger than a (customizable) minimal time and if printlevel+1 >= voice (which is by default true on the SINGULAR top level, but not true while procedures are executed).
  2. yields the used CPU time since the start-up of SINGULAR in a (customizable) resolution.

The default setting of timer is 0, the default minimal time is 0.5 seconds, and the default timer resolution is 1 (i.e., the default unit of time is one second). The minimal time and timer resolution can be set using the command line options --min-time and --ticks-per-sec and can be checked using system("--min-time") and system("--ticks-per-sec").

How to use timer in order to measure the time for a sequence of commands, see example below.

Note for Windows95/98:

The value of the timer cannot be used (resp. trusted) when SINGULAR is run under Windows95/98 (this is due to the shortcomings of the Windows95/98 operating system). Use rtimer, instead.

Example:
 
  timer=1; // The time of each command is printed
  int t=timer; // initialize t by timer
  ring r=0,(x,y,z),dp;
  poly p=(x+2y+3z+4xy+5xz+6yz)^20;
  // timer as int_expression:
  t=timer-t;
  t;  // yields the time in ticks-per-sec (default 1)
→ 0
      // since t was initialized by timer
  int tps=system("--ticks-per-sec");
  t/tps; // yields the time in seconds truncated to int
→ 0

See Command line options; printlevel; rtimer; system; voice.


Top Back: 5.3.7 short Forward: 5.3.9 TRACE FastBack: 5. Functions and system variables FastForward: 6. Tricks and pitfalls Up: 5.3 System variables Top: Singular 2-0-4 Manual Contents: Table of Contents Index: F. Index About: About This Document
            User manual for Singular version 2-0-4, October 2002, generated by texi2html.