Documentation
¶
Overview ¶
Package resctrlfs provides access to the monitoring data of the resctrl filesystem.
resctrl is the kernel interface to the cache and memory bandwidth resource control of the CPU: Intel calls it RDT (Resource Director Technology), AMD calls it PQoS (Platform Quality of Service), Arm calls it MPAM (Memory System Resource Partitioning and Monitoring). All vendors are served by the same kernel driver, so the file layout is identical.
The filesystem is not mounted by default. Mount it with:
mount -t resctrl resctrl /sys/fs/resctrl
This package only reads monitoring data. It does not configure allocation.
The filesystem is documented in the kernel tree:
Index ¶
Constants ¶
const DefaultMountPoint = fs.DefaultResctrlMountPoint
DefaultMountPoint is the common mount point of the resctrl filesystem.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FS ¶
type FS struct {
// contains filtered or unexported fields
}
FS represents the pseudo-filesystem resctrl, which provides an interface to the cache and memory bandwidth monitoring of the CPU.
func NewDefaultFS ¶
NewDefaultFS returns a new FS mounted under the default mountPoint. It will error if the mount point can't be read.
func NewFS ¶
NewFS returns a new FS mounted under the given mountPoint. It will error if the mount point can't be read.
func (FS) L3MonInfo ¶
L3MonInfo returns the L3 monitoring capabilities of the CPU.
It errors if info/L3_MON is missing, which means the CPU or the kernel does not support L3 monitoring. The error wraps the underlying os error, so it can be tested with os.IsNotExist.
func (FS) MonData ¶
MonData returns the monitoring counters of the root control group, one entry per monitoring domain. A domain is a socket, or a CCX on AMD.
It errors only if the mon_data directory itself can't be read. A domain counter that is missing, unreadable or unavailable stays nil, because the hardware may support only some of the features and samples are not always available. A mount without any monitoring domain returns an empty slice.
type L3MonInfo ¶
type L3MonInfo struct {
// NumRMIDs is the number of resource monitoring ids the hardware offers.
// One RMID is used per monitoring group, so this is the upper limit of
// groups that can be monitored at the same time.
NumRMIDs uint64
// MonFeatures lists the counters the hardware supports, in the order the
// kernel reports them, e.g. "llc_occupancy", "mbm_total_bytes",
// "mbm_local_bytes".
MonFeatures []string
}
L3MonInfo describes the L3 monitoring capabilities from info/L3_MON.
type MonData ¶
type MonData struct {
Resource string // e.g. "L3"
ID string // domain id with leading zeros stripped, e.g. "0"
// Counters are nil when the file is absent (feature not supported)
// or reads "Unavailable" (no sample available right now). For example
// Arm MPAM never offers MBMLocalBytes, because the hardware can not
// tell local from remote traffic.
LLCOccupancy *uint64
MBMTotalBytes *uint64
MBMLocalBytes *uint64
}
MonData holds the monitoring counters of one domain of one resource, read from mon_data/mon_<resource>_<id>.