diff --git a/trick_source/java/src/main/java/trick/simcontrol/SimControlApplication.java b/trick_source/java/src/main/java/trick/simcontrol/SimControlApplication.java index ac436568..f56f4c7a 100644 --- a/trick_source/java/src/main/java/trick/simcontrol/SimControlApplication.java +++ b/trick_source/java/src/main/java/trick/simcontrol/SimControlApplication.java @@ -1572,7 +1572,6 @@ public class SimControlApplication extends TrickApplication implements PropertyC @Override protected void finished() { try { - System.out.println("Finished with health status socket channel"); if (healthStatusSocketChannel != null) { healthStatusSocketChannel.close() ; } diff --git a/trick_source/sim_services/Executive/Executive_shutdown.cpp b/trick_source/sim_services/Executive/Executive_shutdown.cpp index 0d6dbdc9..695c6539 100644 --- a/trick_source/sim_services/Executive/Executive_shutdown.cpp +++ b/trick_source/sim_services/Executive/Executive_shutdown.cpp @@ -10,6 +10,7 @@ #include #include #include +#include #include #include "trick/Executive.hh" @@ -40,7 +41,8 @@ int Trick::Executive::shutdown() { unsigned int ii; int process_id = 0 ; struct rusage cpu_usage_buf ; - + double sim_mem; + SIM_MODE prev_mode = mode ; /* Set mode to ExitMode. */ @@ -80,6 +82,13 @@ int Trick::Executive::shutdown() { getrusage(RUSAGE_SELF, &cpu_usage_buf); cpu_time = ((double) cpu_usage_buf.ru_utime.tv_sec) + ((double) cpu_usage_buf.ru_utime.tv_usec / 1000000.0); + + /* Get memory usage in MB for the calling process. Note that ru_maxrss returns long value in bytes on Mac and kilobytes on Linux. */ + #if __APPLE__ + sim_mem = (double)cpu_usage_buf.ru_maxrss / (1024 * 1024); + #else + sim_mem = (double)cpu_usage_buf.ru_maxrss / 1024; + #endif /* Calculate simulation elapsed sim time and actual cpu time */ sim_elapsed_time = get_sim_time() - sim_start; @@ -101,9 +110,11 @@ int Trick::Executive::shutdown() { " SIMULATION ELAPSED TIME: %12.3f\n" " ACTUAL CPU TIME USED: %12.3f\n" " SIMULATION / CPU TIME: %12.3f\n" - " INITIALIZATION CPU TIME: %12.3f\n" , + " INITIALIZATION CPU TIME: %12.3f\n" + " SIMULATION RAM USAGE: %12.3fMB\n" + " (External program RAM usage not included!)\n", process_id, except_file.c_str(), except_message.c_str() , - sim_start , get_sim_time() , sim_elapsed_time , actual_cpu_time , sim_to_cpu , cpu_init ) ; + sim_start , get_sim_time() , sim_elapsed_time , actual_cpu_time , sim_to_cpu , cpu_init, sim_mem ) ; /* Kill all threads. */ for (ii = 1; ii < threads.size() ; ii++) {