public static class KstatUtil.KstatChain extends Object implements AutoCloseable
kstat_ctl_t
object. Only
one thread may actively use this object at any time.
Instantiating this object is accomplished using the
KstatUtil.openChain()
method. It locks and updates the chain and is the
equivalent of calling LibKstat.kstat_open()
. The control object should
be closed with close()
, the equivalent of calling
LibKstat.kstat_close(com.sun.jna.platform.unix.solaris.LibKstat.KstatCtl)
Modifier and Type | Method and Description |
---|---|
void |
close()
Release the lock on the chain.
|
com.sun.jna.platform.unix.solaris.LibKstat.Kstat |
lookup(String module,
int instance,
String name)
Convenience method for
LibKstat.kstat_lookup(com.sun.jna.platform.unix.solaris.LibKstat.KstatCtl, java.lang.String, int, java.lang.String) . |
List<com.sun.jna.platform.unix.solaris.LibKstat.Kstat> |
lookupAll(String module,
int instance,
String name)
Convenience method for
LibKstat.kstat_lookup(com.sun.jna.platform.unix.solaris.LibKstat.KstatCtl, java.lang.String, int, java.lang.String) . |
boolean |
read(com.sun.jna.platform.unix.solaris.LibKstat.Kstat ksp)
Convenience method for
LibKstat.kstat_read(com.sun.jna.platform.unix.solaris.LibKstat.KstatCtl, com.sun.jna.platform.unix.solaris.LibKstat.Kstat, com.sun.jna.Pointer) which gets data from the
kernel for the kstat pointed to by ksp . |
int |
update()
Convenience method for
LibKstat.kstat_chain_update(com.sun.jna.platform.unix.solaris.LibKstat.KstatCtl) . |
public boolean read(com.sun.jna.platform.unix.solaris.LibKstat.Kstat ksp)
LibKstat.kstat_read(com.sun.jna.platform.unix.solaris.LibKstat.KstatCtl, com.sun.jna.platform.unix.solaris.LibKstat.Kstat, com.sun.jna.Pointer)
which 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.ksp
- The kstat from which to retrieve datatrue
if successful; false
otherwisepublic com.sun.jna.platform.unix.solaris.LibKstat.Kstat lookup(String module, int instance, String name)
LibKstat.kstat_lookup(com.sun.jna.platform.unix.solaris.LibKstat.KstatCtl, java.lang.String, int, java.lang.String)
. Traverses the kstat
chain, searching for a kstat with the same module
, instance
,
and name
fields; this triplet uniquely identifies a kstat. If
module
is null
, instance
is -1, or name
is
null
, then those fields will be ignored in the search.module
- The module, or null to ignoreinstance
- The instance, or -1 to ignorename
- The name, or null to ignorenull
public List<com.sun.jna.platform.unix.solaris.LibKstat.Kstat> lookupAll(String module, int instance, String name)
LibKstat.kstat_lookup(com.sun.jna.platform.unix.solaris.LibKstat.KstatCtl, java.lang.String, int, java.lang.String)
. Traverses the kstat
chain, searching for all kstats with the same module
,
instance
, and name
fields; this triplet uniquely identifies a
kstat. If module
is null
, instance
is -1, or
name
is null
, then those fields will be ignored in the
search.module
- The module, or null to ignoreinstance
- The instance, or -1 to ignorename
- The name, or null to ignorepublic int update()
LibKstat.kstat_chain_update(com.sun.jna.platform.unix.solaris.LibKstat.KstatCtl)
. Brings this kstat
header chain in sync with that of the kernel.
This function compares the kernel's current kstat chain ID(KCID), which is incremented every time the kstat chain changes, to this object's KCID.
public void close()
close
in interface AutoCloseable
Copyright © 2010–2019 oshi. All rights reserved.