diff --git a/include/xo/arena/DArenaHashMap.hpp b/include/xo/arena/DArenaHashMap.hpp index da0e742..c40f692 100644 --- a/include/xo/arena/DArenaHashMap.hpp +++ b/include/xo/arena/DArenaHashMap.hpp @@ -55,9 +55,11 @@ namespace xo { public: /** create hash map **/ - DArenaHashMap(size_type hint_max_capacity, + DArenaHashMap(const std::string & name, + size_type hint_max_capacity, bool debug_flag = false); - DArenaHashMap(Hash && hash = Hash(), + DArenaHashMap(const std::string & name, + Hash && hash = Hash(), Equal && eq = Equal(), size_type hint_max_capacity = 0, bool debug_flag = false); @@ -196,9 +198,10 @@ namespace xo { }; template - DArenaHashMap::DArenaHashMap(size_type hint_max_capacity, + DArenaHashMap::DArenaHashMap(const std::string & name, + size_type hint_max_capacity, bool debug_flag) - : DArenaHashMap(Hash(), Equal(), hint_max_capacity, debug_flag) + : DArenaHashMap(name, Hash(), Equal(), hint_max_capacity, debug_flag) { } @@ -207,13 +210,14 @@ namespace xo { * last 16 bytes will be copy of first 16 bytes */ template - DArenaHashMap::DArenaHashMap(Hash && hash, + DArenaHashMap::DArenaHashMap(const std::string & name, + Hash && hash, Equal && eq, size_type hint_max_capacity, bool debug_flag) : hash_{std::move(hash)}, equal_{std::move(eq)}, - store_{"arenahashmap", lub_exp2(lub_group_mult(hint_max_capacity))}, + store_{name, lub_exp2(lub_group_mult(hint_max_capacity))}, debug_flag_{debug_flag} { } diff --git a/include/xo/arena/MemorySizeInfo.hpp b/include/xo/arena/MemorySizeInfo.hpp index f12dcce..540453f 100644 --- a/include/xo/arena/MemorySizeInfo.hpp +++ b/include/xo/arena/MemorySizeInfo.hpp @@ -5,6 +5,7 @@ #pragma once +#include #include #include diff --git a/include/xo/arena/hashmap/HashMapStore.hpp b/include/xo/arena/hashmap/HashMapStore.hpp index 22bfb12..3485022 100644 --- a/include/xo/arena/hashmap/HashMapStore.hpp +++ b/include/xo/arena/hashmap/HashMapStore.hpp @@ -32,11 +32,11 @@ namespace xo { n_slot_{group_exp2.second * c_group_size}, control_{control_vector_type::map (xo::mm::ArenaConfig{ - .name_ = name, + .name_ = name + "-ctl", .size_ = control_size(n_slot_)})}, slots_{slot_vector_type::map (xo::mm::ArenaConfig{ - .name_ = name, + .name_ = name + "-slots", .size_ = n_slot_ * sizeof(value_type)})} { /* here: arenas have allocated address range, but no committed memory yet */ diff --git a/src/arena/DCircularBuffer.cpp b/src/arena/DCircularBuffer.cpp index 667126a..372462f 100644 --- a/src/arena/DCircularBuffer.cpp +++ b/src/arena/DCircularBuffer.cpp @@ -75,7 +75,7 @@ namespace xo { mapped_range_{reserved_range_.prefix(0)}, occupied_range_{mapped_range_.prefix(0)}, input_range_{occupied_range_.prefix(0)}, - pinned_spans_{} + pinned_spans_{DArenaVector::map(ArenaConfig().with_name(config.name_ + "-pins"))} { } diff --git a/utest/DArenaHashMap.test.cpp b/utest/DArenaHashMap.test.cpp index bc672c8..02ac3fc 100644 --- a/utest/DArenaHashMap.test.cpp +++ b/utest/DArenaHashMap.test.cpp @@ -24,7 +24,7 @@ namespace xo { { using HashMap = DArenaHashMap; - HashMap map; + HashMap map("utest"); REQUIRE(map.empty()); REQUIRE(map.size() == 0); @@ -36,7 +36,7 @@ namespace xo { { using HashMap = DArenaHashMap; - HashMap map(257); + HashMap map("utest", 257); REQUIRE(map.empty()); REQUIRE(map.size() == 0); @@ -49,7 +49,7 @@ namespace xo { { using HashMap = DArenaHashMap; - HashMap map; + HashMap map("utest"); REQUIRE(map.empty()); REQUIRE(map.size() == 0); @@ -209,7 +209,7 @@ namespace xo { */ for (std::uint32_t n = 0; n <= 8; ) { - HashMap hash_map; + HashMap hash_map("utest"); auto test_fn = [&rgen, &hash_map](bool dbg_flag, std::uint32_t n) @@ -245,7 +245,7 @@ namespace xo { using HashMap = DArenaHashMap; - HashMap map; + HashMap map("utest"); // copy keys here so we can print stuff std::vector key_v; @@ -336,7 +336,7 @@ namespace xo { { using HashMap = DArenaHashMap; - HashMap map(1024); + HashMap map("utest", 1024); REQUIRE(map.verify_ok());