diff --git a/src/cas/generic/caServer.cc b/src/cas/generic/caServer.cc index 5a174e758..aecfb8b45 100644 --- a/src/cas/generic/caServer.cc +++ b/src/cas/generic/caServer.cc @@ -204,6 +204,60 @@ epicsShareFunc casEventMask caServer::alarmEventMask () const } } +// +// caServer::readEventsProcessedCounter +// +#ifdef CAS_DIAGNOSTICS_API_WHICH_MAY_VANISH_IN_THE_FUTURE +epicsShareFunc unsigned caServer::readEventsProcessedCounter (void) const +{ + if (pCAS) { + return this->pCAS->readEventsProcessedCounter (); + } + else { + return 0u; + } +} +#endif + +// +// caServer::clearEventsProcessedCounter +// +#ifdef CAS_DIAGNOSTICS_API_WHICH_MAY_VANISH_IN_THE_FUTURE +epicsShareFunc void caServer::clearEventsProcessedCounter (void) +{ + if (pCAS) { + this->pCAS->clearEventsProcessedCounter (); + } +} +#endif + +// +// caServer::readEventsPostedCounter +// +#ifdef CAS_DIAGNOSTICS_API_WHICH_MAY_VANISH_IN_THE_FUTURE +epicsShareFunc unsigned caServer::readEventsPostedCounter (void) const +{ + if (pCAS) { + return this->pCAS->readEventsPostedCounter (); + } + else { + return 0u; + } +} +#endif + +// +// caServer::clearEventsPostedCounter +// +#ifdef CAS_DIAGNOSTICS_API_WHICH_MAY_VANISH_IN_THE_FUTURE +epicsShareFunc void caServer::clearEventsPostedCounter (void) +{ + if (pCAS) { + this->pCAS->clearEventsPostedCounter (); + } +} +#endif + // // casRes::~casRes() // diff --git a/src/cas/generic/caServerIIL.h b/src/cas/generic/caServerIIL.h index 9e13166e8..263167750 100644 --- a/src/cas/generic/caServerIIL.h +++ b/src/cas/generic/caServerIIL.h @@ -26,28 +26,6 @@ * Advanced Photon Source * Argonne National Laboratory * - * - * History - * $Log$ - * Revision 1.6 1999/08/04 23:52:10 jhill - * chronIntIdResTable name change - * - * Revision 1.5 1997/06/13 09:15:52 jhill - * connect proto changes - * - * Revision 1.4 1997/04/10 19:33:54 jhill - * API changes - * - * Revision 1.3 1996/11/02 00:53:56 jhill - * many improvements - * - * Revision 1.2 1996/09/16 18:23:57 jhill - * vxWorks port changes - * - * Revision 1.1.1.1 1996/06/20 00:28:16 jhill - * ca server installation - * - * */ @@ -94,15 +72,15 @@ inline casRes *caServerI::lookupRes(const caResId &idIn, casResType type) // inline casChannelI *caServerI::resIdToChannel(const caResId &id) { - casRes *pRes; - - pRes = this->lookupRes(id, casChanT); - - // - // safe to cast because we have checked the type code above - // (and we know that casChannelI derived from casRes) - // - return (casChannelI *) pRes; + casRes *pRes; + + pRes = this->lookupRes(id, casChanT); + + // + // safe to cast because we have checked the type code above + // (and we know that casChannelI derived from casRes) + // + return (casChannelI *) pRes; } // @@ -129,20 +107,77 @@ inline void caServerI::setDebugLevel(unsigned debugLevelIn) this->debugLevel = debugLevelIn; } +// +// casEventMask caServerI::valueEventMask() +// inline casEventMask caServerI::valueEventMask() const { return this->valueEvent; } +// +// caServerI::logEventMask() +// inline casEventMask caServerI::logEventMask() const { return this->logEvent; } +// +// caServerI::alarmEventMask() +// inline casEventMask caServerI::alarmEventMask() const { return this->alarmEvent; } +// +// caServerI::readEventsProcessedCounter (void) const +// +inline unsigned caServerI::readEventsProcessedCounter (void) const +{ + return this->nEventsProcessed; +} + +// +// caServerI::incEventsProcessedCounter (void) +// +inline void caServerI::incrEventsProcessedCounter (void) +{ + this->nEventsProcessed++; +} + +// +// caServerI::clearEventsProcessedCounter (void) +// +inline void caServerI::clearEventsProcessedCounter (void) +{ + this->nEventsProcessed = 0u; +} + +// +// caServerI::readEventsPostedCounter (void) const +// +inline unsigned caServerI::readEventsPostedCounter (void) const +{ + return this->nEventsPosted; +} + +// +// caServerI::incEventsPostedCounter (void) +// +inline void caServerI::incrEventsPostedCounter (void) +{ + this->nEventsPosted++; +} + +// +// caServerI::clearEventsPostedCounter (void) +// +inline void caServerI::clearEventsPostedCounter (void) +{ + this->nEventsPosted = 0u; +} + #endif // caServerIIL_h diff --git a/src/cas/generic/casEventSysIL.h b/src/cas/generic/casEventSysIL.h index eda5e2b9e..ed66973cb 100644 --- a/src/cas/generic/casEventSysIL.h +++ b/src/cas/generic/casEventSysIL.h @@ -37,8 +37,6 @@ // casEventSys::casEventSys () // inline casEventSys::casEventSys () : - nProcessed (0ul), - nPosted (0ul), pPurgeEvent (NULL), numEventBlocks (0u), maxLogEntries (individualEventEntries), @@ -135,21 +133,5 @@ inline casMonitor *casEventSys::resIdToMon(const caResId id) return (casMonitor *) pRes; } -// -// casEventSys::nEventsProcessed () -// -unsigned long casEventSys::nEventsProcessed () const -{ - return this->nProcessed; -} - -// -// casEventSys::nEventsPosted () -// -unsigned long casEventSys::nEventsPosted () const -{ - return this->nPosted; -} - #endif // casEventSysIL_h diff --git a/src/cas/generic/casMonitor.cc b/src/cas/generic/casMonitor.cc index 011f82822..c691cbd32 100644 --- a/src/cas/generic/casMonitor.cc +++ b/src/cas/generic/casMonitor.cc @@ -130,6 +130,8 @@ void casMonitor::push(gdd &newValue) this->mutex.lock(); + client.getCAS().incrEventsPostedCounter (); + // // get a new block if we havent exceeded quotas // @@ -223,6 +225,8 @@ caStatus casMonitor::executeEvent(casMonEvent *pEV) else { delete pEV; } + + this->ciu.getClient().getCAS().incrEventsProcessedCounter (); return S_cas_success; } diff --git a/src/cas/generic/casdef.h b/src/cas/generic/casdef.h index dcd888773..c798e49e1 100644 --- a/src/cas/generic/casdef.h +++ b/src/cas/generic/casdef.h @@ -243,19 +243,8 @@ class caServerI; // caServer - Channel Access Server API Class // class caServer { -private: friend class casPVI; - // - // this private data member appears first so that - // initialization of the constant event masks below - // uses this member only after it has been initialized - // - // We do not use private inheritance here in order - // to avoid os/io dependent -I during server tool compile - // - caServerI *pCAS; - public: epicsShareFunc caServer (unsigned pvCountEstimate=1024u); epicsShareFunc virtual ~caServer() = 0; @@ -362,13 +351,39 @@ public: epicsShareFunc void setDebugLevel (unsigned level); epicsShareFunc unsigned getDebugLevel () const; - // - // show() - // + // + // dump internal state of server to standard out + // epicsShareFunc virtual void show (unsigned level) const; + // + // examine or clear diagnostic counters + // + // eventsPosted - number of events posted by server tool to the event queue + // eventsProcessed - number of events removed by server library from the event queue + // + // NOTE: this is an experimental interface which may change or vanish in + // the future. Perhaps a better alternative is to export this sort of + // information via dedicated process variables. + // +#ifdef CAS_DIAGNOSTICS_API_WHICH_MAY_VANISH_IN_THE_FUTURE + epicsShareFunc unsigned readEventsProcessedCounter (void) const; + epicsShareFunc void clearEventsProcessedCounter (void); + epicsShareFunc unsigned readEventsPostedCounter (void) const; + epicsShareFunc void clearEventsPostedCounter (void); +#endif + //caStatus enableClients (); //caStatus disableClients (); + +private: + + // + // We do not use private inheritance here beacuse: + // o wish to avoid os/io dependent -I during server tool compile + // o server tool rebuild when internal structure of the server changes + // + caServerI *pCAS; }; // @@ -748,8 +763,9 @@ public: // // place notification of IO completion on the event queue - // (this function does not delete the casAsyncReadIO object). - // Only the first call to this function has any effect. + // (this function does not delete the casAsyncReadIO object) + // + // only the first call to this function has any effect // epicsShareFunc caStatus postIOCompletion (caStatus completionStatusIn, gdd &valueRead); @@ -765,9 +781,9 @@ public: // // called by the server lib after the response message // is succesfully queued to the client or when the - // IO operation is canceled (client disconnects etc). + // IO operation is canceled (client disconnects etc) // - // default destroy executes a "delete this". + // default destroy executes a "delete this" // epicsShareFunc virtual void destroy (); @@ -823,9 +839,9 @@ public: // // called by the server lib after the response message // is succesfully queued to the client or when the - // IO operation is canceled (client disconnects etc). + // IO operation is canceled (client disconnects etc) // - // default destroy executes a "delete this". + // default destroy executes a "delete this" // epicsShareFunc virtual void destroy (); @@ -852,8 +868,9 @@ public: // // place notification of IO completion on the event queue - // (this function does not delete the casAsyncPVExistIO object). - // Only the first call to this function has any effect. + // (this function does not delete the casAsyncPVExistIO object) + // + // only the first call to this function has any effect. // epicsShareFunc caStatus postIOCompletion (const pvExistReturn &retValIn); @@ -869,9 +886,9 @@ public: // // called by the server lib after the response message // is succesfully queued to the client or when the - // IO operation is canceled (client disconnects etc). + // IO operation is canceled (client disconnects etc) // - // default destroy executes a "delete this". + // default destroy executes a "delete this" // epicsShareFunc virtual void destroy(); @@ -914,9 +931,9 @@ public: // // called by the server lib after the response message // is succesfully queued to the client or when the - // IO operation is canceled (client disconnects etc). + // IO operation is canceled (client disconnects etc) // - // default destroy executes a "delete this". + // default destroy executes a "delete this" // epicsShareFunc virtual void destroy (); diff --git a/src/cas/generic/server.h b/src/cas/generic/server.h index 59ba9764a..40b8e551a 100644 --- a/src/cas/generic/server.h +++ b/src/cas/generic/server.h @@ -115,7 +115,7 @@ class casEventSys { friend class casEventPurgeEv; public: casEventSys (); - virtual ~casEventSys(); + virtual ~casEventSys (); void show (unsigned level) const; casProcCond process (); @@ -135,11 +135,11 @@ public: bool getNDuplicateEvents () const; - void setDestroyPending(); + void setDestroyPending (); - void eventsOn(); + void eventsOn (); - caStatus eventsOff(); + caStatus eventsOff (); virtual caStatus disconnectChan (caResId id) = 0; @@ -289,7 +289,7 @@ protected: // // pushCtx() returns an outBufCtx to be restored by popCtx() // - const inBufCtx inBuf::pushCtx (bufSizeT headerSize, bufSizeT bodySize); + const inBufCtx pushCtx (bufSizeT headerSize, bufSizeT bodySize); bufSizeT popCtx (const inBufCtx &); // returns actual size private: @@ -513,17 +513,17 @@ protected: caStatus processMsg(); -private: - // // dump message to stderr // void dumpMsg(const caHdr *mp, const void *dp); +private: + // // one function for each CA request type // - caStatus uknownMessageAction (); + virtual caStatus uknownMessageAction () = 0; caStatus ignoreMsgAction (); caStatus noopAction (); virtual caStatus eventAddAction (); @@ -626,6 +626,7 @@ private: // // one function for each CA request type // + caStatus uknownMessageAction (); caStatus eventAddAction (); caStatus eventCancelAction (); caStatus readAction (); @@ -698,7 +699,7 @@ public: // only for use with DG io // void sendBeacon (); - virtual void sendBeaconIO (char &msg, unsigned length, aitUint32 &m_ipa, aitUint16 &m_port) = 0; + virtual void sendBeaconIO (char &msg, unsigned length, aitUint16 &m_port) = 0; void destroy(); @@ -727,6 +728,7 @@ private: // one function for each CA request type // caStatus searchAction (); + caStatus uknownMessageAction (); // // searchFailResponse() @@ -874,6 +876,14 @@ public: casEventMask logEventMask() const; // DBE_LOG registerEvent("log") casEventMask alarmEventMask() const; // DBE_ALARM registerEvent("alarm") + unsigned readEventsProcessedCounter (void) const; + void incrEventsProcessedCounter (void); + void clearEventsProcessedCounter (void); + + unsigned readEventsPostedCounter (void) const; + void incrEventsPostedCounter (void); + void clearEventsPostedCounter (void); + private: void advanceBeaconPeriod(); @@ -883,6 +893,8 @@ private: double beaconPeriod; caServer &adapter; unsigned debugLevel; + unsigned nEventsProcessed; + unsigned nEventsPosted; // // predefined event types