xref: /original-bsd/lib/libcompat/4.1/vtimes.3 (revision 93ab02a6)
1.\" Copyright (c) 1980, 1991 Regents of the University of California.
2.\" All rights reserved.
3.\"
4.\" %sccs.include.redist.man%
5.\"
6.\"     @(#)vtimes.3	6.5 (Berkeley) 04/19/91
7.\"
8.Dd
9.Dt VTIMES 3
10.Os BSD 4
11.Sh NAME
12.Nm vtimes
13.Nd get information about resource utilization
14.Sh SYNOPSIS
15.Fd #include <sys/vtimes.h>
16.Fn vtimes "struct vtimes *par_vm" "struct vtimes *ch_vm"
17.Sh DESCRIPTION
18.Bf -symbolic
19This interface is obsoleted by getrusage(2).
20It is available from the compatibility library, libcompat.
21.Ef
22.Pp
23The
24.Fn vtimes
25function
26returns accounting information for the current process and for
27the terminated child processes of the current
28process.  Either
29.Fa par_vm
30or
31.Fa ch_vm
32or both may be 0, in which case only the information for the pointers
33which are non-zero is returned.
34.Pp
35After the call, each buffer contains information as defined by the
36contents of the include file
37.Pa /usr/include/sys/vtimes.h :
38.Bd -literal -offset indent
39struct vtimes {
40	int	vm_utime;	/* user time (*HZ) */
41	int	vm_stime;	/* system time (*HZ) */
42	/* divide next two by utime+stime to get averages */
43	unsigned vm_idsrss;	/* integral of d+s rss */
44	unsigned vm_ixrss;	/* integral of text rss */
45	int	vm_maxrss;	/* maximum rss */
46	int	vm_majflt;	/* major page faults */
47	int	vm_minflt;	/* minor page faults */
48	int	vm_nswap;	/* number of swaps */
49	int	vm_inblk;	/* block reads */
50	int	vm_oublk;	/* block writes */
51};
52.Ed
53.Pp
54The
55.Fa vm_utime
56and
57.Fa vm_stime
58fields give the user and system
59time respectively in 60ths of a second (or 50ths if that
60is the frequency of wall current in your locality.) The
61.Fa vm_idrss
62and
63.Fa vm_ixrss
64measure memory usage.  They are computed by integrating the number of
65memory pages in use each
66over
67.Tn CPU
68time.  They are reported as though computed
69discretely, adding the current memory usage (in 512 byte
70pages) each time the clock ticks.  If a process used 5 core
71pages over 1 cpu-second for its data and stack, then
72.Fa vm_idsrss
73would have the value 5*60, where
74.Fa vm_utime+vm_stime
75would be the 60.
76The
77.Fa Vm_idsrss
78argument
79integrates data and stack segment
80usage, while
81.Fa vm_ixrss
82integrates text segment usage.
83The
84.Fa Vm_maxrss
85function
86reports the maximum instantaneous sum of the
87text+data+stack core-resident page count.
88.Pp
89The
90.Fa vm_majflt
91field gives the number of page faults which
92resulted in disk activity; the
93.Fa vm_minflt
94field gives the
95number of page faults incurred in simulation of reference
96bits;
97.Fa vm_nswap
98is the number of swaps which occurred.  The
99number of file system input/output events are reported in
100.Fa vm_inblk
101and
102.Fa vm_oublk
103These numbers account only for real
104.Tn I/O ;
105data supplied by the caching mechanism is charged only
106to the first process to read or write the data.
107.Sh SEE ALSO
108.Xr time 2 ,
109.Xr wait3 2 ,
110.Xr getrusage 2
111.Sh HISTORY
112The
113.Fn vlimit
114function appeared in
115.Bx 4.2 .
116