base-stats: fix storage initializing
Commit (70194795c3) introduced std::vector with resize() to initializing all storages. This method caused data duplication in statistics. Storage is now initialized using loops.
Change-Id: I4350863a83671fc10cc02b5cb7d3b38e6cf4f565
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/50747
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
Reviewed-by: Hoa Nguyen <hoanguyen@ucdavis.edu>
Maintainer: Bobby R. Bruce <bbruce@ucdavis.edu>
Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
committed by
Bobby R. Bruce
parent
082f0835b0
commit
59c4fd07cb
@@ -952,7 +952,10 @@ class VectorBase : public DataWrapVec<Derived, VectorInfoProxy>
|
||||
fatal_if(s <= 0, "Storage size must be positive");
|
||||
fatal_if(check(), "Stat has already been initialized");
|
||||
|
||||
storage.resize(s, new Storage(this->info()->getStorageParams()));
|
||||
storage.reserve(s);
|
||||
for (size_type i = 0; i < s; ++i)
|
||||
storage.push_back(new Storage(this->info()->getStorageParams()));
|
||||
|
||||
this->setInit();
|
||||
}
|
||||
|
||||
@@ -1178,7 +1181,10 @@ class Vector2dBase : public DataWrapVec2d<Derived, Vector2dInfoProxy>
|
||||
info->x = _x;
|
||||
info->y = _y;
|
||||
|
||||
storage.resize(x * y, new Storage(info->getStorageParams()));
|
||||
storage.reserve(x * y);
|
||||
for (size_type i = 0; i < x * y; ++i)
|
||||
storage.push_back(new Storage(this->info()->getStorageParams()));
|
||||
|
||||
this->setInit();
|
||||
|
||||
return self;
|
||||
@@ -1387,7 +1393,10 @@ class VectorDistBase : public DataWrapVec<Derived, VectorDistInfoProxy>
|
||||
fatal_if(s <= 0, "Storage size must be positive");
|
||||
fatal_if(check(), "Stat has already been initialized");
|
||||
|
||||
storage.resize(s, new Storage(this->info()->getStorageParams()));
|
||||
storage.reserve(s);
|
||||
for (size_type i = 0; i < s; ++i)
|
||||
storage.push_back(new Storage(this->info()->getStorageParams()));
|
||||
|
||||
this->setInit();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user