implement "mem" command into LAMMPS shell to print current and max memory use
This commit is contained in:
@ -502,6 +502,7 @@ regular LAMMPS commands:
|
|||||||
clear_history wipe out the current command history list
|
clear_history wipe out the current command history list
|
||||||
pwd print current working directory
|
pwd print current working directory
|
||||||
cd <directory> change current working directory (same as pwd if no directory)
|
cd <directory> change current working directory (same as pwd if no directory)
|
||||||
|
mem print current and maximum memory usage
|
||||||
\|<command> execute <command> as a shell command and return to the command prompt
|
\|<command> execute <command> as a shell command and return to the command prompt
|
||||||
exit exit the LAMMPS shell cleanly (unlike the "quit" command)
|
exit exit the LAMMPS shell cleanly (unlike the "quit" command)
|
||||||
|
|
||||||
|
|||||||
@ -89,6 +89,7 @@ regular LAMMPS commands:
|
|||||||
- clear_history wipe out the current command history list
|
- clear_history wipe out the current command history list
|
||||||
- pwd print current working directory
|
- pwd print current working directory
|
||||||
- cd <directory> change current working directory (same as pwd if no directory)
|
- cd <directory> change current working directory (same as pwd if no directory)
|
||||||
|
- mem print current and maximum memory usage
|
||||||
- |<command> execute <command> as a shell command and return to the command prompt
|
- |<command> execute <command> as a shell command and return to the command prompt
|
||||||
- exit exit the LAMMPS shell cleanly (unlike the "quit" command)
|
- exit exit the LAMMPS shell cleanly (unlike the "quit" command)
|
||||||
|
|
||||||
|
|||||||
@ -463,6 +463,7 @@ static void init_commands()
|
|||||||
commands.push_back("exit");
|
commands.push_back("exit");
|
||||||
commands.push_back("pwd");
|
commands.push_back("pwd");
|
||||||
commands.push_back("cd");
|
commands.push_back("cd");
|
||||||
|
commands.push_back("mem");
|
||||||
commands.push_back("history");
|
commands.push_back("history");
|
||||||
commands.push_back("clear_history");
|
commands.push_back("clear_history");
|
||||||
|
|
||||||
@ -562,6 +563,13 @@ static int shell_cmd(const std::string &cmd)
|
|||||||
lammps_command(lmp, shellcmd.c_str());
|
lammps_command(lmp, shellcmd.c_str());
|
||||||
free(text);
|
free(text);
|
||||||
return 0;
|
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") {
|
} else if (words[0] == "history") {
|
||||||
free(text);
|
free(text);
|
||||||
HIST_ENTRY **list = history_list();
|
HIST_ENTRY **list = history_list();
|
||||||
|
|||||||
Reference in New Issue
Block a user