Giter Site home page Giter Site logo

0xreza / pymimircache Goto Github PK

View Code? Open in Web Editor NEW

This project forked from 1a1a11a/pymimircache

1.0 1.0 0.0 9.05 MB

cache analysis platform developed at Emory University

Home Page: http://mimircache.info

License: GNU General Public License v3.0

C 28.61% Python 71.39%

pymimircache's Introduction

PyMimircache

Build Status Documentation Status GitHub version PyPI version

PyMimircache is a cache trace analysis platform that supports

  • comparison of different cache replacement algorithms

  • visualization of cache traces

  • easy plugging in your own cache replacement algorithm

Current support algorithms include Least Recent Used(LRU), Least Frequent Used(LFU), Most Recent Used(MRU), First In First Out(FIFO), Segmented LRU(SLRU), Clock, Random, Optimal, Adaptive Replacement Cache(ARC).

And we are actively adding more cache replacement algorithms.

Best of all is that you can easily and quickly implement your own cache replacement algorithm. See more information here

Dependency and Installation

System-wide library: glib, python3-pip, python3-matplotlib

On Ubuntu using the following command to install

jason@myMachine: ~$ sudo apt-get install libglib2.0-dev python3-pip python3-matplotlib

Python Dependency: numpy, scipy, matplotlib, heapdict, mmh3

jason@myMachine: ~$ sudo pip3 install heapdict mmh3

Installing PyMimircache

jason@myMachine: ~$ sudo pip3 install PyMimircache

Compatibility

PyMimircache only support Python3 and 64bit platform  

git clone

git clone needs to add --recurse-submodules option to automatically clone the CMimircache module.

Alternative using docker

As an alternative, you can use PyMimircache in a docker container, according to our simple benchmark, the performance difference between using a bare metal and a docker container is less than 10%.

Use interactive shell

To enter an interactive shell and do plotting, you can use

jason@myMachine: ~$ sudo docker run -it --rm -v $(pwd):/PyMimircache/scripts -v PATH/TO/DATA:/PyMimircache/data 1a1a11a/PyMimircache /bin/bash

After you run this command, you will be in a shell with everything ready, your current directory is mapped to /PyMimircache/scripts/ and your data directory is mapped to /PyMimircache/data. In addition, we have prepared a test dataset for you at /PyMimircache/testData.  

Run scripts directly

If you don't want to use an interactive shell and you have your script ready, then you can do

jason@myMachine: ~$ docker run --rm -v $(pwd):/PyMimircache/scripts -v PATH/TO/DATA:/PyMimircache/data 1a1a11a/PyMimircache python3 /PyMimircache/scripts/YOUR_PYTHON_SCRIPT.py

However, if you are new here or you have trouble using docker to run scripts directly, we suggest using interactive shell which can help you debug.

PyMimircache Tutorial

We have prepared a wonderful tutorial here. Check here for tutorial

PyMimircache Power

The power of PyMimircache

>>> import PyMimircache as m
>>> c = m.Cachecow()
>>> c.vscsi("trace.vscsi")      # find this data under data folder, other type of data supported too
>>> print(c.stat())
	# number of requests: 113872
	# number of uniq obj/blocks: 48974
	# cold miss ratio: 0.4301
	# top N popular (obj, num of requests):
	# [(3345071, 1630),
	#  (6160447, 1342),
	#  (6160455, 1341),
	#  (1313767, 652),
	#  (6160431, 360),
	#  (6160439, 360),
	#  (1313768, 326),
	#  (1329911, 326)]
	# number of obj/block accessed only once: 21049
	# frequency mean: 2.33
	# time span: 7200089885

>>> print(c.get_reuse_distance())
    # [-1 -1 -1 -1 -1 -1 11 7 11 8 8 8 -1 8]

>>> print(c.get_hit_ratio_dict("LRU", cache_size=20))
    # {0: 0.0, 1: 0.025256428270338627, 2: 0.031684698608964453, ... 20: 0.07794716875087819}

>>> c.plotHRCs(["LRU", "LFU", "Optimal"])

>>> c.heatmap('r', "hit_ratio_start_time_end_time", time_interval=10000000)
HRC Heatmap
Hit Ratio Curve Hit Ratio Heatmap

Next Major Releases

  • Architecture: re-write py-PyMimircache generalProfiler (v0.3.0)
  • Architecture: Separate py-PyMimircache and C-PyMimircache to allow them run independently (v0.4.0)
  • Feature: Add block/obj size into cache replacement algorithm (v0.5.0)
  • Feature: Add parallel support for LRUProfiling (v0.6.0)
  • Feature: Add sampling layer for all profilers (v0.7.0)
  • Feature: Add GPU profiling support (v0.8.0)
  • Feature: Add Windows Support (v1.0.0)
  • Architecture: C component optimization and allow to be used as an independent caching layer (v2.0.0)

Contributing

You are more than welcome to make any contributions. Please create Pull Request for any changes.

LICENSE

PyMimircache is provided under GPLv3 license.

pymimircache's People

Contributors

1a1a11a avatar 0xreza avatar ymirv avatar shureed avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.