Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 80 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
# AGENTS.md

This file is the working guide for coding agents and contributors changing VGPU-Mon.

## Project shape

VGPU-Mon is a native 64-bit Windows GPU process monitor written in C11. The supported build toolchain is MSVC from Visual Studio 2022. The interactive UI uses Win32 console input plus VT output; it is not a curses application.

Important areas:

- `src/main.c`: application state, sampling loop, terminal rendering, keyboard/mouse input, CLI output
- `src/nvml_dyn.c`: dynamically loaded NVIDIA NVML telemetry
- `src/dxgi_gpu.c`: DXGI adapter and memory telemetry
- `src/pdh_gpu.c`: WDDM/PDH engine and per-process counters
- `src/updater.c`: signed-release metadata checks, download verification, and update handoff
- `tests/test_core.c`: native unit and CLI behavior tests
- `tests/test_conpty.c`: full terminal lifecycle, input, resize, and frame-bound tests
- `tests/test_installer.ps1`: install, PATH, upgrade, and uninstall lifecycle
- `tools/`: release metadata, PE-hardening, dependency, and packaging checks

Read `docs/architecture.md`, `CONTRIBUTING.md`, and `SECURITY.md` before changing provider ownership, process termination, installation, or update behavior.

## Build and verification

Run commands from the repository root in PowerShell. The PowerShell/MSVC path is release-authoritative.

```powershell
.\build.ps1 -Configuration Debug -Test
.\build.ps1 -Configuration Release -Test
.\build.ps1 -Configuration Sanitize -Test -OutputName vgpu-mon-asan
.\analyze.ps1
.\tools\verify-pe.ps1
```

For a release candidate, also run:

```powershell
.\package.ps1 -SkipBuild
.\installer.ps1 -SkipBuild
.\tests\test_installer.ps1 -InstallerPath (Get-ChildItem .\dist\VGPU-Mon-*-setup.exe -File).FullName
```

Use `--demo` for UI work that must not depend on the local GPU:

```powershell
.\build\vgpu-mon.exe --demo
.\build\vgpu-mon.exe --demo --chart vram
```

Do not commit `build/`, `dist/`, telemetry logs, installers, or machine-specific output.

## Coding rules

- Keep C warnings clean under `/W4 /WX /sdl` and static analysis.
- Use four-space indentation, bounded buffers, explicit ownership, and one cleanup path per acquired resource.
- Preserve graceful behavior when NVML, DXGI, PDH, a sensor, or an individual process query is unavailable.
- Do not add a mandatory runtime, SDK, administrator requirement, service, or driver.
- Keep optional vendor APIs dynamically discovered and keep AMD/Intel fallback behavior intact.
- Add or update automated tests for terminal input, resize, CLI parsing, cleanup, updater, or installer behavior changes.
- Update `README.md` and `CHANGELOG.md` for user-visible changes. Bump `src/version.h` only for a release-ready user-facing change.

## Terminal rendering invariants

- Every repaint must compose a complete frame for the current viewport.
- Never write the terminal's final column; a pending wrap can scroll or flash the viewport.
- Keep emitted rows within the current visible height and clear stale line/tail content.
- Mouse coordinates are console-buffer coordinates; normalize them with `viewport_left` and `viewport_top`.
- Resize, mouse, and chart changes must continue to pass the ConPTY bounds test.
- Chart history is a timestamped ring. Time labels and hover values must use stored timestamps, not assume the current refresh interval applied to older samples.
- A historical chart view should remain anchored while new samples arrive. `End` returns it to live data.

## Safety and release rules

- Treat process names, executable paths, UUIDs, and logs as potentially sensitive.
- Keep termination confirmation and protected/self-process checks intact.
- Never weaken HTTPS-only downloads, version parsing, release filename validation, SHA-256 verification, or current-user installer behavior.
- Do not publish a release unless Debug, Release, AddressSanitizer, static analysis, PE hardening, packaging, and installer lifecycle checks pass.
- Release tags must exactly match `VGPU_VERSION`, and release assets must include the installer, portable ZIP, bootstrap script, `version.txt`, and `SHA256SUMS.txt`.

