mirror of
https://github.com/nasa/trick.git
synced 2025-01-31 00:24:03 +00:00
1592 send hs run stats improvement (#1604)
* Added system CPU time and initialization system CPU time and added user wording for existing CPU time to distinguish it from system CPU time used for trick run summary. * Updated the order of a couple of times of shutdown messages printed on screen and sim/cpu time ratio to both user and system cpu time. * Minor change for lining up the shutdown message.
This commit is contained in:
parent
763b52fd10
commit
9076a3e88f
@ -111,11 +111,17 @@ namespace Trick {
|
||||
/** Next software frame time in integer tics.\n */
|
||||
long long next_frame_check_tics ; /**< trick_units(--) */
|
||||
|
||||
/** Usage time at executive initialization.\n */
|
||||
double cpu_init; /**< trick_io(**) trick_units(s) */
|
||||
/** Usage time at executive initialization in user mode.\n */
|
||||
double user_cpu_init; /**< trick_io(**) trick_units(s) */
|
||||
|
||||
/** CPU usage time at cyclic sim process startup.\n */
|
||||
double cpu_start; /**< trick_io(**) trick_units(s) */
|
||||
/** Usage time at executive initialization in kernal mode.\n */
|
||||
double kernal_cpu_init; /**< trick_io(**) trick_units(s) */
|
||||
|
||||
/** CPU usage time at cyclic sim process startup in user mode.\n */
|
||||
double user_cpu_start; /**< trick_io(**) trick_units(s) */
|
||||
|
||||
/** CPU usage time at cyclic sim process startup in kernal mode.\n */
|
||||
double kernal_cpu_start; /**< trick_io(**) trick_units(s) */
|
||||
|
||||
/** Simulation control mode.\n */
|
||||
SIM_MODE mode; /**< trick_io(*o) trick_units(--) */
|
||||
|
@ -32,7 +32,7 @@ int Trick::Executive::init() {
|
||||
/* Start the cpu usage meter */
|
||||
struct rusage cpu_usage_buf ;
|
||||
getrusage(RUSAGE_SELF, &cpu_usage_buf);
|
||||
cpu_start = ((double) cpu_usage_buf.ru_utime.tv_sec) + ((double) cpu_usage_buf.ru_utime.tv_usec / 1000000.0);
|
||||
user_cpu_start = ((double) cpu_usage_buf.ru_utime.tv_sec) + ((double) cpu_usage_buf.ru_utime.tv_usec / 1000000.0);
|
||||
|
||||
/* command line args */
|
||||
process_sim_args();
|
||||
@ -55,7 +55,10 @@ int Trick::Executive::init() {
|
||||
/* Record the cpu usage for initialization */
|
||||
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);
|
||||
cpu_init = cpu_time - cpu_start;
|
||||
user_cpu_init = cpu_time - user_cpu_start;
|
||||
|
||||
cpu_time = ((double) cpu_usage_buf.ru_stime.tv_sec) + ((double) cpu_usage_buf.ru_stime.tv_usec / 1000000.0);
|
||||
kernal_cpu_init = cpu_time - kernal_cpu_start;
|
||||
|
||||
initialization_complete = true ;
|
||||
|
||||
|
@ -36,7 +36,7 @@ int Trick::Executive::shutdown() {
|
||||
|
||||
double sim_elapsed_time;
|
||||
double cpu_time;
|
||||
double actual_cpu_time;
|
||||
double user_cpu_time, kernal_cpu_time;
|
||||
double sim_to_cpu;
|
||||
unsigned int ii;
|
||||
int process_id = 0 ;
|
||||
@ -92,11 +92,16 @@ int Trick::Executive::shutdown() {
|
||||
|
||||
/* Calculate simulation elapsed sim time and actual cpu time */
|
||||
sim_elapsed_time = get_sim_time() - sim_start;
|
||||
actual_cpu_time = cpu_time - cpu_start;
|
||||
if (actual_cpu_time <= 1e-6) {
|
||||
user_cpu_time = cpu_time - user_cpu_start;
|
||||
|
||||
/* */
|
||||
cpu_time = ((double) cpu_usage_buf.ru_stime.tv_sec) + ((double) cpu_usage_buf.ru_stime.tv_usec / 1000000.0);
|
||||
kernal_cpu_time = cpu_time - kernal_cpu_start;
|
||||
|
||||
if ((user_cpu_time + kernal_cpu_time) <= 1e-6) {
|
||||
sim_to_cpu = 1e8;
|
||||
} else {
|
||||
sim_to_cpu = sim_elapsed_time / actual_cpu_time;
|
||||
sim_to_cpu = sim_elapsed_time / (user_cpu_time + kernal_cpu_time);
|
||||
}
|
||||
|
||||
/* Print a shutdown message. */
|
||||
@ -105,16 +110,20 @@ int Trick::Executive::shutdown() {
|
||||
" PROCESS: %d\n"
|
||||
" ROUTINE: %s\n"
|
||||
" DIAGNOSTIC: %s\n\n"
|
||||
" SIMULATION START TIME: %12.3f\n"
|
||||
" SIMULATION STOP TIME: %12.3f\n"
|
||||
" 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"
|
||||
" 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_mem ) ;
|
||||
" SIMULATION START TIME: %12.3f\n"
|
||||
" SIMULATION STOP TIME: %12.3f\n"
|
||||
" SIMULATION ELAPSED TIME: %12.3f\n"
|
||||
" USER CPU TIME USED: %12.3f\n"
|
||||
" SYSTEM CPU TIME USED: %12.3f\n"
|
||||
" SIMULATION / CPU TIME: %12.3f\n"
|
||||
" INITIALIZATION USER CPU TIME: %12.3f\n"
|
||||
" INITIALIZATION SYSTEM 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,
|
||||
user_cpu_time, kernal_cpu_time, sim_to_cpu,
|
||||
user_cpu_init, kernal_cpu_init, sim_mem) ;
|
||||
|
||||
/* Kill all threads. */
|
||||
for (ii = 1; ii < threads.size() ; ii++) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user