Deleted Added
full compact
libmemstat.3 (148358) libmemstat.3 (148359)
1.\" Copyright (c) 2005 Robert N. M. Watson
2.\" All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\" notice, this list of conditions and the following disclaimer.

--- 8 unchanged lines hidden (view full) ---

17.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23.\" SUCH DAMAGE.
24.\"
1.\" Copyright (c) 2005 Robert N. M. Watson
2.\" All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\" notice, this list of conditions and the following disclaimer.

--- 8 unchanged lines hidden (view full) ---

17.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23.\" SUCH DAMAGE.
24.\"
25.\" $FreeBSD: head/lib/libmemstat/libmemstat.3 148358 2005-07-24 01:29:30Z rwatson $
25.\" $FreeBSD: head/lib/libmemstat/libmemstat.3 148359 2005-07-24 01:41:47Z rwatson $
26.\"
27.Dd June 27, 2005
28.Os
29.Dt LIBMEMSTAT 3
30.Sh NAME
31.Nm libmemstat
32.Nd "library interface to retrieve kernel memory allocator statistics"
33.Sh LIBRARY
34.Lb libmemstat
35.Sh SYNOPSIS
36.In sys/types.h
37.In memstat.h
26.\"
27.Dd June 27, 2005
28.Os
29.Dt LIBMEMSTAT 3
30.Sh NAME
31.Nm libmemstat
32.Nd "library interface to retrieve kernel memory allocator statistics"
33.Sh LIBRARY
34.Lb libmemstat
35.Sh SYNOPSIS
36.In sys/types.h
37.In memstat.h
38.Ss General Functions
39.Ft const char *
40.Fn memstat_strerror "int error"
38.Ss Memory Type List Management Functions
39.Ft struct memory_type_list *
40.Fn memstat_mtl_alloc "void"
41.Ft struct memory_type *
42.Fn memstat_mtl_first "struct memory_type_list *list"
43.Ft struct memory_type *
44.Fn memstat_mtl_next "struct memory_type *mtp"
45.Ft struct memory_type *

--- 99 unchanged lines hidden (view full) ---

145.Fn memstat_sysctl_all ,
146.Fn memstat_sysctl_uma ,
147and
148.Fn memstat_sysctl_malloc .
149Repeated calls will incrementally update the list of memory types, permitting
150tracking over time without recreating all list state.
151If an error is detected during a query call, error condition information may
152be retrieved using
41.Ss Memory Type List Management Functions
42.Ft struct memory_type_list *
43.Fn memstat_mtl_alloc "void"
44.Ft struct memory_type *
45.Fn memstat_mtl_first "struct memory_type_list *list"
46.Ft struct memory_type *
47.Fn memstat_mtl_next "struct memory_type *mtp"
48.Ft struct memory_type *

--- 99 unchanged lines hidden (view full) ---

148.Fn memstat_sysctl_all ,
149.Fn memstat_sysctl_uma ,
150and
151.Fn memstat_sysctl_malloc .
152Repeated calls will incrementally update the list of memory types, permitting
153tracking over time without recreating all list state.
154If an error is detected during a query call, error condition information may
155be retrieved using
153.Fn memstat_mtl_geterror .
156.Fn memstat_mtl_geterror ,
157and converted to a user-readable string using
158.Fn memstat_strerror .
154.Pp
155Freeing the list will free all memory type data in the list, and so
156invalidates any outstanding pointers to entries in the list.
157.Vt struct memory_type
158entries in the list may be iterated over using
159.Fn memstat_mtl_first
160and
161.fn memstat_mtl_next ,

--- 189 unchanged lines hidden (view full) ---

351.Pp
352Functions returning a integer success valuye will return
353.Dv 0
354on success, or
355.Dv -1
356on failure.
357If a failure is returned, the list error access method,
358.Fn memstat_mtl_geterror ,
159.Pp
160Freeing the list will free all memory type data in the list, and so
161invalidates any outstanding pointers to entries in the list.
162.Vt struct memory_type
163entries in the list may be iterated over using
164.Fn memstat_mtl_first
165and
166.fn memstat_mtl_next ,

--- 189 unchanged lines hidden (view full) ---

356.Pp
357Functions returning a integer success valuye will return
358.Dv 0
359on success, or
360.Dv -1
361on failure.
362If a failure is returned, the list error access method,
363.Fn memstat_mtl_geterror ,
359may be used to retrieve the error state. Possible error values are:
364may be used to retrieve the error state.
365The string representation of the error may be retrieved using
366.Fn memstat_strerror .
367Possible error values are:
360.Pp
361.Bl -tag -width "MEMSTAT_ERROR_TOOMANYCPUS" -compact -offset wee
362.It Dv MEMSTAT_ERROR_UNDEFINED
363Undefined error. Occurs if
364.Fn memstat_mtl_geterror
365is called on a list before an error associated with the list has occurred.
366.It Dv MEMSTAT_ERROR_NOMEMORY
367Insufficient memory. Occurs if library calls to

--- 53 unchanged lines hidden (view full) ---

421
422printf("Mbufs: %llu\\n", (unsigned long long)mbuf_count);
423.Ed
424.Sh SEE ALSO
425.Xr malloc 9 ,
426.Xr uma 9
427.Sh HISTORY
428The
368.Pp
369.Bl -tag -width "MEMSTAT_ERROR_TOOMANYCPUS" -compact -offset wee
370.It Dv MEMSTAT_ERROR_UNDEFINED
371Undefined error. Occurs if
372.Fn memstat_mtl_geterror
373is called on a list before an error associated with the list has occurred.
374.It Dv MEMSTAT_ERROR_NOMEMORY
375Insufficient memory. Occurs if library calls to

--- 53 unchanged lines hidden (view full) ---

429
430printf("Mbufs: %llu\\n", (unsigned long long)mbuf_count);
431.Ed
432.Sh SEE ALSO
433.Xr malloc 9 ,
434.Xr uma 9
435.Sh HISTORY
436The
429.Nm memstat
437.Nm libmemstat
430library appeared in
431.Fx 6.0 .
432.Sh AUTHORS
433The kernel memory allocator changes necessary to support a general purpose
434monitoring library, along with the library, were written by
435.An Robert Watson Aq rwatson@FreeBSD.org
436.Sh BUGS
437.Nm
438cannot yet extract statistics from kernel core dumps, although this should be
439straight forward to implement.
440.Pp
441Once a memory type is present on a memory type list, it will not be removed
442even if the kernel no longer presents information on the type via its
443monitoring interfaces.
444In order to flush removed memory types, it is necessary to free the entire
445list and allocate a new one.
438library appeared in
439.Fx 6.0 .
440.Sh AUTHORS
441The kernel memory allocator changes necessary to support a general purpose
442monitoring library, along with the library, were written by
443.An Robert Watson Aq rwatson@FreeBSD.org
444.Sh BUGS
445.Nm
446cannot yet extract statistics from kernel core dumps, although this should be
447straight forward to implement.
448.Pp
449Once a memory type is present on a memory type list, it will not be removed
450even if the kernel no longer presents information on the type via its
451monitoring interfaces.
452In order to flush removed memory types, it is necessary to free the entire
453list and allocate a new one.