Merge pull request #813 from tomsaleeba/tomsaleeba/nvidiagpu-additions-2
fix: correct mem usage to be mem *io* usage
This commit is contained in:
commit
9c463fc2b7
1 changed files with 13 additions and 4 deletions
|
@ -4,11 +4,15 @@
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
* nvidiagpu.format: Format string (defaults to '{name}: {temp}°C %{usedmem}/{totalmem} MiB')
|
* nvidiagpu.format: Format string (defaults to '{name}: {temp}°C %{usedmem}/{totalmem} MiB')
|
||||||
Available values are: {name} {temp} {mem_used} {mem_total} {fanspeed} {clock_gpu} {clock_mem} {gpu_usage_pct} {mem_usage_pct}
|
Available values are: {name} {temp} {mem_used} {mem_total} {fanspeed} {clock_gpu} {clock_mem} {gpu_usage_pct} {mem_usage_pct} {mem_io_pct}
|
||||||
|
|
||||||
Requires nvidia-smi
|
Requires nvidia-smi
|
||||||
|
|
||||||
contributed by `RileyRedpath <https://github.com/RileyRedpath>`_ - many thanks!
|
contributed by `RileyRedpath <https://github.com/RileyRedpath>`_ - many thanks!
|
||||||
|
|
||||||
|
Note: mem_io_pct is (from `man nvidia-smi`):
|
||||||
|
> Percent of time over the past sample period during which global (device)
|
||||||
|
> memory was being read or written.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import core.module
|
import core.module
|
||||||
|
@ -42,7 +46,8 @@ class Module(core.module.Module):
|
||||||
clockGpu = ""
|
clockGpu = ""
|
||||||
fanspeed = ""
|
fanspeed = ""
|
||||||
gpuUsagePct = ""
|
gpuUsagePct = ""
|
||||||
memPct = ""
|
memIoPct = ""
|
||||||
|
memUsage = "not found"
|
||||||
for item in sp.split("\n"):
|
for item in sp.split("\n"):
|
||||||
try:
|
try:
|
||||||
key, val = item.split(":")
|
key, val = item.split(":")
|
||||||
|
@ -67,11 +72,14 @@ class Module(core.module.Module):
|
||||||
if key == "Gpu":
|
if key == "Gpu":
|
||||||
gpuUsagePct = val.split(" ")[0]
|
gpuUsagePct = val.split(" ")[0]
|
||||||
elif key == "Memory":
|
elif key == "Memory":
|
||||||
memPct = val.split(" ")[0]
|
memIoPct = val.split(" ")[0]
|
||||||
|
|
||||||
except:
|
except:
|
||||||
title = item.strip()
|
title = item.strip()
|
||||||
|
|
||||||
|
if totalMem and usedMem:
|
||||||
|
memUsage = int(int(usedMem) / int(totalMem) * 100)
|
||||||
|
|
||||||
str_format = self.parameter(
|
str_format = self.parameter(
|
||||||
"format", "{name}: {temp}°C {mem_used}/{mem_total} MiB"
|
"format", "{name}: {temp}°C {mem_used}/{mem_total} MiB"
|
||||||
)
|
)
|
||||||
|
@ -84,7 +92,8 @@ class Module(core.module.Module):
|
||||||
clock_mem=clockMem,
|
clock_mem=clockMem,
|
||||||
fanspeed=fanspeed,
|
fanspeed=fanspeed,
|
||||||
gpu_usage_pct=gpuUsagePct,
|
gpu_usage_pct=gpuUsagePct,
|
||||||
mem_usage_pct=memPct,
|
mem_io_pct=memIoPct,
|
||||||
|
mem_usage_pct=memUsage,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue