shmmonitor: add session name and creator id to the output

This commit is contained in:
Alexey Rybalchenko
2021-03-27 23:26:23 +01:00
parent 863d932a3d
commit a64207eec2
4 changed files with 42 additions and 9 deletions

View File

@@ -270,6 +270,8 @@ void Monitor::CheckSegment()
fSeenOnce = true;
unsigned int numDevices = 0;
int creatorId = -1;
std::string sessionName;
#ifdef FAIRMQ_DEBUG_MODE
Uint16MsgCounterHashMap* msgCounters = nullptr;
#endif
@@ -279,6 +281,11 @@ void Monitor::CheckSegment()
if (dc) {
numDevices = dc->fCount;
}
SessionInfo* si = managementSegment.find<SessionInfo>(unique_instance).first;
if (si) {
creatorId = si->fCreatorId;
sessionName = si->fSessionName;
}
#ifdef FAIRMQ_DEBUG_MODE
msgCounters = managementSegment.find<Uint16MsgCounterHashMap>(unique_instance).first;
#endif
@@ -305,7 +312,10 @@ void Monitor::CheckSegment()
size_t mused = mtotal - mfree;
ss << "shm id: " << fShmId
<< ", devices: " << numDevices << ", segments:\n";
<< ", session: " << sessionName
<< ", creator id: " << creatorId
<< ", devices: " << numDevices
<< ", segments:\n";
for (const auto& s : segments) {
size_t free = boost::apply_visitor(SegmentFreeMemory(), s.second);
size_t total = boost::apply_visitor(SegmentSize(), s.second);
@@ -328,6 +338,9 @@ void Monitor::CheckSegment()
LOGV(info, user1) << ss.str();
}
} catch (bie&) {
if (!fMonitor && !fInteractive) {
cout << "No segments found." << endl;
}
fHeartbeatTriggered = false;
if (fSelfDestruct) {