get_task_accounting

Returns information about when a task was created and the amount of time the task has run.

See also:rq_system accounting to enable tracking of such information

Syntax, PL/M and C

CALL rq_get_task_accounting (target_task, info_ptr, reset_opt,
except_ptr);

rq_get_task_accounting (target_task, info_ptr, reset_opt,
except_ptr);

Parameter PL/M Data Type C Data Type
target_task SELECTOR SELECTOR
info_ptr POINTER TASK_ACCOUNTING_STRUCT far *
reset_opt BYTE UINT_8
except_ptr POINTER to WORD_16 UINT_16 *

Parameters

target_task
The token for the task for which to return accounting information.

info_ptr
A pointer to the following structure declared by the application, where the call returns information.

DECLARE task_accounting_struct STRUCTURE (
owner_jobSELECTOR,
next_taskSELECTOR,
accounting_stateWORD_16,
usecs_per_tickWORD_16,
create_time_loWORD_32,
create_time_hiWORD_32,
elapsed_time_loWORD_32,
elapsed_time_hiWORD_32,
total_ticks_since_call_loWORD_32,
running_ticks_since_call_loWORD_32,
total_running_ticks_loWORD_32,
total_running_ticks_hiWORD_32);

or

typedef struct {
SELECTORowner_job;
SELECTORnext_task;
UINT_16accounting_state;
UINT_16usecs_per_tick;
UINT_32create_time_lo;
UINT_32create_time_hi;
UINT_32elapsed_time_lo;
UINT_32elapsed_time_hi;
UINT_32total_ticks_since_call_lo;
UINT_32running_ticks_since_call_lo;
UINT_32total_running_ticks_lo;
UINT_32total_running_ticks_hi;
} TASK_ACCOUNTING_STRUCT;

Where:

owner_jobToken for the job containing the target task.

next_taskNext task on the system task list, which allows easy scanning of all the tasks in the system.

accounting_state
If 0, only the fields up through usecs_per_tick are valid. If non-zero, all fields in the structure are valid.

usecs_per_tick
The number of microseconds that each Kernel tick represents.

create_time_lo
The low 32 bits of the target task’s creation time.

create_time_hi
The high 32 bits of the target task’s creation time.

elapsed_time_lo
The low 32 bits of the time that has elapsed since the target task was created.

elapsed_time_hi
The high 32 bits of the time that has elapsed since the target task was created.

total_ticks_since_call_lo
The low 32 bits of the elapsed time since the last call to rq_get_task_accounting for this task, as measured in Kernel ticks.

running_ticks_since_call_lo
The low 32 bits of the amount of time the task has run since the last call to rq_get_task_accounting for this task, as measured in Kernel ticks.

total_running_ticks_lo
The low 32 bits of the amount of time the task has run since its creation, as measured in Kernel ticks.

total_running_ticks_hi
The high 32 bits of the amount of time the task has run since its creation, as measured in Kernel ticks.

reset_opt
Specifies whether to reset this task’s accounting information as part of this call or to accumulate information since the last call.

Value Meaning
0 Accumulate information since the last call
0FFH Reset the information with this call

except_ptr
A pointer to a variable declared by the application where the call returns a condition code.

Additional Information

Although the time since the last call to rq_get_task_accounting is kept internally as a 64 bit value, it is only returned in the call as a 32 bit quantity. Therefore, you must either call often enough to avoid overrunning the total_ticks_since_call and running_ticks_since_call fields (which are only the lower 32 bits) or use the total_running_ticks fields to derive the appropriate information.

Condition Codes

E_OK 0000H No exceptional conditions occurred.