summaryrefslogtreecommitdiff
path: root/gui
diff options
context:
space:
mode:
authorbd <bdunahu@operationnull.com>2025-04-26 23:49:35 -0400
committerbd <bdunahu@operationnull.com>2025-04-26 23:49:35 -0400
commit270d5c95c46385b7f8c3ad5ffd1adb4ac5a43acb (patch)
tree49ac24e66f02c2d7ceb589d28c5fab593059d0c4 /gui
parentd449750f789076459de8d47c2960a1279e543c32 (diff)
Fix bug which caused a very large allocation
Diffstat (limited to 'gui')
-rw-r--r--gui/gui.cc9
-rw-r--r--gui/util.cc2
-rw-r--r--gui/worker.cc2
3 files changed, 5 insertions, 8 deletions
diff --git a/gui/gui.cc b/gui/gui.cc
index 7df1bfc..6e7da5f 100644
--- a/gui/gui.cc
+++ b/gui/gui.cc
@@ -358,16 +358,13 @@ void GUI::make_tabs(int num)
e = new StorageView(0, this);
} else if (i == num - 1) {
n = "DRAM";
- e = new StorageView(4, this);
+ e = new StorageView(MEM_LINES, this);
} else {
n = QString("L%1").arg(i);
e = new StorageView(
- // cache_size_mapper(this->curr_cache_levels-1, i-1)
- 4, this);
+ (1 << cache_size_mapper(this->curr_cache_levels - 1, i - 1)),
+ this);
}
- std::cout << "total levels: " << num << ":"
- << this->curr_cache_levels - 1 << " level: " << i
- << std::endl;
t = new QTableView(ui->storage);
t->setModel(e);
diff --git a/gui/util.cc b/gui/util.cc
index 21bf0be..f3486fb 100644
--- a/gui/util.cc
+++ b/gui/util.cc
@@ -5,7 +5,7 @@
int cache_size_mapper(int total_levels, int level)
{
const int y_min = 4;
- const int y_max = MEM_LINES - 2;
+ const int y_max = MEM_LINE_SPEC - 2;
double f, r;
if (total_levels <= 1)
diff --git a/gui/worker.cc b/gui/worker.cc
index 93ccbea..f490fb4 100644
--- a/gui/worker.cc
+++ b/gui/worker.cc
@@ -48,7 +48,7 @@ void Worker::configure(
for (i = ways.size(); i > 0; --i) {
s = static_cast<Storage *>(new Cache(
- s, cache_size_mapper(ways.size() - 1, i), ways.at(i - 1),
+ s, cache_size_mapper(ways.size() - 1, i - 1), ways.at(i - 1),
CACHE_DELAY + i));
this->s.push_front(s);
}