memonitor 0.2.4

Query CPU and GPU memory information in a portable way.
Documentation
use memonitor::{list_all_devices, list_backends, BackendId};

mod common;

#[test]
fn vulkan() {
    common::init_tracing();

    let device_ids = {
        let backends = list_backends();
        backends
            .iter()
            .find(|b| b.id() == BackendId::Vulkan)
            .unwrap()
            .device_indexes()
            .to_vec()
    };

    {
        let devices = list_all_devices();
        for id in device_ids {
            let stats = devices[id].current_memory_stats();
            println!(
                "Device found: {} ({}) - Memory stats: {} bytes used out of {}, {} are free",
                devices[id].name(),
                devices[id].kind(),
                stats.used,
                stats.total,
                stats.available
            );
        }
    }
}