diff options
author | Josh Blum | 2013-05-10 00:00:47 -0700 |
---|---|---|
committer | Josh Blum | 2013-05-10 00:00:47 -0700 |
commit | 121a609ed2cadd50e5e85093e2ac524bdd279d02 (patch) | |
tree | e7a95104623487bb0b7027bc2bbc142e741ce200 | |
parent | a1b87fea68e78da0bb3f047a34f3ddc17372cd5c (diff) | |
download | sandhi-121a609ed2cadd50e5e85093e2ac524bdd279d02.tar.gz sandhi-121a609ed2cadd50e5e85093e2ac524bdd279d02.tar.bz2 sandhi-121a609ed2cadd50e5e85093e2ac524bdd279d02.zip |
gras: added more theron counters + query work
-rw-r--r-- | lib/CMakeLists.txt | 1 | ||||
-rw-r--r-- | lib/block_actor.cpp | 2 | ||||
-rw-r--r-- | lib/top_block_query.cpp | 18 | ||||
-rw-r--r-- | python/gras/query/CMakeLists.txt | 4 | ||||
-rw-r--r-- | python/gras/query/chart_factory.js | 4 | ||||
-rw-r--r-- | python/gras/query/chart_global_counters.js (renamed from python/gras/query/chart_allocator_counts.js) | 24 | ||||
-rw-r--r-- | python/gras/query/chart_port_counters.js (renamed from python/gras/query/chart_total_io_counts.js) | 18 | ||||
-rw-r--r-- | python/gras/query/main.css | 4 | ||||
-rw-r--r-- | python/gras/query/main.html | 4 |
9 files changed, 51 insertions, 28 deletions
diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index e721769..7404bc5 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -25,6 +25,7 @@ list(APPEND GRAS_LIBRARIES ${THERON_LIBRARIES}) list(APPEND GRAS_SOURCES ${THERON_SOURCES}) add_definitions(-DTHERON_ENABLE_DEFAULTALLOCATOR_CHECKS=1) +add_definitions(-DTHERON_ENABLE_COUNTERS=1) ######################################################################## # Setup Apology Deps diff --git a/lib/block_actor.cpp b/lib/block_actor.cpp index fe7f79e..5365724 100644 --- a/lib/block_actor.cpp +++ b/lib/block_actor.cpp @@ -65,7 +65,7 @@ void ThreadPool::set_active(void) static ThreadPool active_thread_pool; -static ThreadPool get_active_thread_pool(void) +ThreadPool get_active_thread_pool(void) { if (not weak_framework.lock()) { diff --git a/lib/top_block_query.cpp b/lib/top_block_query.cpp index 20e1c66..b7a532f 100644 --- a/lib/top_block_query.cpp +++ b/lib/top_block_query.cpp @@ -13,6 +13,8 @@ using namespace gras; +ThreadPool get_active_thread_pool(void); + struct GetStatsReceiver : Theron::Receiver { GetStatsReceiver(void) @@ -92,9 +94,19 @@ static std::string query_stats(ElementImpl *self, const boost::property_tree::pt Theron::DefaultAllocator *allocator = dynamic_cast<Theron::DefaultAllocator *>(Theron::AllocatorManager::Instance().GetAllocator()); if (allocator) { - root.put("bytes_allocated", allocator->GetBytesAllocated()); - root.put("peak_bytes_allocated", allocator->GetPeakBytesAllocated()); - root.put("allocation_count", allocator->GetAllocationCount()); + root.put("default_allocator_bytes_allocated", allocator->GetBytesAllocated()); + root.put("default_allocator_peak_bytes_allocated", allocator->GetPeakBytesAllocated()); + root.put("default_allocator_allocation_count", allocator->GetAllocationCount()); + } + + ThreadPool tp = get_active_thread_pool(); + if (tp) + { + root.put("framework_counter_messages_processed", tp->GetCounterValue(Theron::COUNTER_MESSAGES_PROCESSED)); + root.put("framework_counter_yields", tp->GetCounterValue(Theron::COUNTER_YIELDS)); + root.put("framework_counter_local_pushes", tp->GetCounterValue(Theron::COUNTER_LOCAL_PUSHES)); + root.put("framework_counter_shared_pushes", tp->GetCounterValue(Theron::COUNTER_SHARED_PUSHES)); + root.put("framework_counter_mailbox_queue_max", tp->GetCounterValue(Theron::COUNTER_MAILBOX_QUEUE_MAX)); } //iterate through blocks diff --git a/python/gras/query/CMakeLists.txt b/python/gras/query/CMakeLists.txt index a448068..2758d11 100644 --- a/python/gras/query/CMakeLists.txt +++ b/python/gras/query/CMakeLists.txt @@ -19,8 +19,8 @@ INSTALL( chart_overhead_compare.js chart_overall_throughput.js chart_handler_breakdown.js - chart_total_io_counts.js - chart_allocator_counts.js + chart_port_counters.js + chart_global_counters.js main.css DESTINATION ${GR_PYTHON_DIR}/gras/query COMPONENT ${GRAS_COMP_PYTHON} diff --git a/python/gras/query/chart_factory.js b/python/gras/query/chart_factory.js index dbb141a..01a7244 100644 --- a/python/gras/query/chart_factory.js +++ b/python/gras/query/chart_factory.js @@ -12,8 +12,8 @@ var gras_chart_get_registry = function() {key:'overhead_compare', name:'Overhead Compare', factory:GrasChartOverheadCompare}, {key:'overall_throughput', name:'Overall Throughput', factory:GrasChartOverallThroughput}, {key:'handler_breakdown', name:'Handler Breakdown', factory:GrasChartHandlerBreakdown}, - {key:'total_io_counts', name:'I/O port Totals', factory:GrasChartTotalIoCounts}, - {key:'allocator_counts', name:'Allocator Counts', factory:GrasChartAllocatorCounts}, + {key:'port_counters', name:'Port Counters', factory:GrasChartPortCounts}, + {key:'global_counters', name:'Global Counters', factory:GrasChartGlobalCounts}, ]; } diff --git a/python/gras/query/chart_allocator_counts.js b/python/gras/query/chart_global_counters.js index 5219672..1708c01 100644 --- a/python/gras/query/chart_allocator_counts.js +++ b/python/gras/query/chart_global_counters.js @@ -1,19 +1,19 @@ -function GrasChartAllocatorCounts(args, panel) +function GrasChartGlobalCounts(args, panel) { //input checking if (args.block_ids.length != 0) throw gras_error_dialog( - "GrasChartAllocatorCounts", - "Error making allocator counts chart.\n"+ + "GrasChartGlobalCounts", + "Error making global counts chart.\n"+ "Do not specify any blocks for this chart." ); //settings - this.div = $('<div />').attr({class:'chart_total_io_counts'}); + this.div = $('<div />').attr({class:'chart_total_counts'}); $(panel).append(this.div); - this.title = "Theron allocator counts" + this.title = "Global Counters" } -GrasChartAllocatorCounts.prototype.update = function(point) +GrasChartGlobalCounts.prototype.update = function(point) { var ul = $('<ul />'); $('ul', this.div).remove(); //clear old lists @@ -30,9 +30,15 @@ GrasChartAllocatorCounts.prototype.update = function(point) } var stuff = [ - ['Allocated', 'bytes', 'bytes_allocated'], - ['Peak size', 'bytes', 'peak_bytes_allocated'], - ['Malloc\'d', 'times', 'allocation_count'], + ['Allocated', 'bytes', 'default_allocator_bytes_allocated'], + ['Peak size', 'bytes', 'default_allocator_peak_bytes_allocated'], + ['Num mallocs', '', 'default_allocator_allocation_count'], + + ['Total msgs', '', 'framework_counter_messages_processed'], + ['Thread yields', '', 'framework_counter_yields'], + ['Local pushes', '', 'framework_counter_local_pushes'], + ['Shared pushes', '', 'framework_counter_shared_pushes'], + ['Msg queue max', '', 'framework_counter_mailbox_queue_max'], ]; var entries = 0; diff --git a/python/gras/query/chart_total_io_counts.js b/python/gras/query/chart_port_counters.js index ac1fb0e..af74c33 100644 --- a/python/gras/query/chart_total_io_counts.js +++ b/python/gras/query/chart_port_counters.js @@ -1,22 +1,23 @@ -function GrasChartTotalIoCounts(args, panel) +function GrasChartPortCounts(args, panel) { //input checking if (args.block_ids.length != 1) throw gras_error_dialog( - "GrasChartTotalIoCounts", - "Error making total IO counts chart.\n"+ + "GrasChartPortCounts", + "Error making total port counts chart.\n"+ "Specify only one block for this chart." ); //settings this.block_id = args.block_ids[0]; - this.div = $('<div />').attr({class:'chart_total_io_counts'}); + this.div = $('<div />').attr({class:'chart_total_counts'}); $(panel).append(this.div); - this.title = "I/O Totals - " + this.block_id; + this.title = "Port Counters - " + this.block_id; } -GrasChartTotalIoCounts.prototype.update = function(point) +GrasChartPortCounts.prototype.update = function(point) { var block_data = point.blocks[this.block_id]; + if (!block_data) return; var ul = $('<ul />'); $('ul', this.div).remove(); //clear old lists this.div.append(ul); @@ -68,5 +69,8 @@ GrasChartTotalIoCounts.prototype.update = function(point) }); var actor_depth = block_data.actor_queue_depth; - if (actor_depth > 1) make_entry('Actor depth', actor_depth.toString() + ' msgs'); + if (actor_depth > 10) //only show if its large + { + make_entry('Actor depth', actor_depth.toString() + ' msgs'); + } } diff --git a/python/gras/query/main.css b/python/gras/query/main.css index a428111..4d933fa 100644 --- a/python/gras/query/main.css +++ b/python/gras/query/main.css @@ -37,12 +37,12 @@ width:100%; height:100%; } -.chart_total_io_counts li +.chart_total_counts li { list-style-type:none; text-align: left; padding: 0px; -margin: 0px; +margin-left: -30px; font-size:90%; } diff --git a/python/gras/query/main.html b/python/gras/query/main.html index 64d5809..ca957be 100644 --- a/python/gras/query/main.html +++ b/python/gras/query/main.html @@ -14,8 +14,8 @@ <script type="text/javascript" src="/chart_overhead_compare.js"></script> <script type="text/javascript" src="/chart_overall_throughput.js"></script> <script type="text/javascript" src="/chart_handler_breakdown.js"></script> - <script type="text/javascript" src="/chart_total_io_counts.js"></script> - <script type="text/javascript" src="/chart_allocator_counts.js"></script> + <script type="text/javascript" src="/chart_port_counters.js"></script> + <script type="text/javascript" src="/chart_global_counters.js"></script> <script type="text/javascript" src="/main.js"></script> <script type="text/javascript"> google.load('visualization', '1.0', {'packages':['corechart']}); |