25 #include <core/exceptions/system.h>
26 #include <utils/time/tracker.h>
37 :
Thread(
"TimeTrackerMainLoopThread",
Thread::OPMODE_WAITFORWAKEUP)
53 output_interval_ =
config->
get_uint(
"/ttmainloop/output_interval");
55 output_interval_ = 5.0;
61 last_outp_time_->
stamp();
65 ttc_pre_loop_ = tt_->
add_class(
"Pre Loop");
66 ttc_sensor_acquire_ = tt_->
add_class(
"Sensor Acquire");
67 ttc_sensor_prepare_ = tt_->
add_class(
"Sensor Prepare");
68 ttc_sensor_process_ = tt_->
add_class(
"Sensor Process");
69 ttc_worldstate_ = tt_->
add_class(
"World State");
73 ttc_post_loop_ = tt_->
add_class(
"Post Loop");
74 ttc_netproc_ = tt_->
add_class(
"Net Proc");
75 ttc_full_loop_ = tt_->
add_class(
"Full Loop");
76 ttc_real_loop_ = tt_->
add_class(
"Real Loop");
79 #define TIMETRACK_START(c1, c2, c3) \
80 tt_->ping_start(c1); \
81 tt_->ping_start(c2); \
84 #define TIMETRACK_INTER(c1, c2) \
88 #define TIMETRACK_END(c) tt_->ping_end(c);
95 delete last_outp_time_;
106 TIMETRACK_START(ttc_real_loop_, ttc_full_loop_, ttc_pre_loop_);
110 TIMETRACK_INTER(ttc_pre_loop_, ttc_sensor_acquire_)
114 TIMETRACK_INTER(ttc_sensor_acquire_, ttc_sensor_prepare_)
118 TIMETRACK_INTER(ttc_sensor_prepare_, ttc_sensor_process_)
122 TIMETRACK_INTER(ttc_sensor_process_, ttc_worldstate_)
126 TIMETRACK_INTER(ttc_worldstate_, ttc_think_)
130 TIMETRACK_INTER(ttc_think_, ttc_skill_)
134 TIMETRACK_INTER(ttc_skill_, ttc_act_)
139 TIMETRACK_INTER(ttc_act_, ttc_post_loop_)
143 TIMETRACK_INTER(ttc_post_loop_, ttc_netproc_)
145 TIMETRACK_END(ttc_netproc_);
146 TIMETRACK_END(ttc_real_loop_);
153 if ((*now_ - last_outp_time_) >= output_interval_) {
157 *last_outp_time_ = *now_;
virtual void finalize()
Finalize the thread.
TimeTrackerMainLoopThread()
Constructor.
virtual void loop()
Code to execute in the thread.
virtual void init()
Initialize the thread.
virtual ~TimeTrackerMainLoopThread()
Destructor.
virtual void wakeup_and_wait(BlockedTimingAspect::WakeupHook hook, unsigned int timeout_usec=0)=0
Wakeup thread for given hook and wait for completion.
Clock * clock
By means of this member access to the clock is given.
Configuration * config
This is the Configuration member used to access the configuration.
virtual unsigned int get_uint(const char *path)=0
Get value from configuration which is of type unsigned int.
Base class for exceptions in Fawkes.
virtual void log_info(const char *component, const char *format,...)=0
Log informational message.
Logger * logger
This is the Logger member used to access the logger.
BlockedTimingExecutor * blocked_timing_executor
This is a blocked timing executor instance which can be used to run threads with the BlockedTimingAsp...
Thread class encapsulation of pthreads.
const char * name() const
Get name of thread.
@ CANCEL_DISABLED
thread cannot be cancelled
static void set_cancel_state(CancelState new_state, CancelState *old_state=0)
Set the cancel state of the current thread.
void test_cancel()
Set cancellation point.
void print_to_stdout()
Print results to stdout.
void print_to_file()
Print data to file suitable for gnuplot.
unsigned int add_class(std::string name)
Add a new class.
void reset(std::string comment="")
Reset times.
A class for handling time.
Time & stamp()
Set this time to the current time.
Fawkes library namespace.