show cache cleaner info

This commit is contained in:
Michael Davidsaver
2015-12-08 14:39:31 -05:00
parent 550628dd85
commit 225c7ccb47
3 changed files with 13 additions and 9 deletions

View File

@ -109,7 +109,7 @@ struct ChannelCache::cacheClean : public epicsTimerNotify
{
Guard G(cache->cacheLock);
std::cout<<"GWServer cleaning cache w/ "<<cache->entries.size()<<" entries\n";
cache->cleanerRuns++;
ChannelCache::entries_t::iterator cur=cache->entries.begin(), next, end=cache->entries.end();
while(cur!=end) {
@ -117,15 +117,11 @@ struct ChannelCache::cacheClean : public epicsTimerNotify
++next;
if(!cur->second->dropPoke && cur->second->interested.empty()) {
//ChannelCacheEntry::shared_pointer E(cur->second);
std::cout<<"GWServer cache remove "<<cur->second->channelName<<"\n";
cleaned.insert(cur->second);
cache->entries.erase(cur);
cache->cleanerDust++;
} else {
cur->second->dropPoke = false;
std::cout<<"GWServer cache "<<cur->second->channelName
<<" interest "<<cur->second->interested.size()
<<"\n";
}
cur = next;

View File

@ -143,6 +143,8 @@ struct ChannelCache
epicsTimer *cleanTimer;
struct cacheClean;
cacheClean *cleaner;
size_t cleanerRuns;
size_t cleanerDust;
ChannelCache();
~ChannelCache();

View File

@ -281,11 +281,13 @@ void statusServer(int lvl, const char *chanexpr)
ChannelCache::entries_t entries;
size_t ncache;
size_t ncache, ncleaned, ndust;
{
Guard G(scp->cache.cacheLock);
ncache = scp->cache.entries.size();
ncleaned = scp->cache.cleanerRuns;
ndust = scp->cache.cleanerDust;
if(lvl>0) {
if(!chanexpr || iswild) { // no string or some glob pattern
@ -298,7 +300,8 @@ void statusServer(int lvl, const char *chanexpr)
}
}
std::cout<<"Cache has "<<ncache<<" channels\n";
std::cout<<"Cache has "<<ncache<<" channels. Cleaned "
<<ncleaned<<" times closing "<<ndust<<" channels\n";
if(lvl<=0)
continue;
@ -311,12 +314,14 @@ void statusServer(int lvl, const char *chanexpr)
ChannelCacheEntry& E = *it->second;
ChannelCacheEntry::mon_entries_t::lock_vector_type mons;
size_t nsrv, nmon;
bool dropflag;
const char *chstate;
{
Guard G(scp->cache.cacheLock);
chstate = pva::Channel::ConnectionStateNames[E.channel->getConnectionState()];
nsrv = E.interested.size();
nmon = E.mon_entries.size();
dropflag = E.dropPoke;
if(lvl>1)
mons = E.mon_entries.lock_vector();
@ -325,7 +330,8 @@ void statusServer(int lvl, const char *chanexpr)
std::cout<<chstate
<<" Client Channel '"<<channame
<<"' used by "<<nsrv<<" Server channel(s) with "
<<nmon<<" unique subscription(s)\n";
<<nmon<<" unique subscription(s) "
<<(dropflag?'!':'_')<<"\n";
if(lvl<=1)
continue;