When a check cannot run, report that explicitly; do not describe unverified work as production-ready.
18 changes: 17 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,21 @@ All notable user-facing changes are documented here. This project follows [Seman

## [Unreleased]

## [1.3.0] - 2026-07-13

### Added

- Zoom the chart's visible time span with the mouse wheel, from a tight live view through the retained history.
- Pan older/newer with `Shift`+wheel, arrow keys, or page keys, with `Home` for the oldest complete window and `End` for live data.
- Show an in-chart crosshair tooltip with the nearest real sample's exact value and age.
- Retain 14,400 timestamped samples per metric in a bounded ring and preserve historical view position while new samples arrive.
- Add a repository-level `AGENTS.md` with architecture, testing, terminal-rendering, security, and release guidance.

### Security and quality

- Keep chart time calculations correct across live refresh-interval changes by recording monotonic timestamps per sample.
- Exercise chart wheel, pan, hover, resize, and complete-frame bounds through the ConPTY integration test.

## [1.2.0] - 2026-07-13

### Added
Expand Down Expand Up @@ -70,7 +85,8 @@ All notable user-facing changes are documented here. This project follows [Seman

- Added `/W4 /WX /sdl`, control-flow protection, ASLR/DEP/CET-compatible linker flags, reproducible Release builds, MSVC AddressSanitizer tests, CRT leak checks, static analysis, CodeQL, and pinned CI dependencies.

[Unreleased]: https://github.com/xptea/VGPU-Mon/compare/v1.2.0...HEAD
[Unreleased]: https://github.com/xptea/VGPU-Mon/compare/v1.3.0...HEAD
[1.3.0]: https://github.com/xptea/VGPU-Mon/compare/v1.2.0...v1.3.0
[1.2.0]: https://github.com/xptea/VGPU-Mon/compare/v1.1.4...v1.2.0
[1.1.4]: https://github.com/xptea/VGPU-Mon/compare/v1.1.3...v1.1.4
[1.1.3]: https://github.com/xptea/VGPU-Mon/compare/v1.1.2...v1.1.3
Expand Down
15 changes: 12 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ It is a real full-screen terminal application, not a wrapper around `nvidia-smi`
## Features

- Live GPU and physical VRAM utilization with driver-reserved memory separated
- Full-screen scrolling charts for GPU, VRAM, engine, temperature, and power metrics
- Full-screen timestamped charts with time-span zoom, history panning, and exact hover values
- WDDM dedicated/shared GPU-memory commitments per process
- Per-process 3D, compute, copy, encode, and decode engine activity
- Temperature, board power, power limit, fan, P-state, and clocks through NVML
- Encoder, decoder, and PCIe link/throughput telemetry when the driver exposes it
- Multiple-GPU switching
- Mouse-clickable sort headers and process rows, plus mouse-wheel navigation
- Mouse-clickable sort headers and process rows, plus context-aware wheel navigation
- Responsive layouts with bounded full-frame repainting after every terminal resize
- Interactive sorting, process-name filtering, and process details
- Confirmed process termination with protection for system and self PIDs
Expand Down Expand Up @@ -125,7 +125,12 @@ winget install --id JRSoftware.InnoSetup --exact --scope user
| `p`, `n`, `e` | Sort by PID, name, or engine |
| `o` | Reverse the current sort |
| Mouse click | Sort a header or select a process row |
| Mouse wheel | Move through process rows |
| Mouse wheel | Move through process rows; zoom the time span over a chart |
| `Shift` + mouse wheel | Pan backward or forward through chart history |
| `Left` / `Right` | Pan a chart by one-quarter of its visible span |
| `PgUp` / `PgDn` | Pan a chart by one full visible span |
| `Home` / `End` | Jump to the oldest complete chart window or return live |
| Mouse hover | Show the exact chart value and how long ago it was sampled |
| `f` | Edit the process-name filter |
| `d` | Toggle details for the selected process |
| `i` | Toggle the full GPU information panel |
Expand Down Expand Up @@ -177,6 +182,10 @@ Demo values are clearly labeled and must not be treated as machine telemetry.

The flag form requested by the UI is also supported, such as `--chart --vram`, `--chart --3d`, or simply `--vram`. In chart view, number keys switch metrics without restarting and `c` returns to the process table.

Charts open on a one-minute live window. Scroll the mouse wheel over the plot to zoom from a tighter view to the full retained range. Use `Shift`+wheel, `Left`/`Right`, or `PgUp`/`PgDn` to inspect older samples; `End` snaps back to live data. Hovering anywhere on the plot draws a crosshair and an in-chart tooltip with the nearest real sample's value and age.

VGPU-Mon retains 14,400 timestamped samples per metric in a fixed-size ring, so memory use stays bounded. That represents about four hours at the default one-second interval, one hour at 250 ms, or twenty hours at five seconds. Stored timestamps keep zoom, panning, and hover ages correct when the sampling interval changes during a run. History is in memory only and resets when the app closes or the selected GPU changes; use CSV logging for long-term storage.

Options:

```text
Expand Down
Loading
Loading