RUNSTATS(3)

NAME
runstats - keep track of process time and memory utilization (in libmagicutils.a)

SYNOPSIS
#include <sys/types.h>
#include <sys/times.h>
#include <sys/time.h>
#include runstats.h

char *RunStats(flags, lastt, deltat)
int flags;
struct tms *lastt, *deltat;

char *RunStatsRealTime()

DESCRIPTION
RunStats collects information about a process's utilization of memory and CPU time. Depending on the flags provided, the following information is returned:

RS_TCUM
    cumulative user and system time

RS_TINCR
    the difference between the current cumulative user and system time and the values stored in the tms struct pointed to by lastt. This struct is usually the one last passed to RunStats when it was last called with RS_TINCR as a flag.

RS_MEM
    the number of bytes by which the data segment has grown past its initial size.

RunStats returns a pointer to a statically allocated character string of the form ``[... stuff ...]'', where stuff contains the information specified by the flags. Times are of the form mins:secsu mins:secss, where the first time is the amount of user CPU time this process has used, and the second time is the amount of system time used. Memory is specified by a string of the form Nk, where N is the number of kilobytes by which the data segment has grown past its initial size.

If RS_TINCR is specified, the parameters lastt and deltat are set if they are non-NULL. Both point to tms structs; the one pointed to by deltat is set to the difference between the current user/system time and the time given in the tms struct pointed to by lastt; the one pointed to by lastt is then set to the current user/system time.

RunStatsRealTime reports the real time, both since the first invocation and incremental since the last invocation. It returns a statically allocated string of the form x:xx.x x:xx.x, where the first number is the amount of elapsed real time since the first call to RunStatsRealTime, and the second is the amount of elapsed real time since the latest call.

BUGS
The interfaces to RunStats and RunStatsRealTime should really be consistent.

SEE ALSO
magicutils(3)