Schnittstelle LibKstat
- Alle Superschnittstellen:
Library
Kstat library. The kstat facility is a general-purpose mechanism for
providing kernel statistics to users.
- Autor:
- widdis[at]gmail[dot]com
-
Verschachtelte Klassen - Übersicht
Verschachtelte KlassenModifizierer und TypSchnittstelleBeschreibungstatic class
The kernel maintains a linked list of statistics structures, or kstats.static class
A kstat control structure.static class
Interrupt statistics.static class
IO Statistics.static class
A list of arbitrary name=value statistics.static class
Event timer statistics.Von Schnittstelle geerbte verschachtelte Klassen/Schnittstellen com.sun.jna.Library
Library.Handler
-
Feldübersicht
FelderModifizierer und TypFeldBeschreibungstatic final int
static final LibKstat
static final byte
static final byte
static final byte
static final byte
static final byte
static final byte
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final byte
static final byte
static final byte
static final byte
static final byte
Von Schnittstelle geerbte Felder com.sun.jna.Library
OPTION_ALLOW_OBJECTS, OPTION_CALLING_CONVENTION, OPTION_CLASSLOADER, OPTION_FUNCTION_MAPPER, OPTION_INVOCATION_MAPPER, OPTION_OPEN_FLAGS, OPTION_STRING_ENCODING, OPTION_STRUCTURE_ALIGNMENT, OPTION_SYMBOL_PROVIDER, OPTION_TYPE_MAPPER
-
Methodenübersicht
Modifizierer und TypMethodeBeschreibungint
The kstat_chain_update() function brings the user's kstat header chain in sync with that of the kernel.int
The kstat_close() function frees all resources that were associated with kc.kstat_data_lookup
(LibKstat.Kstat ksp, String name) The kstat_data_lookup() function searches the kstat's data section for the record with the specified name .kstat_lookup
(LibKstat.KstatCtl kc, String ks_module, int ks_instance, String ks_name) The kstat_lookup() function traverses the kstat chain, kc.kc_chain, searching for a kstat with the same ks_module, ks_instance, and ks_name fields; this triplet uniquely identifies a kstat.The kstat_open() function initializes a kstat control structure, which provides access to the kernel statistics library.int
kstat_read
(LibKstat.KstatCtl kc, LibKstat.Kstat ksp, Pointer p) kstat_read() gets data from the kernel for the kstat pointed to by ksp.int
kstat_write
(LibKstat.KstatCtl kc, LibKstat.Kstat ksp, Pointer buf) kstat_write() writes data from buf, or from ksp.ks_data if buf is NULL, to the corresponding kstat in the kernel.
-
Felddetails
-
INSTANCE
-
KSTAT_TYPE_RAW
static final byte KSTAT_TYPE_RAW- Siehe auch:
-
KSTAT_TYPE_NAMED
static final byte KSTAT_TYPE_NAMED- Siehe auch:
-
KSTAT_TYPE_INTR
static final byte KSTAT_TYPE_INTR- Siehe auch:
-
KSTAT_TYPE_IO
static final byte KSTAT_TYPE_IO- Siehe auch:
-
KSTAT_TYPE_TIMER
static final byte KSTAT_TYPE_TIMER- Siehe auch:
-
KSTAT_DATA_CHAR
static final byte KSTAT_DATA_CHAR- Siehe auch:
-
KSTAT_DATA_INT32
static final byte KSTAT_DATA_INT32- Siehe auch:
-
KSTAT_DATA_UINT32
static final byte KSTAT_DATA_UINT32- Siehe auch:
-
KSTAT_DATA_INT64
static final byte KSTAT_DATA_INT64- Siehe auch:
-
KSTAT_DATA_UINT64
static final byte KSTAT_DATA_UINT64- Siehe auch:
-
KSTAT_DATA_STRING
static final byte KSTAT_DATA_STRING- Siehe auch:
-
KSTAT_INTR_HARD
static final int KSTAT_INTR_HARD- Siehe auch:
-
KSTAT_INTR_SOFT
static final int KSTAT_INTR_SOFT- Siehe auch:
-
KSTAT_INTR_WATCHDOG
static final int KSTAT_INTR_WATCHDOG- Siehe auch:
-
KSTAT_INTR_SPURIOUS
static final int KSTAT_INTR_SPURIOUS- Siehe auch:
-
KSTAT_INTR_MULTSVC
static final int KSTAT_INTR_MULTSVC- Siehe auch:
-
KSTAT_NUM_INTRS
static final int KSTAT_NUM_INTRS- Siehe auch:
-
KSTAT_STRLEN
static final int KSTAT_STRLEN- Siehe auch:
-
EAGAIN
static final int EAGAIN- Siehe auch:
-
-
Methodendetails
-
kstat_open
LibKstat.KstatCtl kstat_open()The kstat_open() function initializes a kstat control structure, which provides access to the kernel statistics library.- Gibt zurück:
- A pointer to this structure, which must be supplied as the kc argument in subsequent libkstat function calls.
-
kstat_close
The kstat_close() function frees all resources that were associated with kc.- Parameter:
kc
- a kstat control structure- Gibt zurück:
- 0 on success and -1 on failure.
-
kstat_chain_update
The kstat_chain_update() function brings the user's kstat header chain in sync with that of the kernel. The kstat chain is a linked list of kstat headers (kstat_t's) pointed to by kc.kc_chain, which is initialized by kstat_open(3KSTAT). This chain constitutes a list of all kstats currently in the system. During normal operation, the kernel creates new kstats and delete old ones as various device instances are added and removed, thereby causing the user's copy of the kstat chain to become out of date. The kstat_chain_update() function detects this condition by comparing the kernel's current kstat chain ID(KCID), which is incremented every time the kstat chain changes, to the user's KCID, kc.kc_chain_id. If the KCIDs match, kstat_chain_update() does nothing. Otherwise, it deletes any invalid kstat headers from the user's kstat chain, adds any new ones, and sets kc.kc_chain_id to the new KCID. All other kstat headers in the user's kstat chain are unmodified.- Parameter:
kc
- a kstat control structure- Gibt zurück:
- the new KCID if the kstat chain has changed, 0 if it hasn't, or -1 on failure.
-
kstat_read
kstat_read() gets data from the kernel for the kstat pointed to by ksp. ksp.ks_data is automatically allocated (or reallocated) to be large enough to hold all of the data. ksp.ks_ndata is set to the number of data fields, ksp.ks_data_size is set to the total size of the data, and ksp.ks_snaptime is set to the high-resolution time at which the data snapshot was taken.- Parameter:
kc
- The kstat control structureksp
- The kstat from which to retrieve datap
- If buf is non-NULL , the data is copied from ksp.ks_data into buf.- Gibt zurück:
- On success, return the current kstat chain ID (KCID). On failure, return -1.
-
kstat_write
kstat_write() writes data from buf, or from ksp.ks_data if buf is NULL, to the corresponding kstat in the kernel. Only the superuser can use kstat_write() .- Parameter:
kc
- The kstat control structureksp
- The kstat on which to set databuf
- If buf is non-NULL, the data is copied from buf into ksp.ks_data.- Gibt zurück:
- On success, return the current kstat chain ID (KCID). On failure, return -1.
-
kstat_lookup
LibKstat.Kstat kstat_lookup(LibKstat.KstatCtl kc, String ks_module, int ks_instance, String ks_name) The kstat_lookup() function traverses the kstat chain, kc.kc_chain, searching for a kstat with the same ks_module, ks_instance, and ks_name fields; this triplet uniquely identifies a kstat. If ks_module is NULL, ks_instance is -1, or ks_name is NULL, then those fields will be ignored in the search. For example, kstat_lookup(kc, NULL, -1, "foo") will simply find the first kstat with name "foo".- Parameter:
kc
- The kstat control structureks_module
- The kstat module to searchks_instance
- The kstat instance numberks_name
- The kstat name to search- Gibt zurück:
- a pointer to the requested kstat if it is found, or NULL if it is not.
-
kstat_data_lookup
The kstat_data_lookup() function searches the kstat's data section for the record with the specified name . This operation is valid only for kstat types which have named data records. Currently, only the KSTAT_TYPE_NAMED and KSTAT_TYPE_TIMER kstats have named data records.- Parameter:
ksp
- The kstat to searchname
- The key for the name-value pair, or name of the timer as applicable- Gibt zurück:
- a pointer to the requested data record if it is found. If the requested record is not found, or if the kstat type is invalid, returns NULL.
-