Skip to main content

Embedded Low-Level Memory Visualization for C++

Project description

MemViz

PyPI version Python versions License: MIT

MemViz is a teaching & visualization tool for C++ memory performance.
It helps students and developers understand:

  • 📦 Memory layout (structs, padding, vtables)
  • 💾 Cache behavior (L1/L2/L3 misses, read vs write)
  • 🚀 Performance costs of poor data locality

MemViz is designed as a CLI tool + Python library.
It integrates with Valgrind/Cachegrind and shows results in a clear, color-coded summary.


✨ Features

  • ✅ Run your C++ program under Valgrind/Cachegrind
  • ✅ Parse cache statistics into a clean report
  • ✅ Color-coded traffic light indicators (green/yellow/red)
  • ✅ Read vs Write miss rates shown side-by-side
  • ✅ Works with Docker fallback (for macOS/Apple Silicon)
  • ✅ Great for teaching cache locality, struct packing, and memory efficiency

🔧 Installation

From PyPI:

pip install memviz

🚀 Quickstart

  1. Compile your C++ program with debug info:
g++ -g -O2 ./examples/memTracker.cpp -o ./examples/memTracker
  1. Run MemViz Cachegrind:
memviz cachegrind ./examples/memTracker
  1. See results:
=======================  SUMMARY   =======================
INSTRUCTIONS MISS RATE: 
        1. L1 I-cache miss rate: 0.1%         2. Last-level instruction miss rate: 0.1% ✅

DATA MISS RATE: 
        1. L1 D-cache miss rate: 1.94%         2. Last-level D-cache miss rate: 1.21% 🟨

OVERALL LAST LEVEL MISS RATE: 66.56% 🔴

READ       vs    WRITE     
-------------------------
3.6%          1.95% 

📦 Docker Support

On macOS (especially ARM/M1/M2), Valgrind may not be available. MemViz automatically falls back to Docker if needed.

📚 Documentation

•	CLI Usage Guide
•	Valgrind Documentation
•	Background on Cache Locality

🛠 Development

Clone and install in editable mode:

git clone https://github.com/yourname/memviz.git
cd memviz
pip install -e .

📄 License

This project is licensed under the MIT License. See the LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

memviz-1.2.2.tar.gz (5.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

memviz-1.2.2-py3-none-any.whl (3.9 kB view details)

Uploaded Python 3

File details

Details for the file memviz-1.2.2.tar.gz.

File metadata

  • Download URL: memviz-1.2.2.tar.gz
  • Upload date:
  • Size: 5.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.8

File hashes

Hashes for memviz-1.2.2.tar.gz
Algorithm Hash digest
SHA256 0186a0feb81a3059f89f7177962c87bb0b6d297565de4fc6ffde4005047573e5
MD5 4bdfef20c079806e0ebf4ceab6af9fb9
BLAKE2b-256 ff64441e54fc2ea0b6817e789c247ba99cc88cfdd160dcd97c84ce7d90193475

See more details on using hashes here.

File details

Details for the file memviz-1.2.2-py3-none-any.whl.

File metadata

  • Download URL: memviz-1.2.2-py3-none-any.whl
  • Upload date:
  • Size: 3.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.8

File hashes

Hashes for memviz-1.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 cfdeef9a3f80fc3b647dad3244f1bc1956ecf74ce9ddca2b86a75a1ec7eb5645
MD5 e718aca20beffc1044560be37e680030
BLAKE2b-256 6037dd1c0ba7296168141a80c831604fe3cf9738b7e9a96058a75a13c34cb3b4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page