okami.mom/strata

git clone https://git.nkp.pet/okami.mom/strata

Niko1221bench: community report, 2x RX 6900 XT (gfx1030), seven configurations (#927)cc52598ab

main
1.5 KiB26 linesraw
1"""Sample system RAM, swap and both AMD GPUs' memory, busy and power once per second (sysfs; the AMD form of
2bench/results/2026-09-30-community-rtx-5090/monitor.py)."""
3import glob, json, sys, time
4from pathlib import Path
5out = Path(sys.argv[1] if len(sys.argv) > 1 else 'telemetry.jsonl')
6cards = sorted(glob.glob('/sys/class/drm/card[0-9]/device'))
7def rd(p):
8    try: return int(Path(p).read_text().split()[0])
9    except Exception: return None
10with out.open('a') as f:
11    while True:
12        memory = {}
13        for line in Path('/proc/meminfo').read_text().splitlines():
14            key, value = line.split(':', 1)
15            if key in ('MemTotal', 'MemAvailable', 'SwapTotal', 'SwapFree'):
16                memory[key + '_KiB'] = int(value.strip().split()[0])
17        gpus = []
18        for d in cards:
19            hw = glob.glob(d + '/hwmon/hwmon*/')
20            hw = hw[0] if hw else ''
21            gpus.append({'pci': Path(d).resolve().name, 'vram_used_MiB': (rd(d + '/mem_info_vram_used') or 0) // 1048576,
22                         'gtt_used_MiB': (rd(d + '/mem_info_gtt_used') or 0) // 1048576, 'busy_percent': rd(d + '/gpu_busy_percent'),
23                         'power_W': (rd(hw + 'power1_average') or rd(hw + 'power1_input') or 0) / 1e6 if hw else None,
24                         'temp_C': (rd(hw + 'temp1_input') or 0) / 1000 if hw else None})
25        f.write(json.dumps({'epoch_s': time.time(), 'memory': memory, 'gpus': gpus}) + '\n'); f.flush()
26        time.sleep(1)