Last updated: 2020-10-14
Cache simulation in order to obtain performance metrics
- Brown Ramírez, Timna Belinda B61254
- Esquivel Molina, Brandon B52571
- Ramírez Hernández, Jonathan B55730
Code baseline for IE0521 cache simulation project on Ubutu 14.04
Make sure gtest is install:
$ sudo apt-get update
$ sudo apt-get install libgtest-dev
$ sudo apt-get install cmake # install cmake
$ cd /usr/src/gtest
$ sudo cmake CMakeLists.txt
$ sudo make
See https://cit.dixie.edu/faculty/larsen/google-test-installation.php for more information
Create a build directory and run all targets there
>> mkdir build
>> cd build
>> cmake ..
>> make <target> (cache or cachetest)
The simulation executable is located inside the build directory (src/cache). All commands are executed within Cache-Performance Simulation, the rest of the relative paths have already been considered.
gunzip -c <trace> | <l1cache executable> -a <associativity> -s <cache size KB> -l <block size in bytes> -rp <replacement policy>
Using - LRU, NRU, RRIP or RANDOM
Ex: gunzip -c ./input/mcf.trace.gz | ./build/src/cache -t 32 -a 4 -l 64 -rp 0
Go to build and make cachetest. There are several options to run the tests.
- Run all tests:
./test/cachetest
- Run only one test:
P.D: All commands are executed within Cache-Performance Simulation, the rest of the relative paths have already been considered.
./test/cachetest --gtest_filter=<test_name>
##### Google's gtest framework
Ex: ./build/test/cachetest --gtest_filter=L1cache.hit_miss_srrip
Ex: ./build/test/cachetest --gtest_filter=L1cache.hit_miss_lru
Ex: ./build/test/cachetest --gtest_filter=L1cache.hit_miss_nru
###### Advanced Optimizations
Ex: ./build/test/cachetest --gtest_filter=L2cache.l1_hit_l2_hit
Ex: ./build/test/cachetest --gtest_filter=VCcache.l1_miss_vc_hit
- Run a set of test using regular expressions
./test/cachetest --gtest_filter=<regexp>
./test/cachetest --gtest_filter=VC*
- Run a test n times:
./test/cachetest --gtest_filter=<test_name> --gtest_repeat=<n>
Ex: ./test/cachetest --gtest_filter=L1cache.hit_miss_srrip --gtest_repeat=2
- Replicate test results:
Each test is run with base seed, to replicate the result the same seed must be used
./test/cachetest --gtest_filter=<test_name> --gtest_random_seed=<test_seed>
./test/cachetest --gtest_filter=L1cache.hit_miss_srrip --gtest_random_seed=2126
To enable further debug on the test you need to enable debug_on variable, on your terminal run:
export TEST_DEBUG=1
To disable the extra logging, set the environment variable to zero.