[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
cputime on a SunOS-5.5 machine
From: |
Francesco Potorti` |
Subject: |
cputime on a SunOS-5.5 machine |
Date: |
Thu, 21 Mar 96 17:56 MET |
John Eaton wrote:
I think Rick must be using one of the snapshots. In the current
sources there is a getrusage() function that returns a structure like
this:
[long struct deleted. The entries relevant to the cputime
discussion are the system time and user time of the process.]
[...] In any case, cputime has always been implemented using the
getrusage() system call, so it does not work on all systems. If
you know of systems that do not have getrusage() but do have ways
to get some (or all) of that information using different system
functions, please let me know.
There should be a similar system call on every unix system, because on
every unix system I know of the time(1) command exists and it gives
just that information. On the Motorola Delta systemV R3 it is the
times(2) system call, in libc, whose man page says:
times fills the structure pointed to by buffer with time-
accounting information. The following are the contents of
this structure:
struct tms {
time_t tms_utime;
time_t tms_stime;
time_t tms_cutime;
time_t tms_cstime;
};
An analogous times(3) exists on alpha, in libc, a times(2) exists on
HP with the same functionality, it also exists on
spiff.gnu.ai.mit.edu, a NEWS-OS system (a Sun, I suppose), which also
says it is obsoleted by getrusage, but is retained for compatibility.
Anyway, as far as I know, times(2) is present on every system, as it
is an historical unix system call and will never be dumped altogether,
so it can be safely used for cputime() and for getrusage() as well, at
least for the time fields of the structure.
--
Francesco Potorti` Voice: +39-50-593203
Satellite Network Group Operator: +39-50-593111
CNUCE-CNR, Via Santa Maria 36 Fax: +39-50-904052(G3)/904051(G4)
56126 Pisa - Italy Email: address@hidden