Skip to content

Commit

Permalink
updates + md update
Browse files Browse the repository at this point in the history
  • Loading branch information
andreas789 committed Jun 19, 2024
1 parent e9a03c2 commit f5b5782
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 89 deletions.
Binary file modified cmake-build-debug/.ninja_deps
Binary file not shown.
87 changes: 6 additions & 81 deletions cmake-build-debug/.ninja_log
Original file line number Diff line number Diff line change
@@ -1,85 +1,10 @@
# ninja log v5
3 746 1718460180564629017 CMakeFiles/bufferManagerProject.dir/src/SmartArrayMemoryManager.cpp.o 7f1573e03b2eb3a6
3 775 1718833540182560596 CMakeFiles/bufferManagerProject.dir/src/SmartArrayMemoryManager.cpp.o 7f1573e03b2eb3a6
9 45 1718544638906371496 build.ninja e9aefb95373ef292
3 550 1718460681951179444 CMakeFiles/bufferManagerProject.dir/main.cpp.o 866b5549a2fdfccb
550 630 1718460682031185234 bufferManagerProject a00b8fdaa17764c9
2 612 1718833540022547916 CMakeFiles/bufferManagerProject.dir/main.cpp.o 866b5549a2fdfccb
775 850 1718833540258566618 bufferManagerProject a00b8fdaa17764c9
3 726 1717008790170251735 CMakeFiles/bufferManagerProject.dir/src/MemoryManager.cpp.o 7e4148196a171da3
3 22 1718131034642616877 CMakeFiles/bufferManagerProject.dir/test/SmartArrayMemoryManagerTests.cpp.o 1370a7426046ddb0
2 562 1718544901544529035 CMakeFiles/bufferManagerProject.dir/main.cpp.o 866b5549a2fdfccb
562 665 1718544901644537065 bufferManagerProject a00b8fdaa17764c9
2 528 1718545170320050548 CMakeFiles/bufferManagerProject.dir/main.cpp.o 866b5549a2fdfccb
528 601 1718545170392058443 bufferManagerProject a00b8fdaa17764c9
2 769 1718545547168275031 CMakeFiles/bufferManagerProject.dir/src/SmartArrayMemoryManager.cpp.o 7f1573e03b2eb3a6
769 844 1718545547244279675 bufferManagerProject a00b8fdaa17764c9
2 714 1718545612098515574 CMakeFiles/bufferManagerProject.dir/src/SmartArrayMemoryManager.cpp.o 7f1573e03b2eb3a6
3 810 1718545634721353826 CMakeFiles/bufferManagerProject.dir/src/SmartArrayMemoryManager.cpp.o 7f1573e03b2eb3a6
810 891 1718545634801363665 bufferManagerProject a00b8fdaa17764c9
2 551 1718545711218176351 CMakeFiles/bufferManagerProject.dir/main.cpp.o 866b5549a2fdfccb
551 623 1718545711290184158 bufferManagerProject a00b8fdaa17764c9
2 545 1718545781533437323 CMakeFiles/bufferManagerProject.dir/main.cpp.o 866b5549a2fdfccb
545 620 1718545781609444810 bufferManagerProject a00b8fdaa17764c9
3 713 1718545861272939346 CMakeFiles/bufferManagerProject.dir/src/SmartArrayMemoryManager.cpp.o 7f1573e03b2eb3a6
713 787 1718545861348946190 bufferManagerProject a00b8fdaa17764c9
3 795 1718545959265385331 CMakeFiles/bufferManagerProject.dir/src/SmartArrayMemoryManager.cpp.o 7f1573e03b2eb3a6
795 870 1718545959337391289 bufferManagerProject a00b8fdaa17764c9
1 767 1718545985003495762 CMakeFiles/bufferManagerProject.dir/src/SmartArrayMemoryManager.cpp.o 7f1573e03b2eb3a6
767 840 1718545985075501609 bufferManagerProject a00b8fdaa17764c9
3 756 1718546171741900678 CMakeFiles/bufferManagerProject.dir/src/SmartArrayMemoryManager.cpp.o 7f1573e03b2eb3a6
756 834 1718546171821906591 bufferManagerProject a00b8fdaa17764c9
3 546 1718546335601718556 CMakeFiles/bufferManagerProject.dir/main.cpp.o 866b5549a2fdfccb
3 716 1718546335769730432 CMakeFiles/bufferManagerProject.dir/src/SmartArrayMemoryManager.cpp.o 7f1573e03b2eb3a6
716 803 1718546335857736652 bufferManagerProject a00b8fdaa17764c9
2 518 1718546393909817464 CMakeFiles/bufferManagerProject.dir/main.cpp.o 866b5549a2fdfccb
518 588 1718546393977822221 bufferManagerProject a00b8fdaa17764c9
2 527 1718546525662950475 CMakeFiles/bufferManagerProject.dir/main.cpp.o 866b5549a2fdfccb
527 600 1718546525734955430 bufferManagerProject a00b8fdaa17764c9
2 734 1718546646389916852 CMakeFiles/bufferManagerProject.dir/src/SmartArrayMemoryManager.cpp.o 7f1573e03b2eb3a6
735 811 1718546646465926703 bufferManagerProject a00b8fdaa17764c9
1 762 1718546781018471635 CMakeFiles/bufferManagerProject.dir/src/SmartArrayMemoryManager.cpp.o 7f1573e03b2eb3a6
762 829 1718546781086479581 bufferManagerProject a00b8fdaa17764c9
2 565 1718546820523025779 CMakeFiles/bufferManagerProject.dir/main.cpp.o 866b5549a2fdfccb
2 742 1718546820699045798 CMakeFiles/bufferManagerProject.dir/src/SmartArrayMemoryManager.cpp.o 7f1573e03b2eb3a6
742 817 1718546820771053986 bufferManagerProject a00b8fdaa17764c9
2 537 1718546841637410266 CMakeFiles/bufferManagerProject.dir/main.cpp.o 866b5549a2fdfccb
537 608 1718546841705417893 bufferManagerProject a00b8fdaa17764c9
1 746 1718547013103670317 CMakeFiles/bufferManagerProject.dir/src/SmartArrayMemoryManager.cpp.o 7f1573e03b2eb3a6
746 821 1718547013179678026 bufferManagerProject a00b8fdaa17764c9
2 718 1718547089611284732 CMakeFiles/bufferManagerProject.dir/src/SmartArrayMemoryManager.cpp.o 7f1573e03b2eb3a6
718 800 1718547089695292941 bufferManagerProject a00b8fdaa17764c9
2 713 1718547112125473161 CMakeFiles/bufferManagerProject.dir/src/SmartArrayMemoryManager.cpp.o 7f1573e03b2eb3a6
714 790 1718547112201480511 bufferManagerProject a00b8fdaa17764c9
2 718 1718547143804515467 CMakeFiles/bufferManagerProject.dir/src/SmartArrayMemoryManager.cpp.o 7f1573e03b2eb3a6
719 795 1718547143880522717 bufferManagerProject a00b8fdaa17764c9
1 622 1718547444575674346 CMakeFiles/bufferManagerProject.dir/main.cpp.o 866b5549a2fdfccb
2 550 1718547644092459928 CMakeFiles/bufferManagerProject.dir/main.cpp.o 866b5549a2fdfccb
2 552 1718547661637903073 CMakeFiles/bufferManagerProject.dir/main.cpp.o 866b5549a2fdfccb
3 747 1718547661833919170 CMakeFiles/bufferManagerProject.dir/src/SmartArrayMemoryManager.cpp.o 7f1573e03b2eb3a6
747 824 1718547661909925412 bufferManagerProject a00b8fdaa17764c9
2 789 1718547679879398641 CMakeFiles/bufferManagerProject.dir/src/SmartArrayMemoryManager.cpp.o 7f1573e03b2eb3a6
789 864 1718547679951404535 bufferManagerProject a00b8fdaa17764c9
2 548 1718547768366589018 CMakeFiles/bufferManagerProject.dir/main.cpp.o 866b5549a2fdfccb
2 756 1718547768574605804 CMakeFiles/bufferManagerProject.dir/src/SmartArrayMemoryManager.cpp.o 7f1573e03b2eb3a6
756 823 1718547768638610969 bufferManagerProject a00b8fdaa17764c9
1 575 1718547801577262501 CMakeFiles/bufferManagerProject.dir/main.cpp.o 866b5549a2fdfccb
575 647 1718547801645267963 bufferManagerProject a00b8fdaa17764c9
2 767 1718547868266594330 CMakeFiles/bufferManagerProject.dir/src/SmartArrayMemoryManager.cpp.o 7f1573e03b2eb3a6
767 852 1718547868350601017 bufferManagerProject a00b8fdaa17764c9
2 740 1718547948576957286 CMakeFiles/bufferManagerProject.dir/src/SmartArrayMemoryManager.cpp.o 7f1573e03b2eb3a6
740 810 1718547948644962649 bufferManagerProject a00b8fdaa17764c9
2 762 1718548111669719554 CMakeFiles/bufferManagerProject.dir/src/SmartArrayMemoryManager.cpp.o 7f1573e03b2eb3a6
762 837 1718548111745725460 bufferManagerProject a00b8fdaa17764c9
3 800 1718550144787887227 CMakeFiles/bufferManagerProject.dir/src/SmartArrayMemoryManager.cpp.o 7f1573e03b2eb3a6
800 875 1718550144863894143 bufferManagerProject a00b8fdaa17764c9
7 806 1718742690390381310 CMakeFiles/bufferManagerProject.dir/main.cpp.o 866b5549a2fdfccb
806 907 1718742690490405158 bufferManagerProject a00b8fdaa17764c9
1 586 1718742737894910382 CMakeFiles/bufferManagerProject.dir/main.cpp.o 866b5549a2fdfccb
586 659 1718742737966920024 bufferManagerProject a00b8fdaa17764c9
1 591 1718742926095872487 CMakeFiles/bufferManagerProject.dir/main.cpp.o 866b5549a2fdfccb
591 660 1718742926163875438 bufferManagerProject a00b8fdaa17764c9
2 615 1718742936492320151 CMakeFiles/bufferManagerProject.dir/main.cpp.o 866b5549a2fdfccb
615 685 1718742936560323055 bufferManagerProject a00b8fdaa17764c9
1 598 1718743067564426151 CMakeFiles/bufferManagerProject.dir/main.cpp.o 866b5549a2fdfccb
598 675 1718743067640433547 bufferManagerProject a00b8fdaa17764c9
2 578 1718746593985750477 CMakeFiles/bufferManagerProject.dir/main.cpp.o 866b5549a2fdfccb
2 768 1718746594173781171 CMakeFiles/bufferManagerProject.dir/src/SmartArrayMemoryManager.cpp.o 7f1573e03b2eb3a6
768 858 1718746594265796191 bufferManagerProject a00b8fdaa17764c9
1 563 1718833859183308086 CMakeFiles/bufferManagerProject.dir/main.cpp.o 866b5549a2fdfccb
1 733 1718833859351320894 CMakeFiles/bufferManagerProject.dir/src/SmartArrayMemoryManager.cpp.o 7f1573e03b2eb3a6
734 814 1718833859431326992 bufferManagerProject a00b8fdaa17764c9
Binary file not shown.
4 changes: 2 additions & 2 deletions cmake-build-debug/Testing/Temporary/LastTest.log
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Start testing: Jun 19 00:36 EEST
Start testing: Jun 20 00:50 EEST
----------------------------------------------------------
End testing: Jun 19 00:36 EEST
End testing: Jun 20 00:50 EEST
Binary file modified cmake-build-debug/bufferManagerProject
Binary file not shown.
12 changes: 9 additions & 3 deletions main.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
//
// Created by andreas on 29/5/2024.

