Return the accumulated CPU time

WTSupported in traditional Synergy on Windows
WNSupported in Synergy .NET on Windows
USupported on UNIX
VSupported on OpenVMS
xcall CPUTM(time)



Returned with the accumulated CPU time. The returned value represents the number of 10 millisecond intervals (tics) accumulated. (n)


The CPUTM subroutine returns the CPU time accumulated by the current process.

On Windows, the time is elapsed time, not accumulated system time.

On UNIX, the CPU time accumulated includes CPU time for all child processes that the runtime waits for (for example, XCALL SPAWN and XCALL SHELL, but not XCALL RUNJB).

CPU time is accumulated for an entire process, not for a program or programs within the process.

The CPU time is not zeroed out at the beginning of a Synergy program. To measure the CPU time consumed by a program, you must sample the CPU time at program startup and again at the checkpoint, and then subtract the first value from the second.


CPUTM is functionally equivalent to the %CPUTIME function. We recommend you use %CPUTIME instead of CPUTM because functions are, generally speaking, more efficient.


The following example measures the time consumed by the “doit” routine.

    last        ,i4
    now         ,i4
    xcall flags(1001010, 1)
    open(1, o, "TT:")
    xcall cputm(last)    ; Get the time at startup
    xcall doit           ; Do some processing here
    xcall cputm(now)     ; Get the time at the end
    writes(1, "Elapsed time = " + %string(now - last))
    close 1