mirror of
https://github.com/nasa/trick.git
synced 2024-12-20 05:37:55 +00:00
Log frame scheduling time if not running real-time. #762
If real-time is off, we exit the rt_monitor function early. The frame scheduled time was calculated after the exit call. Moved the frame scheduled time calcuation before the exit.
This commit is contained in:
parent
0ec37858d0
commit
e6abfd21b8
@ -228,9 +228,6 @@ int Trick::RealtimeSync::start_realtime(double in_frame_time , long long ref_tim
|
|||||||
/* Reset the clock reference time to the desired reference time */
|
/* Reset the clock reference time to the desired reference time */
|
||||||
rt_clock->clock_reset(ref_time) ;
|
rt_clock->clock_reset(ref_time) ;
|
||||||
|
|
||||||
/* Set top of frame time for 1st frame (used in frame logging). */
|
|
||||||
last_clock_time = rt_clock->clock_time() ;
|
|
||||||
|
|
||||||
/* Start the sleep timer hardware */
|
/* Start the sleep timer hardware */
|
||||||
start_sleep_timer();
|
start_sleep_timer();
|
||||||
|
|
||||||
@ -247,6 +244,9 @@ int Trick::RealtimeSync::start_realtime(double in_frame_time , long long ref_tim
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Set top of frame time for 1st frame (used in frame logging). */
|
||||||
|
last_clock_time = rt_clock->clock_time() ;
|
||||||
|
|
||||||
return(0) ;
|
return(0) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -283,6 +283,12 @@ int Trick::RealtimeSync::rt_monitor(long long sim_time_tics) {
|
|||||||
long long curr_clock_time ;
|
long long curr_clock_time ;
|
||||||
char buf[512];
|
char buf[512];
|
||||||
|
|
||||||
|
/* calculate the current underrun/overrun */
|
||||||
|
curr_clock_time = rt_clock->clock_time() ;
|
||||||
|
frame_sched_time = curr_clock_time - last_clock_time ;
|
||||||
|
/* Set the next frame overrun/underrun reference time to the current time */
|
||||||
|
last_clock_time = curr_clock_time ;
|
||||||
|
|
||||||
/* determine if the state of real-time has changed this frame */
|
/* determine if the state of real-time has changed this frame */
|
||||||
if ( ! active ) {
|
if ( ! active ) {
|
||||||
if ( enable_flag ) {
|
if ( enable_flag ) {
|
||||||
@ -303,10 +309,6 @@ int Trick::RealtimeSync::rt_monitor(long long sim_time_tics) {
|
|||||||
disable_flag = false ;
|
disable_flag = false ;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* calculate the current underrun/overrun */
|
|
||||||
curr_clock_time = rt_clock->clock_time() ;
|
|
||||||
frame_overrun_time = 0 ;
|
|
||||||
frame_sched_time = curr_clock_time - last_clock_time ;
|
|
||||||
frame_overrun_time = curr_clock_time - sim_time_tics ;
|
frame_overrun_time = curr_clock_time - sim_time_tics ;
|
||||||
|
|
||||||
/* If the wall clock time is greater than the sim time an overrun occurred. */
|
/* If the wall clock time is greater than the sim time an overrun occurred. */
|
||||||
@ -363,9 +365,6 @@ int Trick::RealtimeSync::rt_monitor(long long sim_time_tics) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set the next frame overrun/underrun reference time to the current time */
|
|
||||||
last_clock_time = curr_clock_time ;
|
|
||||||
|
|
||||||
return(0) ;
|
return(0) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -456,14 +455,14 @@ int Trick::RealtimeSync::unfreeze(long long sim_time_tics, double software_frame
|
|||||||
/* Adjust the real-time clock reference by the amount of time we were frozen */
|
/* Adjust the real-time clock reference by the amount of time we were frozen */
|
||||||
rt_clock->adjust_ref_time(freeze_time_tics - sim_time_tics) ;
|
rt_clock->adjust_ref_time(freeze_time_tics - sim_time_tics) ;
|
||||||
|
|
||||||
/* Set top of frame time for 1st frame (used in frame logging). */
|
|
||||||
last_clock_time = rt_clock->clock_time() ;
|
|
||||||
|
|
||||||
/* Start the sleep timer with the software frame expiration */
|
/* Start the sleep timer with the software frame expiration */
|
||||||
sleep_timer->start(software_frame_sec / rt_clock->get_rt_clock_ratio()) ;
|
sleep_timer->start(software_frame_sec / rt_clock->get_rt_clock_ratio()) ;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Set top of frame time for 1st frame (used in frame logging). */
|
||||||
|
last_clock_time = rt_clock->clock_time() ;
|
||||||
|
|
||||||
return(0) ;
|
return(0) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user