summaryrefslogtreecommitdiff
path: root/render-test/allocation_index.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'render-test/allocation_index.cpp')
-rw-r--r--render-test/allocation_index.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/render-test/allocation_index.cpp b/render-test/allocation_index.cpp
index 12ac7b5b77..144c18ddd5 100644
--- a/render-test/allocation_index.cpp
+++ b/render-test/allocation_index.cpp
@@ -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;
+}