diff options
| author | Douglas Rumbaugh <dbr4@psu.edu> | 2025-09-17 18:27:56 -0400 |
|---|---|---|
| committer | Douglas Rumbaugh <dbr4@psu.edu> | 2025-09-17 18:27:56 -0400 |
| commit | 42cb6e2b446a2879cf9bf2f4642f926c15584cb3 (patch) | |
| tree | 2ae610890630bcb75c0df9335a8735385f11a069 /include | |
| parent | 79dcefa5002f6411e05169a226ae9e3cd1114bd7 (diff) | |
| download | dynamic-extension-42cb6e2b446a2879cf9bf2f4642f926c15584cb3.tar.gz | |
Beginnings of per-level cost modeling
The total time required for each shard construction
is now measured, and hooks have been added to
InternalLevel to support the creation and use of
per-level cost models.
The appropriate calls to these functions are now
made during reconstruction, but the scheduling
process doesn't yet call them, nor are the models
actually implemented.
Diffstat (limited to 'include')
| -rw-r--r-- | include/framework/DynamicExtension.h | 6 | ||||
| -rw-r--r-- | include/framework/structure/ExtensionStructure.h | 15 | ||||
| -rw-r--r-- | include/framework/structure/InternalLevel.h | 8 | ||||
| -rw-r--r-- | include/util/types.h | 3 |
4 files changed, 28 insertions, 4 deletions
diff --git a/include/framework/DynamicExtension.h b/include/framework/DynamicExtension.h index 48e270d..5917475 100644 --- a/include/framework/DynamicExtension.h +++ b/include/framework/DynamicExtension.h @@ -604,10 +604,8 @@ private: /* apply our updates to the copied structure (adding/removing shards) */ for (auto recon : reconstructions) { - auto grow = args->version->get_mutable_structure()->append_shard( - recon.new_shard, args->version->get_id(), recon.target_level); - args->version->get_mutable_structure()->delete_shards( - recon.source_shards); + auto grow = args->version->get_mutable_structure()->apply_reconstruction( + recon, args->version->get_id()); if (grow) { extension->m_lock_mngr.add_lock(); } diff --git a/include/framework/structure/ExtensionStructure.h b/include/framework/structure/ExtensionStructure.h index 0fd737c..bb8a480 100644 --- a/include/framework/structure/ExtensionStructure.h +++ b/include/framework/structure/ExtensionStructure.h @@ -10,6 +10,7 @@ #pragma once #include <atomic> +#include <chrono> #include <cstdio> #include <memory> #include <vector> @@ -196,7 +197,13 @@ public: result.source_shards.emplace_back(shid.level_idx, raw_shard_ptr); } + + auto start = std::chrono::high_resolution_clock::now(); result.new_shard = std::make_shared<ShardType>(shards); + auto stop = std::chrono::high_resolution_clock::now(); + + result.runtime = std::chrono::duration_cast<std::chrono::nanoseconds>(stop- start).count(); + result.reccnt = result.new_shard->get_record_count(); return result; } @@ -218,6 +225,14 @@ public: return m_levels[0]->get_shard_count(); } + bool apply_reconstruction(reconstruction_results<ShardType> &recon, size_t version) { + bool res = append_shard(recon.new_shard, version, recon.target_level); + m_levels[recon.target_level]->update_reconstruction_model(recon); + delete_shards(recon.source_shards); + + return res; + } + bool append_shard(std::shared_ptr<ShardType> shard, size_t version, size_t level) { assert(level <= m_levels.size()); auto rc = false; diff --git a/include/framework/structure/InternalLevel.h b/include/framework/structure/InternalLevel.h index 54b3ae2..1dee359 100644 --- a/include/framework/structure/InternalLevel.h +++ b/include/framework/structure/InternalLevel.h @@ -233,6 +233,14 @@ public: } } + long predict_reconstruction_time(size_t reccnt) { + return 0; + } + + void update_reconstruction_model(reconstruction_results<ShardType> &recon) { + + } + private: ssize_t m_level_no; std::vector<shard_ptr> m_shards; diff --git a/include/util/types.h b/include/util/types.h index 88774f5..64dc773 100644 --- a/include/util/types.h +++ b/include/util/types.h @@ -88,6 +88,9 @@ struct reconstruction_results { std::shared_ptr<ShardType> new_shard; std::vector<std::pair<level_index, const ShardType *>> source_shards; size_t target_level; + size_t reccnt; + long runtime; + }; typedef struct ReconstructionTask { |