From 121a609ed2cadd50e5e85093e2ac524bdd279d02 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Fri, 10 May 2013 00:00:47 -0700 Subject: gras: added more theron counters + query work --- lib/CMakeLists.txt | 1 + lib/block_actor.cpp | 2 +- lib/top_block_query.cpp | 18 +++++-- python/gras/query/CMakeLists.txt | 4 +- python/gras/query/chart_allocator_counts.js | 52 -------------------- python/gras/query/chart_factory.js | 4 +- python/gras/query/chart_global_counters.js | 58 ++++++++++++++++++++++ python/gras/query/chart_port_counters.js | 76 +++++++++++++++++++++++++++++ python/gras/query/chart_total_io_counts.js | 72 --------------------------- python/gras/query/main.css | 4 +- python/gras/query/main.html | 4 +- 11 files changed, 159 insertions(+), 136 deletions(-) delete mode 100644 python/gras/query/chart_allocator_counts.js create mode 100644 python/gras/query/chart_global_counters.js create mode 100644 python/gras/query/chart_port_counters.js delete mode 100644 python/gras/query/chart_total_io_counts.js 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::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_allocator_counts.js b/python/gras/query/chart_allocator_counts.js deleted file mode 100644 index 5219672..0000000 --- a/python/gras/query/chart_allocator_counts.js +++ /dev/null @@ -1,52 +0,0 @@ -function GrasChartAllocatorCounts(args, panel) -{ - //input checking - if (args.block_ids.length != 0) throw gras_error_dialog( - "GrasChartAllocatorCounts", - "Error making allocator counts chart.\n"+ - "Do not specify any blocks for this chart." - ); - - //settings - this.div = $('
').attr({class:'chart_total_io_counts'}); - $(panel).append(this.div); - this.title = "Theron allocator counts" -} - -GrasChartAllocatorCounts.prototype.update = function(point) -{ - var ul = $('