From 826c1fff5accbaa6b415acc176a5acbeb5f691b6 Mon Sep 17 00:00:00 2001 From: Douglas Rumbaugh Date: Tue, 23 Sep 2025 19:22:15 -0400 Subject: Insertion Stall Updates Revised insertion stalling mechanism to work for structures with > 1us required stall time per record, and got dynamic calculation of the stall time working. --- include/framework/structure/InternalLevel.h | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) (limited to 'include/framework/structure/InternalLevel.h') diff --git a/include/framework/structure/InternalLevel.h b/include/framework/structure/InternalLevel.h index 1dee359..205dbf9 100644 --- a/include/framework/structure/InternalLevel.h +++ b/include/framework/structure/InternalLevel.h @@ -18,6 +18,8 @@ #include #include #include +#include +#include #include "framework/interface/Query.h" #include "framework/interface/Shard.h" @@ -32,7 +34,7 @@ class InternalLevel { typedef std::pair, size_t> shard_ptr; public: - InternalLevel(ssize_t level_no) : m_level_no(level_no) {} + InternalLevel(ssize_t level_no) : m_level_no(level_no) { } ~InternalLevel() = default; @@ -197,6 +199,10 @@ public: new_level->append(m_shards[i].first, m_shards[i].second); } + for (auto itr=m_rt_window.begin(); itr < m_rt_window.end(); itr++) { + new_level->m_rt_window.push_front(*itr); + } + return new_level; } @@ -234,16 +240,33 @@ public: } long predict_reconstruction_time(size_t reccnt) { - return 0; + if (m_rt_window.size() == 0) { + return 0; + } + + size_t total = 0; + for (auto rt : m_rt_window) { + total += rt; + } + + return total / m_rt_window.size(); } void update_reconstruction_model(reconstruction_results &recon) { - + if (m_rt_window.size() >= m_window_size) { + m_rt_window.pop_back(); + } + + m_rt_window.push_front(recon.runtime); } private: ssize_t m_level_no; std::vector m_shards; + + const size_t m_window_size = 15; + + std::deque m_rt_window; }; } // namespace de -- cgit v1.2.3