mirror of
https://github.com/nasa/trick.git
synced 2024-12-18 20:57:55 +00:00
Allow the FrameLog class to use a different clock #571
Added a clock reference that to the FrameLog class that defaults to the GetTimeOfDay clock. This clock has fast access and is non intrusive to real-time operations using a different clock. Added a function to set the clock to something else if desired.
This commit is contained in:
parent
aee322927d
commit
d97f482219
1
.gitignore
vendored
1
.gitignore
vendored
@ -21,6 +21,7 @@ bin/trick-fxplot
|
||||
bin/trick-gxplot
|
||||
bin/trick-trk2ascii
|
||||
bin/trick-trk2csv
|
||||
bin/trick-trkConvert
|
||||
aclocal.m4
|
||||
autom4te.cache
|
||||
trick_test
|
||||
|
@ -13,6 +13,7 @@ PROGRAMMERS:
|
||||
#include "trick/FrameDataRecordGroup.hh"
|
||||
#include "trick/attributes.h"
|
||||
#include "trick/JobData.hh"
|
||||
#include "trick/Clock.hh"
|
||||
|
||||
namespace Trick {
|
||||
|
||||
@ -77,10 +78,12 @@ namespace Trick {
|
||||
/** Save the name of the trick master/slave sim object.\n */
|
||||
std::string ms_sim_object_name; /**< trick_io(**) */
|
||||
|
||||
Trick::Clock & clock ; /**< trick_io(**) */
|
||||
|
||||
/**
|
||||
@brief Constructor.
|
||||
*/
|
||||
FrameLog() ;
|
||||
FrameLog(Trick::Clock & in_clock) ;
|
||||
|
||||
/**
|
||||
@brief Destructor.
|
||||
@ -152,6 +155,8 @@ namespace Trick {
|
||||
*/
|
||||
int shutdown() ;
|
||||
|
||||
void set_clock(Trick::Clock & in_clock) ;
|
||||
|
||||
private:
|
||||
std::vector<std::string> trick_jobs; // ** vector containing all trick job names
|
||||
std::vector<std::string> user_jobs; // ** vector containing all user job names
|
||||
@ -188,6 +193,9 @@ namespace Trick {
|
||||
*/
|
||||
int create_DP_timeline_files();
|
||||
|
||||
// This object is not copyable
|
||||
void operator =(const FrameLog &) {};
|
||||
|
||||
} ;
|
||||
|
||||
} ;
|
||||
|
@ -588,7 +588,7 @@ class FrameLogSimObject : public Trick::SimObject {
|
||||
|
||||
Trick::FrameLog frame_log ;
|
||||
|
||||
FrameLogSimObject() {
|
||||
FrameLogSimObject(Trick::Clock &in_clock) : frame_log(in_clock) {
|
||||
// Frame log Instrumentation class jobs. Not scheduled by default
|
||||
{TRK} P0 ("instrumentation") frame_log.frame_clock_start(curr_job) ;
|
||||
{TRK} P65535 ("instrumentation") frame_log.frame_clock_stop(curr_job) ;
|
||||
@ -606,9 +606,13 @@ class FrameLogSimObject : public Trick::SimObject {
|
||||
// the frame_log and rt_sync shutdown jobs should be last in sim
|
||||
{TRK} P65535 ("shutdown") frame_log.shutdown() ;
|
||||
}
|
||||
|
||||
private:
|
||||
// This object is not copyable
|
||||
void operator =(const FrameLogSimObject &) {};
|
||||
}
|
||||
|
||||
FrameLogSimObject trick_frame_log ;
|
||||
FrameLogSimObject trick_frame_log(trick_real_time.gtod_clock) ;
|
||||
#endif
|
||||
|
||||
#ifndef TRICK_NO_MASTERSLAVE
|
||||
|
@ -11,7 +11,6 @@
|
||||
#include "trick/FrameDataRecordGroup.hh"
|
||||
#include "trick/exec_proto.hh"
|
||||
#include "trick/exec_proto.h"
|
||||
#include "trick/clock_proto.h"
|
||||
#include "trick/data_record_proto.h"
|
||||
#include "trick/command_line_protos.h"
|
||||
#include "trick/message_proto.h"
|
||||
@ -20,7 +19,7 @@
|
||||
Trick::FrameLog * the_fl = NULL ;
|
||||
|
||||
//Constructor.
|
||||
Trick::FrameLog::FrameLog() {
|
||||
Trick::FrameLog::FrameLog(Trick::Clock & in_clock) : clock(in_clock) {
|
||||
frame_log_flag = false ;
|
||||
drg_trick = NULL ;
|
||||
drg_frame = NULL ;
|
||||
@ -342,7 +341,7 @@ int Trick::FrameLog::frame_clock_start(Trick::JobData * curr_job ) {
|
||||
/** @par Detailed Design: */
|
||||
if ( target_job != NULL ) {
|
||||
/** @li Set target job's start time. */
|
||||
target_job->rt_start_time = clock_time() ;
|
||||
target_job->rt_start_time = clock.clock_time() ;
|
||||
}
|
||||
|
||||
return(0) ;
|
||||
@ -359,7 +358,7 @@ int Trick::FrameLog::frame_clock_stop(Trick::JobData * curr_job) {
|
||||
if ( target_job != NULL ) {
|
||||
if ( target_job->rt_start_time >= 0 ) {
|
||||
/** @li Set current job's stop time and frame time. */
|
||||
target_job->rt_stop_time = clock_time() ;
|
||||
target_job->rt_stop_time = clock.clock_time() ;
|
||||
target_job->frame_time += (target_job->rt_stop_time - target_job->rt_start_time);
|
||||
thread = target_job->thread;
|
||||
|
||||
@ -678,6 +677,11 @@ int Trick::FrameLog::shutdown() {
|
||||
return(0) ;
|
||||
|
||||
}
|
||||
|
||||
void Trick::FrameLog::set_clock(Trick::Clock & in_clock) {
|
||||
clock = in_clock ;
|
||||
}
|
||||
|
||||
//Call all the Create routines for the DP directory and all DP files.
|
||||
int Trick::FrameLog::create_DP_files() {
|
||||
int ret=0;
|
||||
|
Loading…
Reference in New Issue
Block a user