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.3.tar.gz (9.8 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.3-py3-none-any.whl (8.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: memviz-1.2.3.tar.gz
  • Upload date:
  • Size: 9.8 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.3.tar.gz
Algorithm Hash digest
SHA256 6dbf8c617fc05164f8f90441b00f84dfaf4ab45f9fbd66872bfd7450c16e4321
MD5 f56d3532dae93059817a20a74eb776ea
BLAKE2b-256 e0a107c285c4502f2444a64b45534a4a8a4ae7622184709dbbcf87727b84d685

See more details on using hashes here.

File details

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

File metadata

  • Download URL: memviz-1.2.3-py3-none-any.whl
  • Upload date:
  • Size: 8.0 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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 7e9bc6bcf4291311ecf583590b41f8d055a553ea108be69e9461b8462e98716f
MD5 44aa60e697d930823f1fa1edf404b739
BLAKE2b-256 3cd13f6027fdfa35671f45ef29097e44d8960add375a0755a3c35a40fd264643

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