diff options
| author | Douglas Rumbaugh <dbr4@psu.edu> | 2023-07-26 09:44:44 -0400 |
|---|---|---|
| committer | Douglas Rumbaugh <dbr4@psu.edu> | 2023-07-26 09:44:44 -0400 |
| commit | 63929187f2c1d0c95719d8435794a5136cb1cc73 (patch) | |
| tree | 4cc146eee6751ba58f89ea56a5704830dd8dc42d /include/shard/PGM.h | |
| parent | 8e86ca7ce7823bbdb1e71c329ae1bd564c0d54fb (diff) | |
| download | dynamic-extension-63929187f2c1d0c95719d8435794a5136cb1cc73.tar.gz | |
Adjusted calculation for index size
Diffstat (limited to 'include/shard/PGM.h')
| -rw-r--r-- | include/shard/PGM.h | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/include/shard/PGM.h b/include/shard/PGM.h index d72ad55..0d4268a 100644 --- a/include/shard/PGM.h +++ b/include/shard/PGM.h @@ -67,9 +67,9 @@ public: PGM(MutableBuffer<R>* buffer) : m_reccnt(0), m_tombstone_cnt(0) { - size_t alloc_size = (buffer->get_record_count() * sizeof(Wrapped<R>)) + (CACHELINE_SIZE - (buffer->get_record_count() * sizeof(Wrapped<R>)) % CACHELINE_SIZE); - assert(alloc_size % CACHELINE_SIZE == 0); - m_data = (Wrapped<R>*)std::aligned_alloc(CACHELINE_SIZE, alloc_size); + m_alloc_size = (buffer->get_record_count() * sizeof(Wrapped<R>)) + (CACHELINE_SIZE - (buffer->get_record_count() * sizeof(Wrapped<R>)) % CACHELINE_SIZE); + assert(m_alloc_size % CACHELINE_SIZE == 0); + m_data = (Wrapped<R>*)std::aligned_alloc(CACHELINE_SIZE, m_alloc_size); std::vector<K> keys; m_bf = new BloomFilter<R>(BF_FPR, buffer->get_tombstone_count(), BF_HASH_FUNCS); @@ -141,9 +141,9 @@ public: m_bf = new BloomFilter<R>(BF_FPR, tombstone_count, BF_HASH_FUNCS); - size_t alloc_size = (attemp_reccnt * sizeof(Wrapped<R>)) + (CACHELINE_SIZE - (attemp_reccnt * sizeof(Wrapped<R>)) % CACHELINE_SIZE); - assert(alloc_size % CACHELINE_SIZE == 0); - m_data = (Wrapped<R>*)std::aligned_alloc(CACHELINE_SIZE, alloc_size); + m_alloc_size = (attemp_reccnt * sizeof(Wrapped<R>)) + (CACHELINE_SIZE - (attemp_reccnt * sizeof(Wrapped<R>)) % CACHELINE_SIZE); + assert(m_alloc_size % CACHELINE_SIZE == 0); + m_data = (Wrapped<R>*)std::aligned_alloc(CACHELINE_SIZE, m_alloc_size); std::vector<K> keys; @@ -223,7 +223,7 @@ public: size_t get_memory_usage() { - return m_pgm.size_in_bytes(); + return m_pgm.size_in_bytes() + m_alloc_size; } size_t get_lower_bound(const K& key) const { @@ -267,6 +267,7 @@ private: Wrapped<R>* m_data; size_t m_reccnt; size_t m_tombstone_cnt; + size_t m_alloc_size; K m_max_key; K m_min_key; pgm::PGMIndex<K> m_pgm; |