libCacheSim Python Bindings¶
Welcome to libCacheSim Python bindings! This is a high-performance cache simulation library with Python interface.
Overview¶
libCacheSim is a high-performance cache simulation framework that supports various cache algorithms and trace formats. The Python bindings provide an easy-to-use interface for cache simulation, analysis, and research.
Key Features¶
- High Performance: Built on top of the optimized C++ libCacheSim library
- Multiple Cache Algorithms: Support for LRU, LFU, FIFO, ARC, Clock, S3FIFO, Sieve, and many more
- Trace Support: Read various trace formats (CSV, binary, OracleGeneral, etc.)
- Synthetic Traces: Generate synthetic workloads with Zipf and uniform distributions
- Analysis Tools: Built-in trace analysis and cache performance evaluation
- Easy Integration: Simple Python API for research and production use
Quick Example¶
import libcachesim as lcs
# Create a cache
cache = lcs.LRU(cache_size=1024*1024) # 1MB cache
# Generate synthetic trace
reader = lcs.SyntheticReader(
num_of_req=10000,
obj_size=1024,
dist="zipf",
alpha=1.0
)
# Simulate cache behavior
hit_count = 0
for req in reader:
if cache.get(req):
hit_count += 1
hit_ratio = hit_count / reader.get_num_of_req()
print(f"Hit ratio: {hit_ratio:.4f}")
Installation¶
Or install from source:
Getting Started¶
Check out our Quick Start Guide to begin using libCacheSim Python bindings, or explore the API Reference for detailed documentation.
Contributing¶
We welcome contributions! Please see our GitHub repository for more information.
License¶
This project is licensed under the Apache License 2.0.