Crate memonitor

source ·
Expand description

Memonitor is a lightweight library that allows querying information from various CPU and GPU devices. The main purpose is the ability to query memory related information, like how much local memory a device has and how much is currently available to be allocated.

This is achieved by dynamically loading, if present, various device APIs found in the system, and querying them directly.

§Example

use memonitor::{list_all_devices, list_backends};

// Print every backend that has been found
for backend in list_backends().iter() {
    println!("Backend found: {}", backend.name());
}

// Print every device found from every backend, as well as current memory statistics
for device in list_all_devices().iter() {
    let stats = device.current_memory_stats();
    println!(
        "Device found: {} ({}) - Memory stats: {} bytes used out of {}, {} are free",
        device.name(),
        device.kind(),
        stats.used,
        stats.total,
        stats.available
    );
}

§Features

  • vulkan - enables the Vulkan backend, enabled by default.

Structs§

  • High-level abstraction over a backend.
  • High-level abstraction over a hardware device.
  • Memory information of a device at some point in time.
  • A type emulating a slice that holds a RwLockReadGuard of the inner context.

Enums§

Constants§

Traits§

Functions§