good for merge

On Thu, 2009-11-26 at 07:15 +1300, angus salkeld wrote:
> We have had problems with the ipc queue growing out
> of hand. This is quite handy for monitoring the
> state of these queues.
> 
> -Angus
> 
> Signed-off-by: Angus Salkeld <[email protected]>
> ---
>  exec/coroipcs.c             |    2 ++
>  exec/main.c                 |   15 +++++++++++++++
>  include/corosync/coroipcs.h |    1 +
>  3 files changed, 18 insertions(+), 0 deletions(-)
> 
> diff --git a/exec/coroipcs.c b/exec/coroipcs.c
> index 2e816e6..adad230 100644
> --- a/exec/coroipcs.c
> +++ b/exec/coroipcs.c
> @@ -1298,6 +1298,7 @@ static void outq_flush (struct conn_info *conn_info) {
>                       list_del (list);
>                       api->free (iov.iov_base);
>                       api->free (outq_item);
> +                     api->stats_decrement_value (conn_info->stats_handle, 
> "queue_size");
>               } else {
>                       break;
>               }
> @@ -1403,6 +1404,7 @@ static void msg_send_or_queue (void *conn, const struct 
> iovec *iov, unsigned int
>               }
>               list_add_tail (&outq_item->list, &conn_info->outq_head);
>               pthread_mutex_unlock (&conn_info->mutex);
> +             api->stats_increment_value (conn_info->stats_handle, 
> "queue_size");
>               return;
>       }
>       msg_send (conn, iov, iov_len, MSG_SEND_LOCKED);
> diff --git a/exec/main.c b/exec/main.c
> index def3013..ee31bf6 100644
> --- a/exec/main.c
> +++ b/exec/main.c
> @@ -1004,6 +1004,11 @@ 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,
> +             "queue_size",
> +             &zero_64, sizeof (zero_64),
> +             OBJDB_VALUETYPE_UINT64);
> +
>       return object_handle;
>  }
>  
> @@ -1039,6 +1044,15 @@ static void corosync_stats_increment_value 
> (hdb_handle_t handle,
>               name, strlen(name),
>               &key_incr_dummy);
>  }
> +static void corosync_stats_decrement_value (hdb_handle_t handle,
> +     const char* name)
> +{
> +     unsigned int key_incr_dummy;
> +
> +     objdb->object_key_decrement (handle,
> +             name, strlen(name),
> +             &key_incr_dummy);
> +}
>  
>  static struct coroipcs_init_state_v2 ipc_init_state_v2 = {
>       .socket_name                            = COROSYNC_SOCKET_NAME,
> @@ -1065,6 +1079,7 @@ static struct coroipcs_init_state_v2 ipc_init_state_v2 
> = {
>       .stats_destroy_connection       = corosync_stats_destroy_connection,
>       .stats_update_value                     = corosync_stats_update_value,
>       .stats_increment_value          = corosync_stats_increment_value,
> +     .stats_decrement_value          = corosync_stats_decrement_value,
>  };
>  
>  static void corosync_setscheduler (void)
> diff --git a/include/corosync/coroipcs.h b/include/corosync/coroipcs.h
> index de1be66..3838af8 100644
> --- a/include/corosync/coroipcs.h
> +++ b/include/corosync/coroipcs.h
> @@ -115,6 +115,7 @@ struct coroipcs_init_state_v2 {
>               const char *format,
>               ...) __attribute__((format(printf, 5, 6)));
>       int log_subsys_id;
> +     void (*stats_decrement_value) (hdb_handle_t handle, const char* name);
>  };
>  
>  extern void coroipcs_ipc_init (

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

Reply via email to