MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / enumerate

Method enumerate

src/jrd/Monitoring.cpp:253–279  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

251
252
253void MonitoringData::enumerate(const char* userName, ULONG generation, SessionList& sessions)
254{
255 const bool init = sessions.isEmpty();
256
257 // When initializing, collect all sessions older than the given generation.
258 // Otherwise, remove sessions that have updated their generation.
259
260 for (ULONG offset = HEADER_SIZE; offset < m_sharedMemory->getHeader()->used;)
261 {
262 const auto ptr = (UCHAR*) m_sharedMemory->getHeader() + offset;
263 const auto element = (Element*) ptr;
264 const ULONG length = element->getBlockLength();
265
266 if (!userName || !strcmp(element->userName, userName)) // permitted
267 {
268 if (init)
269 {
270 if (element->generation < generation)
271 sessions.add(element->attId);
272 }
273 else if (element->generation >= generation)
274 sessions.findAndRemove(element->attId);
275 }
276
277 offset += length;
278 }
279}
280
281
282void MonitoringData::read(const char* userName, TempSpace& temp)

Callers 1

MonitoringSnapshotMethod · 0.45

Calls 5

getBlockLengthMethod · 0.80
isEmptyMethod · 0.45
getHeaderMethod · 0.45
addMethod · 0.45
findAndRemoveMethod · 0.45

Tested by

no test coverage detected