No description
Find a file
Andrea Telatin da4877f68a badge
2025-06-10 14:54:27 +01:00
.github/workflows add github action for testing CI 2025-06-10 14:35:21 +01:00
docs Update linux compatibility 2025-06-10 14:43:55 +01:00
tests Update linux compatibility 2025-06-10 14:43:55 +01:00
.gitignore update readme, gitignore 2025-06-10 13:41:33 +01:00
memonitor.nim Update linux compatibility 2025-06-10 14:43:55 +01:00
memonitor.nimble Update linux compatibility 2025-06-10 14:43:55 +01:00
README.md badge 2025-06-10 14:54:27 +01:00

memonitor

Test Nimble Directory

Features

  • Monitor process memory usage
  • Format memory values with appropriate units (MB/GB)
  • Works on Linux, macOS, and Windows

Installation

nimble install memonitor

Usage

import memonitor

# Get complete memory information
let memInfo = getMemInfo()
echo "Process uses: ", memInfo.processRamMB, " MB"
echo "System has: ", memInfo.freeRamMB, " MB free of ", memInfo.totalRamMB, " MB total"
echo "System memory usage: ", memInfo.usedSystemPercent, "%"

# Format memory values with appropriate units
echo "Process RAM: ", formatMemMB(memInfo.processRamMB)  # "500.50 MB" or "1.25 GB"

# Monitor memory usage around an operation
withMemoryMonitoring:
  var data = newSeq[int](1_000_000)  # Allocate some memory
  # ... do memory-intensive work ...

API Documentation

Generate documentation with:

nimble docs

Running Tests

nimble test

License

MIT