| Skip Navigation Links | |
| Exit Print View | |
![]() | man pages section 2: System Calls Oracle Solaris 11 Information Library |
- get process and child process times
#include <sys/times.h>#include <limits.h>clock_ttimes(struct tms *buffer);
Thetimes() function fills thetms structure pointed to bybuffer withtime-accounting information. Thetms structure, defined in<sys/times.h>, contains the following members:
clock_t tms_utime;clock_t tms_stime;clock_t tms_cutime;clock_t tms_cstime;
All times are reported in clock ticks. The specific value for aclock tick is defined by the variableCLK_TCK, found in the header<limits.h>.
The times of a terminated child process are included in thetms_cutimeandtms_cstime members of the parent whenwait(3C) orwaitpid(3C) returns the processID of this terminated child. If a child process has notwaited for its children, their times will not be included in its times.
Thetms_utime member is the CPU time used while executing instructions inthe user space of the calling process.
Thetms_stime member is the CPU time used by the system onbehalf of the calling process.
Thetms_cutime member is the sum of thetms_utime and thetms_cutimeof the child processes.
Thetms_cstime member is the sum of thetms_stime and thetms_cstimeof the child processes.
Upon successful completion,times() returns the elapsed real time, in clock ticks,since an arbitrary point in the past (for example, system start-up time).This point does not change from one invocation oftimes() within theprocess to another. The return value may overflow the possible range of typeclock_t. Iftimes() fails,(clock_t)-1 is returned anderrno is set toindicate the error.
Thetimes() function will fail if:
Thebuffer argument points to an illegal address.
Seeattributes(5) for descriptions of the following attributes:
|
time(1),timex(1),exec(2),fork(2),time(2),waitid(2),wait(3C),waitpid(3C),attributes(5),standards(5)
Copyright © 2011, Oracle and/or its affiliates. All rights reserved.Legal Notices | ![]() ![]() |