okami.mom/strata

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

Omar Al-Jaddadocs: add RTX 5090 community benchmark resultsb73e77021

main
870 B18 linesraw
1"""Sample system RAM, swap and GPU memory once per second during the trial."""
2import json
3import subprocess
4import sys
5import time
6from pathlib import Path
7
8with Path(sys.argv[1] if len(sys.argv) > 1 else 'telemetry.jsonl').open('a') as output:
9    while True:
10        memory = {}
11        for line in Path('/proc/meminfo').read_text().splitlines():
12            key, value = line.split(':', 1)
13            if key in ('MemTotal', 'MemAvailable', 'SwapTotal', 'SwapFree'):
14                memory[key + '_KiB'] = int(value.strip().split()[0])
15        gpu = subprocess.check_output(['nvidia-smi', '--query-gpu=memory.used,memory.total,utilization.gpu,power.draw,temperature.gpu', '--format=csv,noheader,nounits'], text=True).strip()
16        output.write(json.dumps({'epoch_s': time.time(), 'memory': memory, 'gpu': gpu}) + '\n')
17        output.flush()
18        time.sleep(1)