From 074d835fc8fe96906594e48c0c669a3da64ea617 Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Mon, 8 May 2023 11:43:34 -0700 Subject: [PATCH] ioc: add INST_COUNTER --- ioc/groupsource.cpp | 3 +++ ioc/groupsrcsubscriptionctx.h | 2 ++ ioc/securityclient.h | 3 +++ ioc/singlesource.cpp | 3 +++ ioc/singlesrcsubscriptionctx.cpp | 2 ++ ioc/singlesrcsubscriptionctx.h | 3 +++ 6 files changed, 16 insertions(+) diff --git a/ioc/groupsource.cpp b/ioc/groupsource.cpp index 87b515c..fbd14d7 100644 --- a/ioc/groupsource.cpp +++ b/ioc/groupsource.cpp @@ -34,6 +34,9 @@ namespace ioc { DEFINE_LOGGER(_logname, "pvxs.ioc.group.source"); +DEFINE_INST_COUNTER(GroupSourceSubscriptionCtx); +DEFINE_INST_COUNTER(GroupSecurityCache); + /** * Constructor for GroupSource registrar. */ diff --git a/ioc/groupsrcsubscriptionctx.h b/ioc/groupsrcsubscriptionctx.h index f51ad1a..e120d2f 100644 --- a/ioc/groupsrcsubscriptionctx.h +++ b/ioc/groupsrcsubscriptionctx.h @@ -19,6 +19,7 @@ #include "fieldsubscriptionctx.h" #include "group.h" #include "subscriptionctx.h" +#include "utilpvt.h" namespace pvxs { namespace ioc { @@ -30,6 +31,7 @@ public: bool eventsPrimed = false, firstEvent = true; bool eventsEnabled = false; std::unique_ptr subscriptionControl{}; + INST_COUNTER(GroupSourceSubscriptionCtx); // This is as a special case for storing the initial value prior to both initial subscription events returning // This is so that we can merge this with the subsequent values that come in before all initial events are in diff --git a/ioc/securityclient.h b/ioc/securityclient.h index f54e005..7288fdf 100644 --- a/ioc/securityclient.h +++ b/ioc/securityclient.h @@ -17,6 +17,7 @@ #include "credentials.h" #include "typeutils.h" +#include "utilpvt.h" namespace pvxs { namespace ioc { @@ -45,6 +46,7 @@ class GroupSecurityCache : public SecurityControlObject { public: std::vector securityClients; std::unique_ptr credentials; + INST_COUNTER(GroupSecurityCache); }; /** @@ -65,6 +67,7 @@ struct PutOperationCache : public SingleSecurityCache { processNotify notify{}; Value valueToSet; std::unique_ptr putOperation; + INST_COUNTER(PutOperationCache); ~PutOperationCache(); }; diff --git a/ioc/singlesource.cpp b/ioc/singlesource.cpp index ef66177..8e1c0a0 100644 --- a/ioc/singlesource.cpp +++ b/ioc/singlesource.cpp @@ -39,6 +39,9 @@ namespace ioc { DEFINE_LOGGER(_logname, "pvxs.ioc.single.source"); +DEFINE_INST_COUNTER(PutOperationCache); +DEFINE_INST_COUNTER(SingleInfo); + namespace { void subscriptionCallback(SingleSourceSubscriptionCtx* subscriptionContext, diff --git a/ioc/singlesrcsubscriptionctx.cpp b/ioc/singlesrcsubscriptionctx.cpp index adc4064..53429be 100644 --- a/ioc/singlesrcsubscriptionctx.cpp +++ b/ioc/singlesrcsubscriptionctx.cpp @@ -13,6 +13,8 @@ namespace pvxs { namespace ioc { +DEFINE_INST_COUNTER(SingleSourceSubscriptionCtx); + /** * Constructor for single source subscription context using a pointer to a db channel * diff --git a/ioc/singlesrcsubscriptionctx.h b/ioc/singlesrcsubscriptionctx.h index 64002ae..fc7954f 100644 --- a/ioc/singlesrcsubscriptionctx.h +++ b/ioc/singlesrcsubscriptionctx.h @@ -15,12 +15,14 @@ #include "channel.h" #include "fieldconfig.h" #include "subscriptionctx.h" +#include "utilpvt.h" namespace pvxs { namespace ioc { struct SingleInfo : public MappingInfo { Channel chan; + INST_COUNTER(SingleInfo); explicit SingleInfo(Channel&& chan) :chan(std::move(chan)) { updateNsecMask(dbChannelRecord(this->chan)); @@ -45,6 +47,7 @@ public: epicsMutex eventLock{}; std::unique_ptr subscriptionControl{}; bool eventsEnabled = false; + INST_COUNTER(SingleSourceSubscriptionCtx); ~SingleSourceSubscriptionCtx() { assert(!eventsEnabled);