diff options
-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 | ||||
-rw-r--r-- | python/gras/query/chart_factory.js | 5 | ||||
-rw-r--r-- | python/gras/query/chart_total_io_counts.js | 31 | ||||
-rw-r--r-- | python/gras/query/main.js | 5 |
7 files changed, 53 insertions, 24 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); diff --git a/python/gras/query/chart_factory.js b/python/gras/query/chart_factory.js index 20715a6..ae23728 100644 --- a/python/gras/query/chart_factory.js +++ b/python/gras/query/chart_factory.js @@ -1,4 +1,9 @@ /*********************************************************************** + * Some constants + **********************************************************************/ +var GRAS_CHARTS_STD_WIDTH = 250; + +/*********************************************************************** * Chart registry for now chart types **********************************************************************/ var gras_chart_get_registry = function() diff --git a/python/gras/query/chart_total_io_counts.js b/python/gras/query/chart_total_io_counts.js index 2f9ced3..f959414 100644 --- a/python/gras/query/chart_total_io_counts.js +++ b/python/gras/query/chart_total_io_counts.js @@ -21,20 +21,29 @@ GrasChartTotalIoCounts.prototype.update = function(point) $('ul', this.div).remove(); //clear old lists this.div.append(ul); + function make_entry(strong, span) { - var init_time = parseInt(block_data.init_time); - var stats_time = parseInt(block_data.stats_time); - var tps = parseInt(block_data.tps); - var duration = (stats_time - init_time)/tps; var li = $('<li />'); - var strong = $('<strong />').text('Elapsed' + ': '); - var span = $('<span />').text(duration.toFixed(2).toString() + ' secs'); + var strong = $('<strong />').text(strong + ": "); + var span = $('<span />').text(span); li.append(strong); li.append(span); ul.append(li); } + //create total time elapsed entry + { + var init_time = block_data.init_time; + var stats_time = block_data.stats_time; + var tps = block_data.tps; + var duration = (stats_time - init_time)/tps; + make_entry('Elapsed', duration.toFixed(2).toString() + ' secs'); + } + var stuff = [ + ['Enque', 'items', 'items_enqueued'], + ['Enque', 'tags', 'tags_enqueued'], + ['Enque', 'msgs', 'msgs_enqueued'], ['Input', 'items', 'items_consumed'], ['Input', 'tags', 'tags_consumed'], ['Input', 'msgs', 'msgs_consumed'], @@ -50,12 +59,10 @@ GrasChartTotalIoCounts.prototype.update = function(point) var key = contents[2]; $.each(block_data[key], function(index, count) { - var li = $('<li />'); - var strong = $('<strong />').text(dir + index.toString() + ': '); - var span = $('<span />').text(count.toString() + ' ' + units); - li.append(strong); - li.append(span); - if (count > 0) ul.append(li); + if (count > 0) + { + make_entry(dir + index.toString(), count.toString() + ' ' + units); + } }); }); } diff --git a/python/gras/query/main.js b/python/gras/query/main.js index a12457e..a9c255b 100644 --- a/python/gras/query/main.js +++ b/python/gras/query/main.js @@ -1,9 +1,4 @@ /*********************************************************************** - * Some constants - **********************************************************************/ -var GRAS_CHARTS_STD_WIDTH = 250; - -/*********************************************************************** * Stats registry data structure **********************************************************************/ var GrasStatsRegistry = function() |