[−][src]Module radvisor::util
Contains utility methods for processing various data structures, such as bytes, buffers, or system-specific calls
Structs
AnonymousSlice | Represents an anonymous slice, lacking any memory ownership semantics |
Buffer | Working buffer of raw bytes. Can operate both in managed mode (where it keeps track of length) and unmanaged mode (where it acts) as a plain byte buffer. |
ByteLines | Provides iteration capabilities to a raw byte buffer, iterating on each newline found |
CgroupManager | Encapsulated behavior for lazy-resolution of Docker cgroup driver (systemd or cgroupfs). Works for cgroups v1 |
CgroupPath | Resolved and existing cgroup path constructed from the construction methods
on |
ItemPool | Utility structure for tracking a pool of items and generating events when new items are added or old items are removed. |
Enums
CgroupDriver | Docker cgroup driver used to orchestrate moving containers in and out of cgroups |
LazyQuantity |
Constants
INVALID_CGROUP_MOUNT_MESSAGE | |
LINUX_CGROUP_ROOT | |
N | |
R | |
S | |
SIZE | Size of internal capacity |
Traits
BufferLike |
Functions
cgroups_mounted_properly | Checks if cgroups are mounted in /sys/fs/cgroup and if the cpuacct subsystem is enabled (necessary for proper driver detection) |
content_len_raw | Determines the length of the non-zero content in a raw buffer slice |
escape_systemd | Escapes a cgroup slice to be in the style of Systemd cgroups
see |
find_char | Finds the position of the next character, starting at the given index. If a NUL character is reached before the target, the result is an None. Else, if the target is found, the result is a Some including the index of the target char. |
is_newline | Returns true if the given char is a line feed or carriage return |
is_space | Returns true if the given char is a normal whitespace |
is_whitespace | Returns true if the given char is a line feed, carriage return, or normal space |
make | Constructs a cgroup absolute path according to the style expected by the given driver |
nano_ts | Gets the nanosecond unix timestamp for a stat read |
num_available_cores | Gets the number of available cores on the system. On Linux, this excludes those that have been disabled. |
num_cores | Gets the total number of cores on the system. On Linux, this includes disabled ones |
remap | Attempts to map a number range into another, falling back to 0 if the conversion failed |
second_ts | Gets the second unix timestamp for the stat filename |
terminal_width | Attempts to get the width of the given terminal type (in characters), returning None if no applicable width can be found |
trim_raw | Trims a raw buffer slice to not include any starting or ending whitespace |