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.1.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.1-py3-none-any.whl (3.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: memviz-1.2.1.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.1.tar.gz
Algorithm Hash digest
SHA256 c0b67158f19b73c31bcabfe27402127dbcb8b733e2256a21811b3b9171f7916a
MD5 a94cb77f052890a3081031a61a1ac829
BLAKE2b-256 e0d44f5417935908895b5a0d3928db8416212b3d3feea074b6509daf6c204444

See more details on using hashes here.

File details

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

File metadata

  • Download URL: memviz-1.2.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f821554b38cf0410da68c012546f0665dfb7c6cc4e4c9c797625a9bfe6154a25
MD5 1bf15cc7245292fc973992168f30836f
BLAKE2b-256 cb69671b3604b3e36a5a3d29832f2e386a865c9ddd69283be2c7f780285b7a3a

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