As the subject says...

-Angus

Signed-off-by: Angus Salkeld <[email protected]>
---
 exec/coroipcs.c                |    6 ++++--
 exec/main.c                    |   24 ++++++++++++++++++++++++
 exec/totempg.c                 |    3 +++
 include/corosync/totem/totem.h |    2 ++
 4 files changed, 33 insertions(+), 2 deletions(-)

diff --git a/exec/coroipcs.c b/exec/coroipcs.c
index cda0cf2..02badd5 100644
--- a/exec/coroipcs.c
+++ b/exec/coroipcs.c
@@ -685,13 +685,14 @@ retry_semop:
                 * parameter, such as an invalid size
                 */
                if (send_ok == -1) {
+                       api->stats_increment_value (conn_info->stats_handle, 
"invalid_request");
                        coroipc_response_header.size = sizeof 
(coroipc_response_header_t);
                        coroipc_response_header.id = 0;
                        coroipc_response_header.error = CS_ERR_INVALID_PARAM;
                        coroipcs_response_send (conn_info,
                                &coroipc_response_header,
                                sizeof (coroipc_response_header_t));
-               } else 
+               } else
                if (send_ok) {
                        api->serialize_lock();
                        api->stats_increment_value (conn_info->stats_handle, 
"requests");
@@ -701,7 +702,7 @@ retry_semop:
                        /*
                         * Overload, tell library to retry
                         */
-                       api->stats_increment_value (conn_info->stats_handle, 
"sem_retry_count");
+                       api->stats_increment_value (conn_info->stats_handle, 
"overload");
                        coroipc_response_header.size = sizeof 
(coroipc_response_header_t);
                        coroipc_response_header.id = 0;
                        coroipc_response_header.error = CS_ERR_TRY_AGAIN;
@@ -1203,6 +1204,7 @@ static int are_all_out_queues_empty (void)
        }
        return CS_TRUE;
 }
+
 /**
  * simulate the behaviour in coroipcc.c
  */
diff --git a/exec/main.c b/exec/main.c
index e51fbd4..21365fb 100644
--- a/exec/main.c
+++ b/exec/main.c
@@ -445,6 +445,13 @@ static void corosync_totem_stats_updater (void *data)
 
        stats = api->totem_get_stats();
 
+       objdb->object_key_replace (stats->hdr.handle,
+               "msg_reserved", strlen("msg_reserved"),
+               &stats->msg_reserved, sizeof (stats->msg_reserved));
+       objdb->object_key_replace (stats->hdr.handle,
+               "msg_queue_avail", strlen("msg_queue_avail"),
+               &stats->msg_queue_avail, sizeof (stats->msg_queue_avail));
+
        objdb->object_key_replace (stats->mrp->srp->hdr.handle,
                "orf_token_tx", strlen("orf_token_tx"),
                &stats->mrp->srp->orf_token_tx, sizeof 
(stats->mrp->srp->orf_token_tx));
@@ -590,6 +597,13 @@ static void corosync_totem_stats_init (void)
                        &stats->mrp->srp->hdr.handle,
                        "srp", strlen ("srp"));
 
+               objdb->object_key_create_typed (stats->hdr.handle,
+                       "msg_reserved", &stats->msg_reserved,
+                       sizeof (stats->msg_reserved), OBJDB_VALUETYPE_UINT32);
+               objdb->object_key_create_typed (stats->hdr.handle,
+                       "msg_queue_avail", &stats->msg_queue_avail,
+                       sizeof (stats->msg_queue_avail), 
OBJDB_VALUETYPE_UINT32);
+
                objdb->object_key_create_typed (stats->mrp->srp->hdr.handle,
                        "orf_token_tx", &stats->mrp->srp->orf_token_tx,
                        sizeof (stats->mrp->srp->orf_token_tx), 
OBJDB_VALUETYPE_UINT64);
@@ -1008,6 +1022,16 @@ static hdb_handle_t corosync_stats_create_connection 
(const char* name,
                &zero_64, sizeof (zero_64),
                OBJDB_VALUETYPE_UINT64);
 
+       objdb->object_key_create_typed (object_handle,
+               "invalid_request",
+               &zero_64, sizeof (zero_64),
+               OBJDB_VALUETYPE_UINT64);
+
+       objdb->object_key_create_typed (object_handle,
+               "overload",
+               &zero_64, sizeof (zero_64),
+               OBJDB_VALUETYPE_UINT64);
+
        return object_handle;
 }
 
diff --git a/exec/totempg.c b/exec/totempg.c
index 10effc8..1b75200 100644
--- a/exec/totempg.c
+++ b/exec/totempg.c
@@ -933,6 +933,7 @@ static int msg_count_send_ok (
        int avail = 0;
 
        avail = totemmrp_avail ();
+       totempg_stats.msg_queue_avail = avail;
 
        return ((avail - totempg_reserved) > msg_count);
 }
@@ -957,6 +958,7 @@ static int send_reserve (
 
        msg_count = (msg_size / (totempg_totem_config->net_mtu - sizeof (struct 
totempg_mcast) - 16)) + 1;
        totempg_reserved += msg_count;
+       totempg_stats.msg_reserved = totempg_reserved;
 
        return (msg_count);
 }
@@ -965,6 +967,7 @@ static void send_release (
        int msg_count)
 {
        totempg_reserved -= msg_count;
+       totempg_stats.msg_reserved = totempg_reserved;
 }
 
 int totempg_callback_token_create (
diff --git a/include/corosync/totem/totem.h b/include/corosync/totem/totem.h
index 80bbf5c..40e53b8 100644
--- a/include/corosync/totem/totem.h
+++ b/include/corosync/totem/totem.h
@@ -256,6 +256,8 @@ typedef struct {
 typedef struct {
        totem_stats_header_t hdr;
        totemmrp_stats_t *mrp;
+       uint32_t msg_reserved;
+       uint32_t msg_queue_avail;
 } totempg_stats_t;
 
 #endif /* TOTEM_H_DEFINED */
-- 
1.6.3.4

_______________________________________________
Openais mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/openais

Reply via email to