Skip to content

Instantly share code, notes, and snippets.

View xychenunc's full-sized avatar

Xiaoyang Chen xychenunc

  • Chapel Hill, USA
View GitHub Profile
@xychenunc
xychenunc / gpu_stat.py
Created December 11, 2018 13:29 — forked from matpalm/gpu_stat.py
json formatting of nvidia-settings
#!/usr/bin/env python
# gpu_stat.py [DELAY [COUNT]]
# dump some gpu stats as a line of json
# {"util":{"PCIe":"0", "memory":"11", "video":"0", "graphics":"13"}, "used_mem":"161"}
import json, socket, subprocess, sys, time
try:
delay = int(sys.argv[1])
except:
delay = 1