Skip to main content

Crate damon

Crate damon 

Source
Expand description

Safe, typed access to the Linux Data Access Monitor (DAMON).

damon provides two layers:

§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§

AddressUnit
Scale factor from DAMON core address units to bytes.
AttachedHierarchy
A persistent hierarchy handle that verifies a receipt for each operation.
Damon
Entry point for high-level DAMON monitoring.
ExclusiveSession
A cooperatively exclusive, transactionally staged DAMON session.
FvaddrSessionBuilder
Builder for a fixed virtual-address monitoring workflow.
HierarchyReadBatch
Cached reads across kdamonds between complete ownership checks.
HierarchyRuntimeBatch
Runtime operations across kdamonds batched between complete ownership checks.
ManagedHierarchy
A cooperatively exclusive, transactionally staged DAMON hierarchy.
ManagedKdamond
A borrowed ownership-safe runtime view of one managed kdamond.
Monitor
A running high-level DAMON monitor holding a cooperative session lock.
MonitoringIntervals
DAMON sampling, aggregation, and operations-update intervals.
PaddrSessionBuilder
Builder for a physical-address monitoring workflow.
PersistentKdamondIdentity
A running kdamond identity recorded in a persistent receipt.
PersistentReceipt
Verification data for a persistent DAMON hierarchy.
Pid
A Linux process identifier accepted by DAMON’s virtual-address operations.
ProbeHit
One monitoring-probe result returned for a region.
ProcessTarget
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.
RegionBounds
Lower and upper bounds for DAMON’s adaptive number of monitoring regions.
RegionIter
An allocation-free iterator over scaled region views.
RuntimeBatch
Runtime operations batched between complete ownership checks.
RuntimeReadBatch
Read-only runtime operations batched between complete ownership checks.
ScopedSnapshot
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.
SnapshotOutcome
A completed asynchronous snapshot request and its owned monitor.
SnapshotRequest
A snapshot command running on a dedicated worker thread.
SnapshotStartError
A failure to start a snapshot worker and the monitor it did not consume.
SnapshotTiming
Timing information for one completed high-level snapshot request.
TargetIdentity
Identity of a target proven by the staged query configuration.
VaddrSessionBuilder
Builder for a process virtual-address monitoring workflow.

Enums§

Error
An error produced while validating a configuration or accessing DAMON.
SnapshotCompleteness
Whether every address unit counted by the kernel has a materialized region.
SnapshotScope
The strongest scope the library can prove for a snapshot.
SnapshotWait
State returned by SnapshotRequest::wait_until.

Constants§

DEFAULT_SESSION_LOCK_PATH
Conventional advisory lock used by high-level DAMON sessions.

Type Aliases§

MonitorBuilder
Backwards-compatible name for VaddrSessionBuilder.
Result
A result returned by this crate.