Class Sampler
java.lang.Object
io.kubfly.sdk.api.usage.sampler.Sampler
Takes
Usage snapshots. On Linux the host comes from /proc (stat, loadavg,
meminfo) and the container from the cgroup v2 of the process (/proc/self/cgroup under
/sys/fs/cgroup); elsewhere only the JVM management beans are used. The platform part always comes from the
JVM, and so do the disks (FileStore) on every system: the root / and the paths of
KUBFLY_USAGE_DISKS (Config.DISKS). A part that cannot be read becomes unknown
(NaN or -1); a snapshot never fails because of it.
A sampler keeps the previous processor counters to compute shares over the interval, so one sampler serves one
sequence of snapshots; sample() is thread-safe.
-
Constructor Summary
ConstructorsConstructorDescriptionA sampler over given roots, with the root file system only: tests pass a prepared directory instead of/procand/sys/fs/cgroup.A sampler over given roots and file systems. -
Method Summary
Modifier and TypeMethodDescriptiondeadlock()The description of a new deadlock found by the last snapshot, once:Noneif there is none or it was already taken (the same set of threads is not described again; a set that changes is).sample()Takes a snapshot.static Samplersystem()The sampler of this machine:/procand/sys/fs/cgroupon Linux, the JVM elsewhere.voidSubscribes to the collection notifications of the JVM, once: they give the longest pause of an interval, full and explicit collections and the heap after a collection, and report a full collection or a pause of at leastlimitmilliseconds at once, on the notification thread of the JVM (not on application threads).
-
Constructor Details
-
Sampler
A sampler over given roots, with the root file system only: tests pass a prepared directory instead of/procand/sys/fs/cgroup.- Parameters:
proc- the root of/proccgroups- the root of the cgroup v2 hierarchy (/sys/fs/cgroup)linux- whether to read/procand cgroup (otherwise only the JVM)
-
Sampler
A sampler over given roots and file systems.- Parameters:
proc- the root of/proccgroups- the root of the cgroup v2 hierarchy (/sys/fs/cgroup)linux- whether to read/procand cgroup (otherwise only the JVM)disks- the paths whose file systems are sampled, in order
-
-
Method Details
-
system
The sampler of this machine:/procand/sys/fs/cgroupon Linux, the JVM elsewhere.- Returns:
- the sampler
-
sample
-
watch
Subscribes to the collection notifications of the JVM, once: they give the longest pause of an interval, full and explicit collections and the heap after a collection, and report a full collection or a pause of at leastlimitmilliseconds at once, on the notification thread of the JVM (not on application threads).- Parameters:
limit- the shortest pause reported, in millisecondswarn- receives the description of a full collection or a long pause
-
deadlock
-