Skip to content

Commit

Permalink
Added usage percentage to memory stat. Part of #60
Browse files Browse the repository at this point in the history
  • Loading branch information
iinsertNameHere committed May 8, 2024
1 parent 3a27526 commit 4f0f15f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/catniplib/platform/probe.nim
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,9 @@ proc getMemory*(mb: bool): string =
memAvailableInt = memAvailableString.parseUInt div dividend

memUsedInt = memTotalInt - memAvailableInt

result = &"{memUsedInt} / {memTotalInt} {suffix}"
percentage = ((int(memUsedInt) / int(memTotalInt)) * 100).round().int()

result = &"{memUsedInt} / {memTotalInt} {suffix} ({percentage}%)"

proc getMounts*(): seq[string] =
proc getMountPoints(): cstring {.importc, varargs, header: "getDisk.h".}
Expand Down

0 comments on commit 4f0f15f

Please sign in to comment.