summaryrefslogtreecommitdiff
path: root/render-test/allocation_index.cpp
diff options
context:
space:
mode:
authorMikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com>2019-08-27 11:38:17 +0300
committerMikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com>2019-08-27 12:34:09 +0300
commit766392f1f88c03b4d5b5a4b3ef59aab322fcb3c7 (patch)
tree32f5cfd13a1494ffbdb7db23d9d8a2152a2c4d2f /render-test/allocation_index.cpp
parent1b020eeb1195a7afcac35c263220cd3568a4bc69 (diff)
downloadqtlocation-mapboxgl-766392f1f88c03b4d5b5a4b3ef59aab322fcb3c7.tar.gz
[test runner] Use allocation peak values for memory metrics
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;
+}