nvtop 0.1.0

`nvtop`: An NVIDIA SMI'esk GPU Monitoring tool for your terminal. `nvtop` is a command-line utility that provides a replacement for some of the output from `nvidia-smi` (System Management Interface). It offers real-time monitoring and visualization of GPU information: Core Clock, Temps, Fanspeed and Memory Usage. # Usage: ``` # Monitor the GPU and system with a 1-second update interval nvtop --delay 1000 ```
Documentation
use std::time::Duration;

use anyhow::Result;
use clap::Parser;
use log::error;
use nvml_wrapper::Nvml;
use nvtop::{app::run, gpu, nvtop_args};

fn main() -> Result<()> {
    pretty_env_logger::init();

    let args = nvtop_args::Cli::parse();

    let nvml = Nvml::init()?;
    // Get the first `Device` (GPU) in the system
    let device = nvml.device_by_index(0)?;

    let gpu = gpu::GpuInfo { inner: &device };

    let delay = Duration::from_millis(args.delay);

    if let Err(e) = run(gpu, delay) {
        error!("{e}");
    }

    Ok(())
}