159{
160 if(!client)
161 client= "";
162 if(!channel)
163 channel = "";
164
165 bool iswild = strchr(channel, '?') || strchr(channel, '*');
166
167 FOREACH(clients_t::const_iterator, it, end, clients)
168 {
169 if(client[0]!='\0' && client[0]!='*' && it->first!=client)
170 continue;
171
172 const GWServerChannelProvider::shared_pointer& prov(it->second);
173
174 std::cout<<"==> Client: "<<it->first<<"\n";
175
176 ChannelCache::entries_t entries;
177
178 size_t ncache, ncleaned, ndust;
179 {
180 Guard G(prov->cache.cacheLock);
181
182 ncache = prov->cache.entries.size();
183 ncleaned = prov->cache.cleanerRuns;
184 ndust = prov->cache.cleanerDust;
185
186 if(lvl>0) {
187 if(!iswild) {
188 entries = prov->cache.entries;
189 } else {
190 ChannelCache::entries_t::iterator it(prov->cache.entries.find(channel));
191 if(it!=prov->cache.entries.end())
192 entries[it->first] = it->second;
193 }
194 }
195 }
196
197 std::cout<<"Cache has "<<ncache<<" channels. Cleaned "
198 <<ncleaned<<" times closing "<<ndust<<" channels\n";
199
200 if(lvl<=0)
201 continue;
202
203 FOREACH(ChannelCache::entries_t::const_iterator, it2, end2, entries)
204 {
205 const std::string& channame = it2->first;
206 if(iswild && !epicsStrGlobMatch(channame.c_str(), channel))
207 continue;
208
209 ChannelCacheEntry& E = *it2->second;
210 ChannelCacheEntry::mon_entries_t::lock_vector_type mons;
211 size_t nsrv, nmon;
212 bool dropflag;
213 const char *chstate;
214 {
215 Guard G(E.mutex());
216 chstate = pva::Channel::ConnectionStateNames[E.channel->getConnectionState()];
217 nsrv = E.interested.
size();
218 nmon = E.mon_entries.
size();
219 dropflag = E.dropPoke;
220
221 if(lvl>1)
223 }
224
225 std::cout<<chstate
226 <<" Client Channel '"<<channame
227 <<"' used by "<<nsrv<<" Server channel(s) with "
228 <<nmon<<" unique subscription(s) "
229 <<(dropflag?'!':'_')<<"\n";
230
231 if(lvl<=1)
232 continue;
233
234 FOREACH(ChannelCacheEntry::mon_entries_t::lock_vector_type::const_iterator, it2, end2, mons) {
235 MonitorCacheEntry& ME = *it2->second;
236
237 MonitorCacheEntry::interested_t::vector_type usrs;
238 size_t nsrvmon;
239#ifdef USE_MSTATS
240 pvd::Monitor::Stats mstats;
241#endif
242 bool hastype, hasdata, isdone;
243 {
244 Guard G(ME.mutex());
245
246 nsrvmon = ME.interested.
size();
247 hastype = !!ME.typedesc;
249 isdone = ME.done;
250
251#ifdef USE_MSTATS
252 if(ME.mon)
253 ME.mon->getStats(mstats);
254#endif
255
256 if(lvl>2)
258 }
259
260
261 std::cout<<" Client Monitor used by "<<nsrvmon<<" Server monitors, "
262 <<"Has "<<(hastype?"":"not ")
263 <<"opened, Has "<<(hasdata?"":"not ")
264 <<"recv'd some data, Has "<<(isdone?"":"not ")<<"finalized\n"
265 " "<< epicsAtomicGetSizeT(&ME.nwakeups)<<" wakeups "
266 <<epicsAtomicGetSizeT(&ME.nevents)<<" events\n";
267#ifdef USE_MSTATS
268 if(mstats.nempty || mstats.nfilled || mstats.noutstanding)
269 std::cout<<" US monitor queue "<<mstats.nfilled
270 <<" filled, "<<mstats.noutstanding
271 <<" outstanding, "<<mstats.nempty<<" empty\n";
272#endif
273 if(lvl<=2)
274 continue;
275
276 FOREACH(MonitorCacheEntry::interested_t::vector_type::const_iterator, it3, end3, usrs) {
277 MonitorUser& MU = **it3;
278
279 size_t nempty, nfilled, nused, total;
280 std::string remote;
281 bool isrunning;
282 {
283 Guard G(MU.mutex());
284
285 nempty = MU.empty.size();
286 nfilled = MU.filled.size();
287 nused = MU.inuse.size();
288 isrunning = MU.running;
289
290 GWChannel::shared_pointer srvchan(MU.srvchan.lock());
291 if(srvchan)
292 remote = srvchan->address;
293 else
294 remote = "<unknown>";
295 }
296 total = nempty + nfilled + nused;
297
298 std::cout<<" Server monitor from "
299 <<remote
300 <<(isrunning?"":" Paused")
301 <<" buffer "<<nfilled<<"/"<<total
302 <<" out "<<nused<<"/"<<total
303 <<" "<<epicsAtomicGetSizeT(&MU.nwakeups)<<" wakeups "
304 <<epicsAtomicGetSizeT(&MU.nevents)<<" events "
305 <<epicsAtomicGetSizeT(&MU.ndropped)<<" drops\n";
306 }
307 }
308
309
310
311 }
312
313
314 std::cout<<"<== Client: "<<it->first<<"\n\n";
315 }
316}
vector_type lock_vector() const
lock_vector_type lock_vector() const
epics::pvData::MonitorElement::shared_pointer lastelem