2003-02-08 15:15:56 +00:00
|
|
|
.\" Copyright (c) 2003 Poul-Henning Kamp
|
|
|
|
.\" All rights reserved.
|
|
|
|
.\"
|
|
|
|
.\" Redistribution and use in source and binary forms, with or without
|
|
|
|
.\" modification, are permitted provided that the following conditions
|
|
|
|
.\" are met:
|
|
|
|
.\" 1. Redistributions of source code must retain the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer.
|
|
|
|
.\" 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer in the
|
|
|
|
.\" documentation and/or other materials provided with the distribution.
|
|
|
|
.\" 3. The names of the authors may not be used to endorse or promote
|
|
|
|
.\" products derived from this software without specific prior written
|
|
|
|
.\" permission.
|
|
|
|
.\"
|
|
|
|
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
|
|
|
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
.\" SUCH DAMAGE.
|
|
|
|
.\"
|
|
|
|
.\" $FreeBSD$
|
|
|
|
.\"
|
|
|
|
.Dd February 8, 2003
|
|
|
|
.Dt LIBGEOM 3
|
|
|
|
.Os
|
|
|
|
.Sh NAME
|
|
|
|
.Nm geom_stats_open ,
|
|
|
|
.Nm geom_stats_close ,
|
|
|
|
.Nm geom_stats_resync ,
|
|
|
|
.Nm geom_stats_snapshot_get ,
|
|
|
|
.Nm geom_stats_snapshot_free ,
|
|
|
|
.Nm geom_stats_snapshot_timestamp ,
|
|
|
|
.Nm geom_stats_snapshot_reset ,
|
|
|
|
.Nm geom_stats_snapshot_next
|
2003-02-13 18:25:48 +00:00
|
|
|
.Nd userland API library for kernel GEOM subsystem
|
2003-02-08 15:15:56 +00:00
|
|
|
.Sh LIBRARY
|
2003-02-13 18:25:48 +00:00
|
|
|
.Lb libgeom
|
2003-02-08 15:15:56 +00:00
|
|
|
.Sh SYNOPSIS
|
|
|
|
.In libgeom.h
|
2003-02-24 22:53:26 +00:00
|
|
|
.Ss "Statistics Functions"
|
2003-02-08 15:15:56 +00:00
|
|
|
.Ft void
|
|
|
|
.Fn geom_stats_close void
|
|
|
|
.Ft int
|
|
|
|
.Fn geom_stats_open void
|
|
|
|
.Ft void
|
|
|
|
.Fn geom_stats_resync void
|
2003-02-24 22:53:26 +00:00
|
|
|
.Ft "void *"
|
2003-02-08 15:15:56 +00:00
|
|
|
.Fn geom_stats_snapshot_get void
|
|
|
|
.Ft void
|
|
|
|
.Fn geom_stats_snapshot_free "void *arg"
|
|
|
|
.Ft void
|
|
|
|
.Fn geom_stats_snapshot_timestamp "void *arg" "struct timespec *tp"
|
|
|
|
.Ft void
|
|
|
|
.Fn geom_stats_snapshot_reset "void *arg"
|
2003-02-24 22:53:26 +00:00
|
|
|
.Ft "struct g_stat *"
|
2003-02-08 15:15:56 +00:00
|
|
|
.Fn geom_stats_snapshot_next "void *arg"
|
|
|
|
.Sh DESCRIPTION
|
2003-02-24 22:53:26 +00:00
|
|
|
The
|
|
|
|
.Nm geom
|
|
|
|
library contains the official and publicized API for
|
2003-02-08 15:15:56 +00:00
|
|
|
interacting with the GEOM subsystem in the kernel.
|
2003-02-24 22:53:26 +00:00
|
|
|
.Ss "Statistics Functions"
|
2003-02-08 15:15:56 +00:00
|
|
|
GEOM collects statistics data for all consumers and providers, but does
|
|
|
|
not perform any normalization or presentation on the raw data, this is
|
|
|
|
left as an excercize for user-land presentation utilities.
|
|
|
|
.Pp
|
|
|
|
The
|
2003-02-13 18:25:48 +00:00
|
|
|
.Fn geom_stats_open
|
2003-02-24 22:53:26 +00:00
|
|
|
and
|
2003-02-13 18:25:48 +00:00
|
|
|
.Fn geom_stats_close
|
2003-02-24 22:53:26 +00:00
|
|
|
functions open and close the necessary pathways to access the raw
|
|
|
|
statistics information in the kernel.
|
|
|
|
These functions are likely to
|
|
|
|
open one or more files and cache the file descriptors locally.
|
2003-06-18 19:43:17 +00:00
|
|
|
The
|
2003-02-13 18:25:48 +00:00
|
|
|
.Fn geom_stats_open
|
2003-06-18 19:43:17 +00:00
|
|
|
function returns zero on success, and sets
|
2003-02-24 22:53:26 +00:00
|
|
|
.Va errno
|
|
|
|
if not.
|
2003-02-08 15:15:56 +00:00
|
|
|
.Pp
|
|
|
|
The
|
2003-02-13 18:25:48 +00:00
|
|
|
.Fn geom_stats_resync
|
2003-02-08 15:15:56 +00:00
|
|
|
function will check if more statistics collection points have been
|
|
|
|
added in the kernel since
|
2003-02-13 18:25:48 +00:00
|
|
|
.Fn geom_stats_open
|
2003-02-08 15:15:56 +00:00
|
|
|
or the previous call to
|
2003-02-13 18:25:48 +00:00
|
|
|
.Fn geom_stats_resync .
|
2003-02-08 15:15:56 +00:00
|
|
|
.Pp
|
2003-02-24 22:53:26 +00:00
|
|
|
The
|
2003-02-13 18:25:48 +00:00
|
|
|
.Fn geom_stats_snapshot_get
|
2003-02-24 22:53:26 +00:00
|
|
|
function
|
|
|
|
will acquire a snapshot of the raw data from the kernel, and while a
|
2003-02-08 15:15:56 +00:00
|
|
|
reasonable effort is made to make this snapshot as atomic and consistent
|
|
|
|
as possible, no guarantee is given that it will actually be so.
|
|
|
|
The snapshot must be freed again using the
|
2003-02-13 18:25:48 +00:00
|
|
|
.Fn geom_stats_snapshot_free
|
2003-02-08 15:15:56 +00:00
|
|
|
function.
|
2003-06-18 19:43:17 +00:00
|
|
|
The
|
2003-02-13 18:25:48 +00:00
|
|
|
.Fn geom_stats_snapshot_get
|
2003-06-18 19:43:17 +00:00
|
|
|
function returns
|
2003-02-24 22:53:26 +00:00
|
|
|
.Dv NULL
|
|
|
|
on failure.
|
2003-02-08 15:15:56 +00:00
|
|
|
.Pp
|
2003-02-24 22:53:26 +00:00
|
|
|
The
|
2003-02-13 18:25:48 +00:00
|
|
|
.Fn geom_stats_snapshot_timestamp
|
2003-02-24 22:53:26 +00:00
|
|
|
function
|
|
|
|
provides access to the timestamp acquired in the snapshot.
|
2003-02-08 15:15:56 +00:00
|
|
|
.Pp
|
2003-02-24 22:53:26 +00:00
|
|
|
The
|
2003-02-13 18:25:48 +00:00
|
|
|
.Fn geom_stats_snapshot_reset
|
2003-02-08 15:15:56 +00:00
|
|
|
and
|
2003-02-13 18:25:48 +00:00
|
|
|
.Fn geom_stats_snapshot_next
|
2003-02-24 22:53:26 +00:00
|
|
|
functions
|
|
|
|
provide an iterator over the statistics slots in the snapshot.
|
|
|
|
The
|
2003-02-13 18:25:48 +00:00
|
|
|
.Fn geom_stats_snapshot_reset
|
2003-02-24 22:53:26 +00:00
|
|
|
function
|
2003-02-08 15:15:56 +00:00
|
|
|
forces the internal pointer in the snapshot back to before the first item.
|
2003-02-24 22:53:26 +00:00
|
|
|
The
|
2003-02-13 18:25:48 +00:00
|
|
|
.Fn geom_stats_snapshot_next
|
2003-02-24 22:53:26 +00:00
|
|
|
function
|
|
|
|
returns the next item, and
|
|
|
|
.Dv NULL
|
|
|
|
if there are no more items in the snapshot.
|
2003-02-08 15:15:56 +00:00
|
|
|
.Sh AUTHORS
|
|
|
|
.An Poul-Henning Kamp Aq phk@FreeBSD.org
|
|
|
|
.Sh HISTORY
|
2003-02-24 22:53:26 +00:00
|
|
|
The
|
2003-02-08 15:15:56 +00:00
|
|
|
.Nm geom
|
2003-02-24 22:53:26 +00:00
|
|
|
library appeared in
|
2003-02-08 15:15:56 +00:00
|
|
|
.Fx 5.1 .
|