Singular Manual: timer

  | ### 5.3.8 timer `Type:` int `Purpose:` 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). yields the CPU time used 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 div tps; // yields the time in seconds truncated to int
      ==> 0
        timer=0;
        system("--ticks-per-sec",1000); // set timer resolution to ms
        t=timer; // initialize t by timer
        p=(x+2y+3z+4xy+5xz+6yz)^20;
        timer-t;  // time in ms
      ==> 30
See Command line options; printlevel; rtimer; system; voice.

User manual for Singular version 4-1-2, 2019, generated by texi2html.