added diagnostics
This commit is contained in:
@@ -55,6 +55,7 @@ public:
|
||||
dbSubscriptionIO ( dbChannelIO &chanIO, cacNotify &, unsigned type, unsigned long count );
|
||||
int begin ( struct dbAddr &addr, unsigned mask );
|
||||
void destroy ();
|
||||
void show ( unsigned level ) const;
|
||||
static void * operator new ( size_t size );
|
||||
static void operator delete ( void *pCadaver, size_t size );
|
||||
private:
|
||||
@@ -77,6 +78,7 @@ public:
|
||||
int initiatePutNotify (cacNotify ¬ify, struct dbAddr &addr,
|
||||
unsigned type, unsigned long count, const void *pValue);
|
||||
void putNotifyDestroyNotify ();
|
||||
void show ( unsigned level ) const;
|
||||
static void * operator new ( size_t size );
|
||||
static void operator delete ( void *pCadaver, size_t size );
|
||||
private:
|
||||
@@ -98,7 +100,7 @@ public:
|
||||
void subscriptionUpdate ( unsigned type, unsigned long count,
|
||||
const struct db_field_log *pfl, cacNotifyIO ¬ify );
|
||||
dbEventSubscription subscribe ( dbSubscriptionIO &subscr, unsigned mask );
|
||||
|
||||
void show ( unsigned level ) const;
|
||||
static void * operator new ( size_t size);
|
||||
static void operator delete ( void *pCadaver, size_t size );
|
||||
|
||||
@@ -107,7 +109,7 @@ private:
|
||||
char *pGetCallbackCache;
|
||||
dbPutNotifyBlocker *pBlocker;
|
||||
unsigned long getCallbackCacheSize;
|
||||
tsDLList <dbSubscriptionIO> eventq;
|
||||
tsDLList < dbSubscriptionIO > eventq;
|
||||
dbAddr addr;
|
||||
|
||||
static tsFreeList < dbChannelIO > freeList;
|
||||
@@ -143,6 +145,7 @@ public:
|
||||
void subscriptionUpdate ( struct dbAddr &addr, unsigned type, unsigned long count,
|
||||
const struct db_field_log *pfl, cacNotifyIO ¬ify );
|
||||
dbEventSubscription subscribe ( struct dbAddr &addr, dbSubscriptionIO &subscr, unsigned mask );
|
||||
void show ( unsigned level ) const;
|
||||
private:
|
||||
dbEventCtx ctx;
|
||||
char *pEventCallbackCache;
|
||||
|
||||
@@ -186,3 +186,29 @@ void dbChannelIO::unlockOutstandingIO () const
|
||||
{
|
||||
}
|
||||
|
||||
void dbChannelIO::show ( unsigned level ) const
|
||||
{
|
||||
this->lock ();
|
||||
printf ("channel at %p attached to local database record %s\n",
|
||||
this, this->addr.precord->name );
|
||||
|
||||
if ( level > 0u ) {
|
||||
printf ( "\ttype %s, element count %li, field at %p\n",
|
||||
dbf_type_to_text ( this->addr.dbr_field_type ), this->addr.no_elements,
|
||||
this->addr.pfield );
|
||||
}
|
||||
if ( level > 1u ) {
|
||||
this->serviceIO.show ( level - 2u );
|
||||
printf ( "\tget callback cache at %p, with size %lu\n",
|
||||
this->pGetCallbackCache, this->getCallbackCacheSize );
|
||||
tsDLIterConstBD < dbSubscriptionIO > pItem = this->eventq.first ();
|
||||
while ( pItem.valid () ) {
|
||||
pItem->show ( level - 2u );
|
||||
pItem++;
|
||||
}
|
||||
if ( this->pBlocker ) {
|
||||
this->pBlocker->show ( level - 2u );
|
||||
}
|
||||
}
|
||||
this->unlock ();
|
||||
}
|
||||
|
||||
@@ -104,5 +104,17 @@ extern "C" void putNotifyCompletion ( putNotify *ppn )
|
||||
pBlocker->block.signal ();
|
||||
}
|
||||
|
||||
void dbPutNotifyBlocker::show ( unsigned level ) const
|
||||
{
|
||||
printf ( "put notify blocker at %p\n", this );
|
||||
if ( level > 0u ) {
|
||||
printf ( "\tdbPutNotifyIO at %p\n", this->pPN );
|
||||
printf ( "\tdbChannelIO at %p\n", &this->chan );
|
||||
}
|
||||
if ( level > 1u ) {
|
||||
this->block.show ( level - 2u );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -156,3 +156,18 @@ dbEventSubscription dbServiceIO::subscribe ( struct dbAddr &addr, dbSubscription
|
||||
|
||||
return es;
|
||||
}
|
||||
|
||||
void dbServiceIO::show ( unsigned level ) const
|
||||
{
|
||||
this->mutex.lock ();
|
||||
printf ( "dbServiceIO at %p\n", this );
|
||||
if (level > 0u ) {
|
||||
printf ( "\tevent call back cache location %p, and its size %lu\n",
|
||||
this->pEventCallbackCache, this->eventCallbackCacheSize );
|
||||
}
|
||||
if ( level > 1u ) {
|
||||
this->mutex.show ( level - 2u );
|
||||
}
|
||||
this->mutex.unlock ();
|
||||
}
|
||||
|
||||
|
||||
@@ -89,3 +89,19 @@ int dbSubscriptionIO::begin ( struct dbAddr &addr, unsigned mask )
|
||||
}
|
||||
}
|
||||
|
||||
void dbSubscriptionIO::show ( unsigned level ) const
|
||||
{
|
||||
printf ( "Data base subscription IO at %p\n", this );
|
||||
if ( level > 0u ) {
|
||||
short tmpType;
|
||||
if ( this->type < SHRT_MAX ) {
|
||||
tmpType = static_cast < short > ( this->type );
|
||||
printf ( "\ttype %s, count %lu, channel at %p\n",
|
||||
dbf_type_to_text ( tmpType ), this->count, &this->chan );
|
||||
}
|
||||
else {
|
||||
printf ("strange type !, count %lu, channel at %p\n",
|
||||
this->count, &this->chan );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,7 +75,7 @@ void * tsFreeList < T, N, DEBUG_LEVEL >::allocate (size_t size)
|
||||
{
|
||||
tsFreeListItem < T, DEBUG_LEVEL > *p;
|
||||
|
||||
if ( size != sizeof ( T ) ) {
|
||||
if ( size != sizeof ( T ) || N == 0u ) {
|
||||
return ::operator new (size);
|
||||
}
|
||||
|
||||
@@ -115,14 +115,12 @@ void tsFreeList < T, N, DEBUG_LEVEL >::release (void *pCadaver, size_t size)
|
||||
if ( size != sizeof ( T ) ) {
|
||||
::operator delete ( pCadaver );
|
||||
}
|
||||
else {
|
||||
if ( pCadaver ) {
|
||||
this->lock ();
|
||||
tsFreeListItem < T, DEBUG_LEVEL > *p =
|
||||
static_cast < tsFreeListItem < T, DEBUG_LEVEL > *> ( pCadaver );
|
||||
p->pNext = this->pFreeList;
|
||||
this->pFreeList = p;
|
||||
this->unlock ();
|
||||
}
|
||||
else if ( pCadaver ) {
|
||||
this->lock ();
|
||||
tsFreeListItem < T, DEBUG_LEVEL > *p =
|
||||
static_cast < tsFreeListItem < T, DEBUG_LEVEL > *> ( pCadaver );
|
||||
p->pNext = this->pFreeList;
|
||||
this->pFreeList = p;
|
||||
this->unlock ();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -90,6 +90,30 @@ void ipAddrToAsciiEngine::entryPoint ()
|
||||
this->threadExit.signal ();
|
||||
}
|
||||
|
||||
void ipAddrToAsciiEngine::show ( unsigned level ) const
|
||||
{
|
||||
this->mutex.lock ();
|
||||
printf ( "ipAddrToAsciiEngine at %p with %u requests pendingh\n",
|
||||
this, this->labor.count () );
|
||||
if ( level > 0u ) {
|
||||
tsDLIterConstBD < ipAddrToAsciiAsynchronous > pItem = this->labor.first ();
|
||||
while ( pItem.valid () ) {
|
||||
pItem->show ( level - 1u );
|
||||
}
|
||||
printf ( "nextId = %u\n", this->nextId );
|
||||
}
|
||||
if ( level > 1u ) {
|
||||
printf ( "mutex:\n" );
|
||||
this->mutex.show ( level - 2u );
|
||||
printf ( "event:\n" );
|
||||
this->event.show ( level - 2u );
|
||||
printf ( "exitFlag boolean = %u\n", this->exitFlag );
|
||||
printf ( "exit event:\n" );
|
||||
this->threadExit.show ( level - 2u );
|
||||
}
|
||||
this->mutex.unlock ();
|
||||
}
|
||||
|
||||
ipAddrToAsciiAsynchronous::ipAddrToAsciiAsynchronous
|
||||
( const osiSockAddr &addrIn ) :
|
||||
addr ( addrIn ), pEngine ( 0u )
|
||||
@@ -128,3 +152,16 @@ epicsShareFunc bool ipAddrToAsciiAsynchronous::ioInitiate ( ipAddrToAsciiEngine
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
void ipAddrToAsciiAsynchronous::show ( unsigned level ) const
|
||||
{
|
||||
char ipAddr [64];
|
||||
|
||||
ipAddrToAsciiEngine::mutex.lock ();
|
||||
sockAddrToA ( &this->addr.sa, ipAddr, sizeof ( ipAddr ) );
|
||||
printf ( "ipAddrToAsciiAsynchronous for address %s\n", ipAddr );
|
||||
if ( level > 0u ) {
|
||||
printf ( "\tidentifier %u, engine %p\n", this->id, this->pEngine );
|
||||
}
|
||||
ipAddrToAsciiEngine::mutex.unlock ();
|
||||
}
|
||||
|
||||
@@ -30,6 +30,7 @@ class ipAddrToAsciiEngine : public osiThread {
|
||||
public:
|
||||
epicsShareFunc ipAddrToAsciiEngine ( const char *pName );
|
||||
epicsShareFunc ~ipAddrToAsciiEngine ();
|
||||
epicsShareFunc void show ( unsigned level ) const;
|
||||
private:
|
||||
tsDLList < ipAddrToAsciiAsynchronous > labor;
|
||||
osiEvent event;
|
||||
@@ -56,6 +57,7 @@ public:
|
||||
epicsShareFunc bool ioInitiate ( ipAddrToAsciiEngine &engine );
|
||||
epicsShareFunc bool identicalAddress ( const osiSockAddr &addr ) const;
|
||||
epicsShareFunc osiSockAddr address () const;
|
||||
epicsShareFunc void show ( unsigned level ) const;
|
||||
virtual void ioCompletionNotify ( const char *pHostName ) = 0;
|
||||
private:
|
||||
osiSockAddr addr;
|
||||
|
||||
@@ -20,9 +20,9 @@ public:
|
||||
~osiEvent ();
|
||||
void signal ();
|
||||
void wait (); /* blocks until full */
|
||||
bool wait (double timeOut); /* false if empty at time out */
|
||||
bool wait ( double timeOut ); /* false if empty at time out */
|
||||
bool tryWait (); /* false if empty */
|
||||
void show (unsigned level);
|
||||
void show ( unsigned level ) const;
|
||||
|
||||
class invalidSemaphore {}; /* exception */
|
||||
class noMemory {}; /* exception */
|
||||
@@ -89,9 +89,9 @@ inline bool osiEvent::tryWait ()
|
||||
}
|
||||
}
|
||||
|
||||
inline void osiEvent::show (unsigned level)
|
||||
inline void osiEvent::show ( unsigned level ) const
|
||||
{
|
||||
semBinaryShow (this->id, level);
|
||||
semBinaryShow ( this->id, level );
|
||||
}
|
||||
|
||||
#endif /* osiEventh */
|
||||
|
||||
@@ -19,10 +19,10 @@ public:
|
||||
osiMutex ();
|
||||
~osiMutex ();
|
||||
void lock () const; /* blocks until success */
|
||||
bool lock (double timeOut) const; /* true if successful */
|
||||
bool lock ( double timeOut ) const; /* true if successful */
|
||||
bool tryLock () const; /* true if successful */
|
||||
void unlock () const;
|
||||
void show (unsigned level) const;
|
||||
void show ( unsigned level ) const;
|
||||
|
||||
class invalidSemaphore {}; /* exception */
|
||||
class noMemory {}; /* exception */
|
||||
|
||||
Reference in New Issue
Block a user