diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/block_handlers.cpp | 16 | ||||
-rw-r--r-- | lib/gras_impl/input_buffer_queues.hpp | 11 | ||||
-rw-r--r-- | lib/gras_impl/stats.hpp | 6 | ||||
-rw-r--r-- | lib/top_block_query.cpp | 3 |
4 files changed, 29 insertions, 7 deletions
diff --git a/lib/block_handlers.cpp b/lib/block_handlers.cpp index 9865331..1f744f4 100644 --- a/lib/block_handlers.cpp +++ b/lib/block_handlers.cpp @@ -137,11 +137,25 @@ void BlockActor::handle_get_stats( ){ MESSAGE_TRACER(); + //instantaneous states we update here, + //and not interleaved with the rest of the code + const size_t num_inputs = this->get_num_inputs(); + this->stats.items_enqueued.resize(num_inputs); + this->stats.tags_enqueued.resize(num_inputs); + this->stats.msgs_enqueued.resize(num_inputs); + for (size_t i = 0; i < num_inputs; i++) + { + this->stats.items_enqueued[i] = this->input_queues.get_items_enqueued(i); + this->stats.tags_enqueued[i] = this->input_tags[i].size(); + this->stats.msgs_enqueued[i] = this->input_msgs[i].size(); + } + + //create the message reply object GetStatsMessage message; message.block_id = this->block_ptr->to_string(); message.stats = this->stats; message.stats_time = time_now(); - this->Send(message, from); //ACK + this->Send(message, from); //ACK this->highPrioAck(); } diff --git a/lib/gras_impl/input_buffer_queues.hpp b/lib/gras_impl/input_buffer_queues.hpp index 6886e6e..48996ef 100644 --- a/lib/gras_impl/input_buffer_queues.hpp +++ b/lib/gras_impl/input_buffer_queues.hpp @@ -105,12 +105,6 @@ struct InputBufferQueues void push(const size_t i, const SBuffer &buffer); - GRAS_FORCE_INLINE void flush(const size_t i) - { - _queues[i].clear(); - _bitset.reset(i); - } - GRAS_FORCE_INLINE void fail(const size_t i) { _bitset.reset(i); @@ -148,6 +142,11 @@ struct InputBufferQueues _bitset.set(i, _enqueued_bytes[i] >= _reserve_bytes[i]); } + GRAS_FORCE_INLINE size_t get_items_enqueued(const size_t i) + { + return _enqueued_bytes[i]/_items_sizes[i]; + } + BitSet _bitset; std::vector<size_t> _items_sizes; std::vector<size_t> _enqueued_bytes; diff --git a/lib/gras_impl/stats.hpp b/lib/gras_impl/stats.hpp index 3f78b8d..7edab29 100644 --- a/lib/gras_impl/stats.hpp +++ b/lib/gras_impl/stats.hpp @@ -29,6 +29,7 @@ struct BlockStats time_ticks_t start_time; time_ticks_t stop_time; + //overall tracking of ports std::vector<item_index_t> items_consumed; std::vector<item_index_t> tags_consumed; std::vector<item_index_t> msgs_consumed; @@ -36,6 +37,11 @@ struct BlockStats std::vector<item_index_t> tags_produced; std::vector<item_index_t> msgs_produced; + //instantaneous port status + std::vector<size_t> items_enqueued; + std::vector<size_t> msgs_enqueued; + std::vector<size_t> tags_enqueued; + item_index_t work_count; time_ticks_t time_last_work; time_ticks_t total_time_prep; diff --git a/lib/top_block_query.cpp b/lib/top_block_query.cpp index beec598..f00efd2 100644 --- a/lib/top_block_query.cpp +++ b/lib/top_block_query.cpp @@ -97,6 +97,9 @@ static std::string query_stats(ElementImpl *self, const boost::property_tree::pt } \ block.push_back(std::make_pair(#l, e)); \ } + my_block_ptree_append(items_enqueued); + my_block_ptree_append(tags_enqueued); + my_block_ptree_append(msgs_enqueued); my_block_ptree_append(items_consumed); my_block_ptree_append(tags_consumed); my_block_ptree_append(msgs_consumed); |