diff --git a/maestro/cdo.c b/maestro/cdo.c index 2237af302614b88d9de14d634e715f54b0e47b8d..4d87779d964fc4f0e0d8748082e52a6877e5514a 100644 --- a/maestro/cdo.c +++ b/maestro/cdo.c @@ -1150,6 +1150,8 @@ mstro_cdo_dispose(mstro_cdo cdo) } }); + mstro_stats_add_counter(MSTRO_STATS_CAT_PROTOCOL, MSTRO_STATS_L_PC_NUM_DISPOSE, 1); + return MSTRO_UNIMPL; } diff --git a/maestro/groups.c b/maestro/groups.c index 6a7f7cdd65437d85217eec66d871351138520aa1..453ac6358c78d0b7c23976a8facf78d3b15a7d66 100644 --- a/maestro/groups.c +++ b/maestro/groups.c @@ -1,6 +1,7 @@ #include "i_groups.h" #include "maestro/i_globals.h" #include "maestro/i_pool_manager_registry.h" +#include "maestro/i_statistics.h" #include "protocols/mstro_pool.pb-c.h" #include <stdatomic.h> @@ -385,6 +386,8 @@ mstro_group_seal(mstro_group g) g->state = MSTRO_GROUP_STATE_SEALED; s=MSTRO_OK; + + mstro_stats_add_counter(MSTRO_STATS_CAT_PROTOCOL, MSTRO_STATS_L_PC_NUM_SEAL_GROUP, 1); BAILOUT_FREE: if(m) { diff --git a/maestro/pool.c b/maestro/pool.c index ebfdb2a275ec056b3c56989829de3f44130937c9..8a911fe8d454f645ca51f1c3d5150218f6762a99 100644 --- a/maestro/pool.c +++ b/maestro/pool.c @@ -38,6 +38,7 @@ #include "maestro/i_pool_manager_protocol.h" #include "maestro/i_utlist.h" #include "maestro/i_misc.h" +#include "maestro/i_statistics.h" #include "i_subscription_registry.h" #include "transformation/transformation.h" @@ -1051,11 +1052,15 @@ mstro_pool__demand(mstro_cdo cdo, mstro_cdo_state new_state) } assert(new_state == MSTRO_CDO_STATE_DEMANDED); + + mstro_status status; if(g_have_pool_manager) { - return mstro_pool__demand_with_pm(cdo, new_state); + status = mstro_pool__demand_with_pm(cdo, new_state); } else { - return mstro_pool__demand_no_pm(cdo, new_state); + status = mstro_pool__demand_no_pm(cdo, new_state); } + mstro_stats_add_counter(MSTRO_STATS_CAT_PROTOCOL, MSTRO_STATS_L_PC_NUM_DEMAND, 1); + return status; } /** Retract CDO op from local pool */ diff --git a/maestro/pool_client.c b/maestro/pool_client.c index a90c09df347682b1cae402a19e2f547e67f60c42..d7d4ae485071129985a1c388630fa1d75640fb2d 100644 --- a/maestro/pool_client.c +++ b/maestro/pool_client.c @@ -41,6 +41,7 @@ mstro_pc__handle_declare_ack(const Mstro__Pool__DeclareAck *declare_ack) cdoid.qw[0] = declare_ack->cdoid->qw0; cdoid.qw[1] = declare_ack->cdoid->qw1; + mstro_stats_add_counter(MSTRO_STATS_CAT_PROTOCOL, MSTRO_STATS_L_PC_NUM_DECLARE, 1); /* feed into local CDO layer */ return mstro_cdo_declare_completion(declare_ack->serial, &cdoid, declare_ack->channel); } @@ -59,6 +60,7 @@ mstro_pc__handle_subscribe_ack(const Mstro__Pool__SubscribeAck *sack) ERR("Failed to handle subscription ack for local id %" PRIu64 "\n", sack->serial); } + mstro_stats_add_counter(MSTRO_STATS_CAT_PROTOCOL, MSTRO_STATS_L_PC_NUM_SUBSCRIBE, 1); return s; } @@ -72,6 +74,7 @@ mstro_pc__handle_resolve_reply(const Mstro__Pool__ResolveReply *reply) case MSTRO__POOL__RESOLVE__QUERY_CDOID: DEBUG("Incoming RESOLVE-REPLY for a CDO-ID (result: |%s|)\n", reply->name); + mstro_stats_add_counter(MSTRO_STATS_CAT_PROTOCOL, MSTRO_STATS_L_PC_NUM_RESOLVE, 1); return mstro_pool_resolve_reply_bh(reply); default: ERR("FIXME: unhandled resolve-reply for a query of type %d\n", @@ -176,23 +179,28 @@ mstro_pc__handle_poolop_ack(Mstro__Pool__PoolOpAck *poack) poack->updated_attributes = NULL; /* we consume this */ } new_state = MSTRO_CDO_STATE_SEALED; + mstro_stats_add_counter(MSTRO_STATS_CAT_PROTOCOL, MSTRO_STATS_L_PC_NUM_SEAL, 1); goto shared_cdo_state_update; } case MSTRO__POOL__POOL_OP_ACK__POOL_OP__OFFER: new_state = MSTRO_CDO_STATE_OFFERED; + mstro_stats_add_counter(MSTRO_STATS_CAT_PROTOCOL, MSTRO_STATS_L_PC_NUM_OFFER, 1); goto shared_cdo_state_update; case MSTRO__POOL__POOL_OP_ACK__POOL_OP__REQUIRE: new_state = MSTRO_CDO_STATE_REQUIRED; + mstro_stats_add_counter(MSTRO_STATS_CAT_PROTOCOL, MSTRO_STATS_L_PC_NUM_REQUIRE, 1); goto shared_cdo_state_update; case MSTRO__POOL__POOL_OP_ACK__POOL_OP__RETRACT: new_state = MSTRO_CDO_STATE_RETRACTED_GLOBALLY; + mstro_stats_add_counter(MSTRO_STATS_CAT_PROTOCOL, MSTRO_STATS_L_PC_NUM_RETRACT, 1); goto shared_cdo_state_update; case MSTRO__POOL__POOL_OP_ACK__POOL_OP__WITHDRAW: new_state = MSTRO_CDO_STATE_WITHDRAWN_GLOBALLY; + mstro_stats_add_counter(MSTRO_STATS_CAT_PROTOCOL, MSTRO_STATS_L_PC_NUM_WITHDRAW, 1); shared_cdo_state_update: { assert(poack->operand_case==MSTRO__POOL__POOL_OP_ACK__OPERAND_CDOID); assert(poack->cdoid!=NULL); @@ -544,6 +552,7 @@ mstro_pc__handle_initiate_transfer(const Mstro__Pool__InitiateTransfer* init) return MSTRO_FAIL; } + mstro_stats_add_counter(MSTRO_STATS_CAT_PROTOCOL, MSTRO_STATS_L_PC_NUM_TICKETS_OUT, 1); return MSTRO_OK; } @@ -664,6 +673,7 @@ mstro_pc__handle_transfer_ticket(Mstro__Pool__TransferTicket* ticket) } /* Each (GFS and MIO TODO) method waits for the transport to complete before sending completion themselves */ + mstro_stats_add_counter(MSTRO_STATS_CAT_PROTOCOL, MSTRO_STATS_L_PC_NUM_TICKETS_IN, 1); return MSTRO_OK; } @@ -722,6 +732,7 @@ mstro_pc__handle_event(const Mstro__Pool__Event *ev) DEBUG("Pool event for sid %" PRIu64 ", kind %d (payload case %d)\n", ev->subscription_handle->id, ev->kind, ev->payload_case); + mstro_stats_add_counter(MSTRO_STATS_CAT_PROTOCOL, MSTRO_STATS_L_PC_NUM_POOL_EVENTS, 1); uint64_t sid = ev->subscription_handle->id; return mstro_pool_event_consume(ev);