diff options
Diffstat (limited to 'include')
| -rw-r--r-- | include/framework/DynamicExtension.h | 4 | ||||
| -rw-r--r-- | include/framework/structure/ExtensionStructure.h | 2 | ||||
| -rw-r--r-- | include/shard/Alias.h | 2 | ||||
| -rw-r--r-- | include/shard/AugBTree.h | 2 | ||||
| -rw-r--r-- | include/shard/FSTrie.h | 8 | ||||
| -rw-r--r-- | include/shard/ISAMTree.h | 14 | ||||
| -rw-r--r-- | include/shard/PGM.h | 6 | ||||
| -rw-r--r-- | include/shard/TrieSpline.h | 10 | ||||
| -rw-r--r-- | include/shard/VPTree.h | 2 |
9 files changed, 22 insertions, 28 deletions
diff --git a/include/framework/DynamicExtension.h b/include/framework/DynamicExtension.h index 9e1b8fa..9d54777 100644 --- a/include/framework/DynamicExtension.h +++ b/include/framework/DynamicExtension.h @@ -204,6 +204,8 @@ public: auto t = m_buffer->get_memory_usage() + epoch->get_structure()->get_memory_usage(); end_job(epoch); + fprintf(stderr, "total: %ld\n", t); + return t; } @@ -214,7 +216,7 @@ public: */ size_t get_aux_memory_usage() { auto epoch = get_active_epoch(); - auto t = epoch->get_buffer().get_aux_memory_usage() + epoch->get_structure()->get_aux_memory_usage(); + auto t = m_buffer->get_memory_usage() + epoch->get_structure()->get_aux_memory_usage(); end_job(epoch); return t; diff --git a/include/framework/structure/ExtensionStructure.h b/include/framework/structure/ExtensionStructure.h index ffba1c1..6ad7aad 100644 --- a/include/framework/structure/ExtensionStructure.h +++ b/include/framework/structure/ExtensionStructure.h @@ -161,9 +161,11 @@ public: size_t get_memory_usage() { size_t cnt = 0; for (size_t i=0; i<m_levels.size(); i++) { + fprintf(stderr, "%ld\t%ld\n", i, m_levels[i]->get_memory_usage()); if (m_levels[i]) cnt += m_levels[i]->get_memory_usage(); } + fprintf(stderr, "%ld\n", cnt); return cnt; } diff --git a/include/shard/Alias.h b/include/shard/Alias.h index 9275952..72147d7 100644 --- a/include/shard/Alias.h +++ b/include/shard/Alias.h @@ -148,7 +148,7 @@ public: size_t get_memory_usage() { - return m_alloc_size; + return 0; } size_t get_aux_memory_usage() { diff --git a/include/shard/AugBTree.h b/include/shard/AugBTree.h index 54931bd..c60cbcd 100644 --- a/include/shard/AugBTree.h +++ b/include/shard/AugBTree.h @@ -148,7 +148,7 @@ public: } size_t get_memory_usage() { - return m_alloc_size + m_node_cnt * sizeof(AugBTreeNode<Wrapped<R>>); + return m_node_cnt * sizeof(AugBTreeNode<Wrapped<R>>); } size_t get_aux_memory_usage() { diff --git a/include/shard/FSTrie.h b/include/shard/FSTrie.h index be678ff..3783b38 100644 --- a/include/shard/FSTrie.h +++ b/include/shard/FSTrie.h @@ -74,7 +74,7 @@ public: m_reccnt = cnt; if (m_reccnt > 0) { - m_fst = new fst::Trie(keys); + m_fst = new fst::Trie(keys, true, 1); } delete[] temp_buffer; @@ -135,7 +135,7 @@ public: } if (m_reccnt > 0) { - m_fst = new fst::Trie(keys); + m_fst = new fst::Trie(keys, true, 1); } } @@ -180,11 +180,11 @@ public: size_t get_memory_usage() { - return m_fst->getMemoryUsage() + m_alloc_size; + return m_fst->getMemoryUsage(); } size_t get_aux_memory_usage() { - return 0; + return m_alloc_size; } size_t get_lower_bound(R &rec) {return 0;} diff --git a/include/shard/ISAMTree.h b/include/shard/ISAMTree.h index af62c92..1cca506 100644 --- a/include/shard/ISAMTree.h +++ b/include/shard/ISAMTree.h @@ -51,7 +51,7 @@ constexpr static size_t LEAF_FANOUT = NODE_SZ / sizeof(R); public: ISAMTree(BufferView<R> buffer) - : m_bf(new BloomFilter<R>(BF_FPR, buffer.get_tombstone_count(), BF_HASH_FUNCS)) + : m_bf(nullptr) , m_isam_nodes(nullptr) , m_root(nullptr) , m_reccnt(0) @@ -59,19 +59,12 @@ public: , m_internal_node_cnt(0) , m_deleted_cnt(0) , m_alloc_size(0) - , m_data(nullptr) { m_alloc_size = psudb::sf_aligned_alloc(CACHELINE_SIZE, buffer.get_record_count() * sizeof(Wrapped<R>), (byte**) &m_data); - /* - * without this, gcc seems to hoist the building of the array - * _above_ its allocation under -O3, resulting in memfaults. - */ - //asm volatile ("" ::: "memory"); - auto res = sorted_array_from_bufferview(std::move(buffer), m_data, m_bf); m_reccnt = res.record_count; m_tombstone_cnt = res.tombstone_count; @@ -90,13 +83,12 @@ public: , m_internal_node_cnt(0) , m_deleted_cnt(0) , m_alloc_size(0) - , m_data(nullptr) { size_t attemp_reccnt = 0; size_t tombstone_count = 0; auto cursors = build_cursor_vec<R, ISAMTree>(shards, &attemp_reccnt, &tombstone_count); - m_bf = new BloomFilter<R>(BF_FPR, tombstone_count, BF_HASH_FUNCS); + m_bf = nullptr; m_alloc_size = psudb::sf_aligned_alloc(CACHELINE_SIZE, attemp_reccnt * sizeof(Wrapped<R>), (byte **) &m_data); @@ -149,7 +141,7 @@ public: size_t get_memory_usage() { - return m_alloc_size + m_internal_node_cnt * NODE_SZ; + return m_internal_node_cnt * NODE_SZ; } size_t get_aux_memory_usage() { diff --git a/include/shard/PGM.h b/include/shard/PGM.h index ff9ce2d..a3f9749 100644 --- a/include/shard/PGM.h +++ b/include/shard/PGM.h @@ -39,8 +39,7 @@ private: public: PGM(BufferView<R> buffer) - : m_data(nullptr) - , m_bf(new BloomFilter<R>(BF_FPR, buffer.get_tombstone_count(), BF_HASH_FUNCS)) + : m_bf(nullptr) , m_reccnt(0) , m_tombstone_cnt(0) , m_alloc_size(0) { @@ -49,6 +48,7 @@ public: buffer.get_record_count() * sizeof(Wrapped<R>), (byte**) &m_data); + auto res = sorted_array_from_bufferview<R>(std::move(buffer), m_data, m_bf); m_reccnt = res.record_count; m_tombstone_cnt = res.tombstone_count; @@ -132,7 +132,7 @@ public: size_t get_memory_usage() { - return m_pgm.size_in_bytes() + m_alloc_size; + return m_pgm.size_in_bytes(); } size_t get_aux_memory_usage() { diff --git a/include/shard/TrieSpline.h b/include/shard/TrieSpline.h index 2a432e8..023390e 100644 --- a/include/shard/TrieSpline.h +++ b/include/shard/TrieSpline.h @@ -36,13 +36,12 @@ private: public: TrieSpline(BufferView<R> buffer) - : m_data(nullptr) - , m_reccnt(0) + : m_reccnt(0) , m_tombstone_cnt(0) , m_alloc_size(0) , m_max_key(0) , m_min_key(0) - , m_bf(new BloomFilter<R>(BF_FPR, buffer.get_tombstone_count(), BF_HASH_FUNCS)) + , m_bf(nullptr) { m_alloc_size = psudb::sf_aligned_alloc(CACHELINE_SIZE, buffer.get_record_count() * @@ -79,7 +78,6 @@ public: size_t tombstone_count = 0; auto cursors = build_cursor_vec<R, TrieSpline>(shards, &attemp_reccnt, &tombstone_count); - m_bf = new BloomFilter<R>(BF_FPR, tombstone_count, BF_HASH_FUNCS); m_alloc_size = psudb::sf_aligned_alloc(CACHELINE_SIZE, attemp_reccnt * sizeof(Wrapped<R>), (byte **) &m_data); @@ -107,7 +105,7 @@ public: } Wrapped<R> *point_lookup(const R &rec, bool filter=false) { - if (filter && !m_bf->lookup(rec)) { + if (filter && m_bf && !m_bf->lookup(rec)) { return nullptr; } @@ -144,7 +142,7 @@ public: size_t get_memory_usage() { - return m_ts.GetSize() + m_alloc_size; + return m_ts.GetSize(); } size_t get_aux_memory_usage() { diff --git a/include/shard/VPTree.h b/include/shard/VPTree.h index 62857ce..d5a2393 100644 --- a/include/shard/VPTree.h +++ b/include/shard/VPTree.h @@ -175,7 +175,7 @@ public: } size_t get_memory_usage() { - return m_node_cnt * sizeof(vpnode) + m_reccnt * sizeof(R*) + m_alloc_size; + return m_node_cnt * sizeof(vpnode) + m_reccnt * sizeof(R*); } size_t get_aux_memory_usage() { |