shmmonitor: add --list-all

This commit is contained in:
Alexey Rybalchenko
2021-04-07 09:12:33 +02:00
parent 2602f53585
commit 5facc441b8
3 changed files with 40 additions and 0 deletions

View File

@@ -86,6 +86,8 @@ int main(int argc, char** argv)
bool debug = false;
bool cleanOnExit = false;
bool getShmId = false;
bool listAll = false;
string listAllPath;
bool verbose = false;
int userId = -1;
@@ -104,6 +106,8 @@ int main(int argc, char** argv)
("clean-on-exit,e", value<bool>(&cleanOnExit)->implicit_value(true), "Perform cleanup on exit")
("interval" , value<unsigned int>(&intervalInMS)->default_value(100), "Output interval for interactive mode")
("get-shmid" , value<bool>(&getShmId)->implicit_value(true), "Translate given session id and user id to a shmem id (uses current user id if none provided)")
("list-all" , value<bool>(&listAll)->implicit_value(true), "List all sessions & segments")
("list-all-path" , value<string>(&listAllPath)->default_value("/dev/shm/"),"Path for the --list-all command to search segments in")
("verbose" , value<bool>(&verbose)->implicit_value(true), "Verbose mode (daemon will output to a file 'fairmq-shmmonitor_log_<timestamp>')")
("user-id" , value<int>(&userId)->default_value(-1), "User id (used with --get-shmid)")
("help,h", "Print help");
@@ -150,6 +154,11 @@ int main(int argc, char** argv)
return 0;
}
if (listAll) {
Monitor::ListAll(listAllPath);
return 0;
}
if (!viewOnly && !interactive && !monitor) {
// if neither of the run modes are selected, use view only mode.
viewOnly = true;