25 #include <core/exceptions/system.h> 26 #include <utils/time/tracker.h> 37 :
Thread(
"TimeTrackerMainLoopThread",
Thread::OPMODE_WAITFORWAKEUP)
55 __output_interval =
config->
get_uint(
"/ttmainloop/output_interval");
57 __output_interval = 5.0;
64 __last_outp_time->
stamp();
68 __ttc_pre_loop = __tt->
add_class(
"Pre Loop");
69 __ttc_sensor_acquire = __tt->
add_class(
"Sensor Acquire");
70 __ttc_sensor_prepare = __tt->
add_class(
"Sensor Prepare");
71 __ttc_sensor_process = __tt->
add_class(
"Sensor Process");
72 __ttc_worldstate = __tt->
add_class(
"World State");
76 __ttc_post_loop = __tt->
add_class(
"Post Loop");
77 __ttc_netproc = __tt->
add_class(
"Net Proc");
78 __ttc_full_loop = __tt->
add_class(
"Full Loop");
79 __ttc_real_loop = __tt->
add_class(
"Real Loop");
83 #define TIMETRACK_START(c1, c2, c3) \ 84 __tt->ping_start(c1); \ 85 __tt->ping_start(c2); \ 88 #define TIMETRACK_INTER(c1, c2) \ 92 #define TIMETRACK_END(c) \ 107 TIMETRACK_START(__ttc_real_loop, __ttc_full_loop, __ttc_pre_loop);
111 TIMETRACK_INTER(__ttc_pre_loop, __ttc_sensor_acquire)
115 TIMETRACK_INTER(__ttc_sensor_acquire, __ttc_sensor_prepare)
119 TIMETRACK_INTER(__ttc_sensor_prepare, __ttc_sensor_process)
123 TIMETRACK_INTER(__ttc_sensor_process, __ttc_worldstate)
127 TIMETRACK_INTER(__ttc_worldstate, __ttc_think)
131 TIMETRACK_INTER(__ttc_think, __ttc_skill)
135 TIMETRACK_INTER(__ttc_skill, __ttc_act)
140 TIMETRACK_INTER(__ttc_act, __ttc_post_loop)
144 TIMETRACK_INTER(__ttc_post_loop, __ttc_netproc)
146 TIMETRACK_END(__ttc_netproc);
147 TIMETRACK_END(__ttc_real_loop);
154 if ( (*__now - __last_outp_time) >= __output_interval ) {
158 *__last_outp_time = *__now;
BlockedTimingExecutor * blocked_timing_executor
This is a blocked timing executor instance which can be used to run threads with the BlockedTimingAsp...
virtual void wakeup_and_wait(BlockedTimingAspect::WakeupHook hook, unsigned int timeout_usec=0)=0
Wakeup thread for given hook and wait for completion.
virtual void log_info(const char *component, const char *format,...)=0
Log informational message.
TimeTrackerMainLoopThread()
Constructor.
Fawkes library namespace.
virtual void loop()
Code to execute in the thread.
virtual void finalize()
Finalize the thread.
A class for handling time.
void print_to_file()
Print data to file suitable for gnuplot.
thread cannot be cancelled
virtual ~TimeTrackerMainLoopThread()
Destructor.
Thread class encapsulation of pthreads.
static void set_cancel_state(CancelState new_state, CancelState *old_state=0)
Set the cancel state of the current thread.
Logger * logger
This is the Logger member used to access the logger.
Clock * clock
By means of this member access to the clock is given.
Base class for exceptions in Fawkes.
unsigned int add_class(std::string name)
Add a new class.
const char * name() const
Get name of thread.
void reset(std::string comment="")
Reset times.
void print_to_stdout()
Print results to stdout.
void test_cancel()
Set cancellation point.
Time & stamp()
Set this time to the current time.
virtual void init()
Initialize the thread.
virtual unsigned int get_uint(const char *path)=0
Get value from configuration which is of type unsigned int.
Configuration * config
This is the Configuration member used to access the configuration.