Guardian Programmer's Guide

Table Of Contents
Managing Time
Guardian Programmer’s Guide 421922-014
18 - 19
Timing Your Process
Timing Your Process
To find out how much processing time your process has used, you can call the
MYPROCESSTIME procedure. This procedure returns the number of microseconds
that the process has been active. For example:
FIXED PROCESS^TIME;
.
.
PROCESS^TIME := MYPROCESSTIME;
Timing Another Process
To find out how much processing time has been used by a process other than your
own, you can use the PROCESS_GETINFO_ procedure and supply the
process-time parameter. This procedure returns the time in microseconds. For
example:
FIXED PROCESS^TIME;
.
.
ERROR := PROCESS_GETINFO_(PROCESS^HANDLE,
!file^name:maxlen!,
!file^name^len!,
!priority!,
!moms^processhandle!,
!hometerm:maxlen!,
!hometerm^len!,
PROCESS^TIME);
The procedure returns information about the process identified by the
process-handle parameter. If the process handle is zero or omitted, then the
procedure returns information about the current process.
For details about process handles, refer to Section 16, Creating and Managing
Processes.
Converting Process Time Into a Readable Form
You can use the CONVERTPROCESSTIME procedure to convert a 64-bit process-
time period returned from a call to MYPROCESSTIME or PROCESS_GETINFO_ into
a number of hours, minutes, seconds, milliseconds, and microseconds.
The following example converts a 64-bit representation of a period of time:
FIXED PROCESS^TIME;
.
.
PROCESS^TIME := MYPROCESSTIME;
CALL CONVERTPROCESSTIME(PROCESS^TIME,HOURS,MINUTES,SECONDS,
MILLISECONDS,MICROSECONDS);