summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Ross <tross@apache.org>2013-06-26 22:20:16 +0000
committerTed Ross <tross@apache.org>2013-06-26 22:20:16 +0000
commitde2264af286ecf624d638c4d82de1e8edda5cc8b (patch)
tree7cdcd39fea9eebd9abf8114135f081e3a31e6476
parent4911dd0a851319e4a5c2172d97638d798fc1b9ce (diff)
downloadqpid-python-de2264af286ecf624d638c4d82de1e8edda5cc8b.tar.gz
NO-JIRA - Integrated the memory manager into the agent for remote access.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1497140 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--qpid/extras/dispatch/src/alloc.c38
-rw-r--r--qpid/extras/dispatch/src/alloc_private.h2
-rw-r--r--qpid/extras/dispatch/src/dispatch.c1
3 files changed, 39 insertions, 2 deletions
diff --git a/qpid/extras/dispatch/src/alloc.c b/qpid/extras/dispatch/src/alloc.c
index 63769c48a8..87b490fabe 100644
--- a/qpid/extras/dispatch/src/alloc.c
+++ b/qpid/extras/dispatch/src/alloc.c
@@ -20,6 +20,7 @@
#include <qpid/dispatch/alloc.h>
#include <qpid/dispatch/ctools.h>
#include <qpid/dispatch/log.h>
+#include <qpid/dispatch/agent.h>
#include <memory.h>
#include <stdio.h>
@@ -39,8 +40,8 @@ struct dx_alloc_pool_t {
dx_alloc_config_t dx_alloc_default_config_big = {16, 32, 0};
dx_alloc_config_t dx_alloc_default_config_small = {64, 128, 0};
-sys_mutex_t *init_lock;
-item_list_t type_list;
+static sys_mutex_t *init_lock;
+static item_list_t type_list;
static void dx_alloc_init(dx_alloc_type_desc_t *desc)
{
@@ -208,3 +209,36 @@ void dx_alloc_initialize(void)
DEQ_INIT(type_list);
}
+
+static void alloc_schema_handler(void *context, void *correlator)
+{
+}
+
+
+static void alloc_query_handler(void* context, const char *id, void *cor)
+{
+ item_t *item = DEQ_HEAD(type_list);
+
+ while (item) {
+ dx_agent_value_string(cor, "name", item->desc->type_name);
+ dx_agent_value_uint(cor, "type_size", item->desc->total_size);
+ dx_agent_value_uint(cor, "transfer_batch_size", item->desc->config->transfer_batch_size);
+ dx_agent_value_uint(cor, "local_free_list_max", item->desc->config->local_free_list_max);
+ dx_agent_value_uint(cor, "global_free_list_max", item->desc->config->global_free_list_max);
+ dx_agent_value_uint(cor, "total_alloc_from_heap", item->desc->stats->total_alloc_from_heap);
+ dx_agent_value_uint(cor, "total_free_to_heap", item->desc->stats->total_free_to_heap);
+ dx_agent_value_uint(cor, "held_by_threads", item->desc->stats->held_by_threads);
+ dx_agent_value_uint(cor, "batches_rebalanced_to_threads", item->desc->stats->batches_rebalanced_to_threads);
+ dx_agent_value_uint(cor, "batches_rebalanced_to_global", item->desc->stats->batches_rebalanced_to_global);
+
+ item = DEQ_NEXT(item);
+ dx_agent_value_complete(cor, item != 0);
+ }
+}
+
+
+void dx_alloc_setup_agent(dx_dispatch_t *dx)
+{
+ dx_agent_register_class(dx, "org.apache.qpid.dispatch.allocator", 0, alloc_schema_handler, alloc_query_handler);
+}
+
diff --git a/qpid/extras/dispatch/src/alloc_private.h b/qpid/extras/dispatch/src/alloc_private.h
index fbb18ccd48..c812c6a661 100644
--- a/qpid/extras/dispatch/src/alloc_private.h
+++ b/qpid/extras/dispatch/src/alloc_private.h
@@ -20,7 +20,9 @@
*/
#include <qpid/dispatch/alloc.h>
+#include <qpid/dispatch/dispatch.h>
void dx_alloc_initialize(void);
+void dx_alloc_setup_agent(dx_dispatch_t *dx);
#endif
diff --git a/qpid/extras/dispatch/src/dispatch.c b/qpid/extras/dispatch/src/dispatch.c
index 1ad3fdf98d..1cd7ca7ae2 100644
--- a/qpid/extras/dispatch/src/dispatch.c
+++ b/qpid/extras/dispatch/src/dispatch.c
@@ -100,6 +100,7 @@ dx_dispatch_t *dx_dispatch(const char *config_path)
dx->router = dx_router(dx, router_area, router_id);
dx->agent = dx_agent(dx);
+ dx_alloc_setup_agent(dx);
dx_server_setup_agent(dx);
dx_container_setup_agent(dx);
dx_router_setup_agent(dx);