summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/CMakeLists.txt3
-rw-r--r--lib/top_block_query.cpp10
-rw-r--r--python/gras/query/CMakeLists.txt1
-rw-r--r--python/gras/query/chart_allocator_counts.js46
-rw-r--r--python/gras/query/chart_factory.js1
-rw-r--r--python/gras/query/main.html1
6 files changed, 61 insertions, 1 deletions
diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt
index 3de28c7..bb74dc9 100644
--- a/lib/CMakeLists.txt
+++ b/lib/CMakeLists.txt
@@ -24,6 +24,8 @@ add_definitions(${THERON_DEFINES})
list(APPEND GRAS_LIBRARIES ${THERON_LIBRARIES})
list(APPEND GRAS_SOURCES ${THERON_SOURCES})
+add_definitions(-DTHERON_ENABLE_DEFAULTALLOCATOR_CHECKS=1)
+
########################################################################
# Setup Apology Deps
########################################################################
@@ -62,7 +64,6 @@ list(APPEND GRAS_SOURCES
${CMAKE_CURRENT_SOURCE_DIR}/top_block.cpp
${CMAKE_CURRENT_SOURCE_DIR}/top_block_query.cpp
${CMAKE_CURRENT_SOURCE_DIR}/register_messages.cpp
- #${CMAKE_CURRENT_SOURCE_DIR}/theron_allocator.cpp
${CMAKE_CURRENT_SOURCE_DIR}/weak_container.cpp
)
diff --git a/lib/top_block_query.cpp b/lib/top_block_query.cpp
index b000a2d..3203507 100644
--- a/lib/top_block_query.cpp
+++ b/lib/top_block_query.cpp
@@ -7,6 +7,7 @@
#include <boost/property_tree/json_parser.hpp>
#include <boost/property_tree/xml_parser.hpp>
#include <boost/regex.hpp>
+#include <Theron/DefaultAllocator.h>
#include <algorithm>
#include <sstream>
@@ -87,6 +88,15 @@ static std::string query_stats(ElementImpl *self, const boost::property_tree::pt
root.put("now", time_now());
root.put("tps", time_tps());
+ //allocator debugs
+ 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());
+ }
+
//iterate through blocks
boost::property_tree::ptree blocks;
BOOST_FOREACH(const GetStatsMessage &message, receiver.messages)
diff --git a/python/gras/query/CMakeLists.txt b/python/gras/query/CMakeLists.txt
index ab49532..a448068 100644
--- a/python/gras/query/CMakeLists.txt
+++ b/python/gras/query/CMakeLists.txt
@@ -20,6 +20,7 @@ INSTALL(
chart_overall_throughput.js
chart_handler_breakdown.js
chart_total_io_counts.js
+ chart_allocator_counts.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
new file mode 100644
index 0000000..cc06d24
--- /dev/null
+++ b/python/gras/query/chart_allocator_counts.js
@@ -0,0 +1,46 @@
+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 = $('<div />').attr({class:'chart_total_io_counts'});
+ $(panel).append(this.div);
+ this.title = "Theron allocator counts"
+}
+
+GrasChartAllocatorCounts.prototype.update = function(point)
+{
+ var ul = $('<ul />');
+ $('ul', this.div).remove(); //clear old lists
+ this.div.append(ul);
+
+ function make_entry(strong, span)
+ {
+ var li = $('<li />');
+ var strong = $('<strong />').text(strong + ": ");
+ var span = $('<span />').text(span);
+ li.append(strong);
+ li.append(span);
+ ul.append(li);
+ }
+
+ var stuff = [
+ ['Allocated', 'bytes', 'bytes_allocated'],
+ ['Peak size', 'bytes', 'peak_bytes_allocated'],
+ ['Malloc\'d', 'times', 'allocation_count'],
+ ];
+
+ $.each(stuff, function(contents_i, contents)
+ {
+ var dir = contents[0];
+ var units = contents[1];
+ var key = contents[2];
+ var count = (key in point)? point[key] : 0;
+ if (count > 0) make_entry(dir, count.toString() + ' ' + units);
+ });
+}
diff --git a/python/gras/query/chart_factory.js b/python/gras/query/chart_factory.js
index 122d222..dbb141a 100644
--- a/python/gras/query/chart_factory.js
+++ b/python/gras/query/chart_factory.js
@@ -13,6 +13,7 @@ var gras_chart_get_registry = function()
{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},
];
}
diff --git a/python/gras/query/main.html b/python/gras/query/main.html
index b64d53f..64d5809 100644
--- a/python/gras/query/main.html
+++ b/python/gras/query/main.html
@@ -15,6 +15,7 @@
<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="/main.js"></script>
<script type="text/javascript">
google.load('visualization', '1.0', {'packages':['corechart']});