#include <iostream>
#include <cstring>
#include <cassert> // Include for assertions
#include "src/SmartArrayMemoryManager.h" // Include your header
#include <cassert>
#include "src/SmartArrayMemoryManager.h"

using namespace std;

Expand Down Expand Up @@ -99,7 +102,6 @@ int main() {

// Assert that we have at least 2 physical pages after the tests
assert(memManager.getPhysicalPages().size() >= 2);
cout << "\nFinal physical pages: " << memManager.getPhysicalPages().size() << endl;



Expand All @@ -113,6 +115,9 @@ int main() {
cerr << "Error: Multiple allocations on different virtual pages failed." << endl;
}




// Test 7: Boundary Test for Slots
cout << "\nTest 7: Boundary Test for Slots:" << endl;
void *lastSlot = memManager.allocateSlot(0, SLOTS_PER_PAGE - 1);
Expand All @@ -122,6 +127,7 @@ int main() {
cerr << "Error: Allocation at boundary slot failed." << endl;
}

cout << "\nAll tests passed!" << endl;

return 0; // Test passed
}
6 changes: 3 additions & 3 deletions src/SmartArrayMemoryManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,13 @@ void MemoryManager::mapVirtualPageToPhysicalPage(size_t virtualPageId, void *phy
void* MemoryManager::allocateSlot(size_t virtualPageId, size_t slotId) {

if(virtualPageId >= virtualPages_.size()) {
cerr << 'Invalid page ID. ID should be less than ' << INITIAL_VIRTUAL_PAGES << endl ;
cerr << "Invalid page ID. ID should be less than " << INITIAL_VIRTUAL_PAGES << endl ;
return nullptr;
}

void* physicalPage = virtualPages_[virtualPageId];
if(physicalPage == nullptr) {
cerr << 'No physical page as mapped to this virtual page!';
cerr << "No physical page as mapped to this virtual page!";
return nullptr;

}
Expand All @@ -79,7 +79,7 @@ void* MemoryManager::allocateSlot(size_t virtualPageId, size_t slotId) {
void* slotAddress = static_cast<char*>(physicalPage) + offset;

if(arrMetadata_[slotAddress].occupiedFlg) {
cerr << 'The specified slot is already occupied! Will try to resolve conflict.';
// The specified slot is already occupied! Will try to resolve conflict
resolveConflict(virtualPageId, slotId);
physicalPage = virtualPages_[virtualPageId];
slotAddress = static_cast<char*>(physicalPage) + offset;
Expand Down
2 changes: 2 additions & 0 deletions src/SmartArrayMemoryManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ class MemoryManager {
*/
void* getSlot(size_t virtualPageId, size_t slotId);



const vector<void*>& getPhysicalPages() const {
return physicalPages_;
}
Expand Down

0 comments on commit f5b5782

Please sign in to comment.