# GPU Telemetry
Constantly logs basic GPU information in a background thread. Metrics are entirely about memory for now. Its easy to implement.
## Backends
Different backends support different things:
| Vulkan | None | Heap size and usage/budget (if available) |
| DX | usage/budget and reservation | None |
Other backends or operating systems are unsupported. For more support, you can use custom telemetry backends.
## Usage
This crate is pretty easy to use and versatile. An example usage is shown below:
```rust
use std::time::Duration;
use gpu_telemetry::monitor::{GpuMonitor, telemetry::Telemetry};
fn monitor_gpu_stuff() {
let monitor: GpuMonitor<Telemetry> = GpuMonitor::on_adapter(0, Duration::from_millis(50)).unwrap();
// do gpu stuff...
let _ = monitor.stop().unwrap();
}
```
And you can specify your own logger instead of the default `Telemetry` one:
```rust
use std::time::Duration;
use gpu_telemetry::monitor::GpuMonitor;
fn monitor_gpu_stuff() {
let monitor: GpuMonitor<TheBestestLogger> = GpuMonitor::on_adapter(0, Duration::from_millis(50)).unwrap();
// do gpu stuff...
let _ = monitor.stop().unwrap();
}
```
Just make sure `TheBestestLogger` implements the `GpuLogger` trait (and `Send + 'static`) and note that `GpuMonitor::stop` will return that logger.
You can also specify what backend you want to use:
```rust
use std::time::Duration;
use gpu_telemetry::monitor::GpuMonitor;
fn monitor_gpu_stuff() {
let monitor =
GpuMonitor::<Telemetry, crate::sys::VulkanGpuQuery>::on_adapter(0, Duration::from_millis(50))
.unwrap();(Duration::from_millis(50)).unwrap();
// do gpu stuff...
let _ = monitor.stop().unwrap();
}
```
You can even specify both. Between the logger and the query, `GpuMonitor` doesn't offer much more than a clean and universal API.