[test runner] Use allocation peak values for memory metrics
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
namespace {
|
||||
|
||||
std::atomic_size_t indexedMemorySize{0};
|
||||
std::atomic_size_t indexedMemoryPeak{0};
|
||||
std::atomic_size_t allocationsCount{0};
|
||||
std::unordered_map<void*, size_t> memoryIndex;
|
||||
std::atomic_bool suppresIndexing{false};
|
||||
@@ -30,6 +31,7 @@ void addToIndex(std::size_t sz, void* ptr) {
|
||||
FlagGuard flk(suppresIndexing);
|
||||
allocationsCount++;
|
||||
indexedMemorySize += sz;
|
||||
if (indexedMemoryPeak < indexedMemorySize) indexedMemoryPeak = size_t(indexedMemorySize);
|
||||
memoryIndex[ptr] = sz;
|
||||
}
|
||||
|
||||
@@ -67,6 +69,7 @@ void AllocationIndex::reset() {
|
||||
memoryIndex.clear();
|
||||
indexedMemorySize = 0;
|
||||
allocationsCount = 0;
|
||||
indexedMemoryPeak = 0;
|
||||
}
|
||||
|
||||
// static
|
||||
@@ -91,3 +94,8 @@ size_t AllocationIndex::getAllocatedSize() {
|
||||
size_t AllocationIndex::getAllocationsCount() {
|
||||
return allocationsCount;
|
||||
}
|
||||
|
||||
// static
|
||||
size_t AllocationIndex::getAllocatedSizePeak() {
|
||||
return indexedMemoryPeak;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user