diff --git a/doc/src/Tools.rst b/doc/src/Tools.rst index ea813789ab..6785e33821 100644 --- a/doc/src/Tools.rst +++ b/doc/src/Tools.rst @@ -502,6 +502,7 @@ regular LAMMPS commands: clear_history wipe out the current command history list pwd print current working directory cd change current working directory (same as pwd if no directory) + mem print current and maximum memory usage \| execute as a shell command and return to the command prompt exit exit the LAMMPS shell cleanly (unlike the "quit" command) diff --git a/tools/lammps-shell/README b/tools/lammps-shell/README index f72305536d..bacb28ae56 100644 --- a/tools/lammps-shell/README +++ b/tools/lammps-shell/README @@ -89,6 +89,7 @@ regular LAMMPS commands: - clear_history wipe out the current command history list - pwd print current working directory - cd change current working directory (same as pwd if no directory) +- mem print current and maximum memory usage - | execute as a shell command and return to the command prompt - exit exit the LAMMPS shell cleanly (unlike the "quit" command) diff --git a/tools/lammps-shell/lammps-shell.cpp b/tools/lammps-shell/lammps-shell.cpp index f286137e53..b5c6594930 100644 --- a/tools/lammps-shell/lammps-shell.cpp +++ b/tools/lammps-shell/lammps-shell.cpp @@ -463,6 +463,7 @@ static void init_commands() commands.push_back("exit"); commands.push_back("pwd"); commands.push_back("cd"); + commands.push_back("mem"); commands.push_back("history"); commands.push_back("clear_history"); @@ -562,6 +563,13 @@ static int shell_cmd(const std::string &cmd) lammps_command(lmp, shellcmd.c_str()); free(text); return 0; + } else if (words[0] == "mem") { + double meminfo[3]; + lammps_memory_usage(lmp,meminfo); + std::cout << "Memory usage. Current: " << meminfo[0] << " MByte, " + << "Maximum : " << meminfo[2] << " MByte\n"; + free(text); + return 0; } else if (words[0] == "history") { free(text); HIST_ENTRY **list = history_list();