Guardian Programmer's Guide

Table Of Contents
Managing Time
Guardian Programmer’s Guide 421922-014
18 - 15
Timing in Elapsed Time and Timing in Process Time
Timing in Elapsed Time and Timing in Process
Time
This subsection describes how to start and cancel process timers and perform other
timing functions. You can time processes in elapsed time or in process time. Elapsed
time is time as measured by the CPU clock, independent of the state of any process.
Process time is the time that a process is active. That is, process time includes the
time that the process is executing, whether in user code, system code, or library code.
Process time does not include time spent by other processes acting on behalf of your
process, nor does it include time spent suspended or waiting for external events.
Software interrupts also stop the process timer, but microcode interrupts do not.
Because many processes must share the same CPU, process time and elapsed time
will usually be different. Figure 18-2 shows the difference between elapsed time and
process time.
You can use time-related operations for setting and canceling timers or for reporting
statistical data. A program that sets a timer, however, must also check for timeout; you
do this by reading a system message from the $RECEIVE file.
In typical use, you can set a timer to expire if a specific operation does not complete
within a period of elapsed time or a period of process time. You can cancel the timer if
the operation finishes in time.
An example of a timing function that gathers statistical data is finding out the total
process time for a given process.
You can use system procedure calls to perform the following time-out operations on
processes. The procedures used here work in 0.01-second units, with an accuracy of
plus or minus 0.01 of a second:
Set a timer to time out after a specific length of elapsed time (SIGNALTIMEOUT
procedure in the TNS and native environments. Use the TIMER_START_
Figure 18-2. Elapsed Time and Process Time
VST093.VSD