Suptime()

LONG Suptime( uptime, loadaverage )

LONG *uptime;
LONG *loadaverage;
Suptime() returns the current uptime and load averages from the system.
Opcode319 (0x013f)
AvailabilityAvailable when a 'MiNT' cookie with a version of at least 1.11 exists.
Parametersuptime is a pointer to a LONG value that will be filled with the current amount of seconds elapsed since last reboot.

loadaverage is a pointer to a three longword array, that will be filled with the current load averages (for last 1, 5 and 15 minutes).

Binding
pea	loadaverage
pea	uptime
move.w	#$013f,-(sp)
trap	#1
lea	$0a(sp),sp
Return ValueSuptime() returns E_OK or a negative GEMDOS error code otherwise (actually it may be only ENOSYS if the call is not supported...).

CommentsThe load average value is calculated using the following formula:
sum += (new_load - old_load) * LOAD_SCALE;
load_avg = sum / MAX_SIZE;
where LOAD_SCALE is 2048, MAX_SIZE is the number of 5 second periods in the specified amount of time (12 for 1 min., 60 for 5 min. and 180 for 15 min). new_load is the number of currently running processes, old_load is the number of processes running previous time. A 'running' process is considered the one which is put onto run or ready queue.