- clone this repository
git clone https://github.com/Barkir/VladimirovTasks
- create build directory
mkdir build
- run cmake from build dir
cd build
cmake ..
- compile from build dir
cmake --build .
- you will get two targets -
lirsandlru(hopefully).
Now for testing you can use run_tests.py
you can choose LRU, LIRS, IDEAL testing.
you'll need those libraries.
pip3 install questionary
pip3 install pathlibWrite your tests in tests directory in this fmt
1 : TEST_NAME (no spaces!!!)
2 : cache_size
3 : number of page calls
4 : call seqeunce
5 : number of hits you wait for
Then make run_tests.sh executable
chmod +x run_tests.sh
and run it
./run_tests.sh
Testing infrastructure of LIRS cache will differ from LRU. There is a class called LIRS Stats whhere we collect these data:
size_t hitssize_t misses
The LIRS cache will have two get functions - one is for regular use and one is for testing.
T& get(int key) {
return getFunc(key, true);
}
T& getWithStats(int key) {
return getFunc(key, false)
}To write a test - use this format:
{lir_size} {hir_size} {number of calls} {call sequence}
Then run program like this:
./lirs < test.txt
Then it prints you this info:
- Total hits
- Total misses
- Hit Rate
That's all 4 today.