ksameersrk / cachediff

Localized cache analysis of C/C++ programs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cachediff Build Status

Cachediff is a tool to study the effect of cache performance between two versions (differing from each other by a small diff/delta) of the same C/C++ program. This is useful to students, educationist and professionals. Cachediff presents to the user a localized and global view of the cache and its statistics. It uses cache simulation based on instruction/memory tracing during execution. It can be extended to support n-versions of the same program.

Usage

Docker (Built with Ubuntu as base, not alpine. Sorry for the big size!)

# Clone this Repo
git clone https://github.com/ksameersrk/cachediff /tmp/cachediff

# Run the Simulation using the image: ksameersrk/cachediff
docker run -v /tmp/cachediff/examples:/app/examples ksameersrk/cachediff examples/matrix/row_wise_traversal.c examples/matrix/column_wise_traversal.c examples/matrix/input100.txt examples/matrix/input100.txt

Build from source and Run

python cachediff.py program1.c program2.c input1.c input2.c

To run the test-suite

nosetests

Example output

Sample Cachediff output

Requirements

export PIN=/path/to/pin/folder
export DINERO=/path/to/dinero/folder
  • Disable ASLR(Dont forget to revert once done, this is a SECURITY HAZARD)

Instruction Manual

  1. Download the github-repo of Cachediff and extract the tar file.

  2. Download the Intel Pin and extract the tar file and rename the folder to "pin".

  3. Download the DineroIV and extract the tar file and rename the folder to dinero.

  4. Now replace the MyPinTool folder from

your_present_directory/pin/source/tools/MyPinTool to your_present_directory/cachediff/pin/source/tools/MyPinTool

This can be done by

your_present_directory$: rm -r pin/source/tools/MyPinTool
your_present_directory$: cp your_present_directory/cachediff/pin/source/tools/MyPinTool    pin/source/tools/
  1. Make the Intel Pin
your_present_directory$: cd pin/source/tools/
your_present_directory$: ./configure && make
your_present_directory$: cd ../../..
  1. Make the DineroIV
your_present_directory$: cd dinero
your_present_directory$: make
your_present_directory$: cd ..
  1. Set environmental variables :
your_present_directory$: echo "export PIN=/path/to/pin/folder" >> ~/.bashrc
your_present_directory$: echo "export DINERO=/path/to/dinero/folder" >> ~/.bashrc
your_present_directory$: source ~/.bashrc
  1. Disable ASLR
your_present_directory$: setarch `uname -m` -R /bin/bash

(Dont forget to revert once done, this is a SECURITY HAZARD)

  1. Now you are ready to run the script,
python3 cachediff.py program1.c program2.c input_stream1.txt input_stream2.txt

where,

  • program1.c - the original program
  • program2.c - the modified version of the original program
  • input_stream1 - input to program1
  • input_stream2 - input to program2

About

Localized cache analysis of C/C++ programs

License:MIT License


Languages

Language:Python 83.4%Language:C++ 9.5%Language:C 3.9%Language:Dockerfile 1.8%Language:Makefile 1.5%