Expand description
Safe, typed access to the Linux Data Access Monitor (DAMON).
damon provides two layers:
Damon,ManagedHierarchy,ExclusiveSession, andMonitormanage transactional DAMON monitoring lifecycles.sysfsexposes typed building blocks for callers that need direct control over the kernel ABI.
§Example
use damon::{Damon, Pid};
let damon = Damon::new()?;
let pid = Pid::new(std::process::id())?;
let mut monitor = damon.monitor_pid(pid).start()?;
for region in monitor.materialize_snapshot()?.snapshot().regions() {
println!(
"{:#x}-{:#x}: {} accesses",
region.start_bytes()?,
region.end_bytes()?,
region.nr_accesses()
);
}The high-level API uses a cooperative advisory lock, refuses to replace a running kdamond, and restores preceding stopped configurations. The kernel ABI cannot enforce ownership against controllers that ignore that lock.
Re-exports§
pub use sysfs::AccessCountRange;pub use sysfs::AccessPattern;pub use sysfs::Action;pub use sysfs::AgeRange;pub use sysfs::ByteSizeRange;pub use sysfs::Capabilities;pub use sysfs::CapabilitySupport;pub use sysfs::ContextConfig;pub use sysfs::DamonConfig;pub use sysfs::DestinationConfig;pub use sysfs::FilterConfig;pub use sysfs::FilterLayer;pub use sysfs::FilterPlacement;pub use sysfs::InitialRegionConfig;pub use sysfs::IntervalsGoalConfig;pub use sysfs::KdamondConfig;pub use sysfs::ObservedConfiguration;pub use sysfs::Operation;pub use sysfs::OperationAttributesConfig;pub use sysfs::OperationCapability;pub use sysfs::ProbeConfig;pub use sysfs::ProbeFilterConfig;pub use sysfs::ProbeFilterType;pub use sysfs::ProbeHitsWeightedSumRange;pub use sysfs::ProbePreparationAction;pub use sysfs::ProbePreparationConfig;pub use sysfs::QuotaConfig;pub use sysfs::QuotaGoalConfig;pub use sysfs::QuotaGoalMetric;pub use sysfs::QuotaGoalTuner;pub use sysfs::QuotaWeights;pub use sysfs::RegionSizeRange;pub use sysfs::SampleControlConfig;pub use sysfs::SampleFilterConfig;pub use sysfs::SampleFilterType;pub use sysfs::SamplePrimitivesConfig;pub use sysfs::SchemeConfig;pub use sysfs::SchemeFilterType;pub use sysfs::SchemeStats;pub use sysfs::SysfsFeature;pub use sysfs::TargetConfig;pub use sysfs::WatermarkMetric;pub use sysfs::WatermarksConfig;pub use sysfs::WritableConfigurationValue;
Modules§
- sysfs
- Typed, low-level access to DAMON’s admin sysfs ABI.
Structs§
- Address
Unit - Scale factor from DAMON core address units to bytes.
- Attached
Hierarchy - A persistent hierarchy handle that verifies a receipt for each operation.
- Damon
- Entry point for high-level DAMON monitoring.
- Exclusive
Session - A cooperatively exclusive, transactionally staged DAMON session.
- Fvaddr
Session Builder - Builder for a fixed virtual-address monitoring workflow.
- Hierarchy
Read Batch - Cached reads across kdamonds between complete ownership checks.
- Hierarchy
Runtime Batch - Runtime operations across kdamonds batched between complete ownership checks.
- Managed
Hierarchy - A cooperatively exclusive, transactionally staged DAMON hierarchy.
- Managed
Kdamond - A borrowed ownership-safe runtime view of one managed kdamond.
- Monitor
- A running high-level DAMON monitor holding a cooperative session lock.
- Monitoring
Intervals - DAMON sampling, aggregation, and operations-update intervals.
- Paddr
Session Builder - Builder for a physical-address monitoring workflow.
- Persistent
Kdamond Identity - A running kdamond identity recorded in a persistent receipt.
- Persistent
Receipt - Verification data for a persistent DAMON hierarchy.
- Pid
- A Linux process identifier accepted by DAMON’s virtual-address operations.
- Probe
Hit - One monitoring-probe result returned for a region.
- Process
Target - One process target for a vaddr or fvaddr workflow.
- RawRegion
- A monitored region returned directly by DAMON in core address units.
- RawSnapshot
- Raw point-in-time DAMON results with no inferred byte scale.
- Region
- A borrowed monitored-region view with a known effective byte scale.
- Region
Bounds - Lower and upper bounds for DAMON’s adaptive number of monitoring regions.
- Region
Iter - An allocation-free iterator over scaled region views.
- Runtime
Batch - Runtime operations batched between complete ownership checks.
- Runtime
Read Batch - Read-only runtime operations batched between complete ownership checks.
- Scoped
Snapshot - A snapshot paired with its hierarchy coordinates and proven scope.
- Snapshot
- A point-in-time set of DAMON results with a known effective byte scale.
- Snapshot
Outcome - A completed asynchronous snapshot request and its owned monitor.
- Snapshot
Request - A snapshot command running on a dedicated worker thread.
- Snapshot
Start Error - A failure to start a snapshot worker and the monitor it did not consume.
- Snapshot
Timing - Timing information for one completed high-level snapshot request.
- Target
Identity - Identity of a target proven by the staged query configuration.
- Vaddr
Session Builder - Builder for a process virtual-address monitoring workflow.
Enums§
- Error
- An error produced while validating a configuration or accessing DAMON.
- Snapshot
Completeness - Whether every address unit counted by the kernel has a materialized region.
- Snapshot
Scope - The strongest scope the library can prove for a snapshot.
- Snapshot
Wait - State returned by
SnapshotRequest::wait_until.
Constants§
- DEFAULT_
SESSION_ LOCK_ PATH - Conventional advisory lock used by high-level DAMON sessions.
Type Aliases§
- Monitor
Builder - Backwards-compatible name for
VaddrSessionBuilder. - Result
- A result returned by this crate.