Fawkes API  Fawkes Development Version
thread.h
1 
2 /***************************************************************************
3  * wm_thread.h - Fawkes TimeTrackerMainLoop Plugin Thread
4  *
5  * Created: Fri Jun 29 11:54:58 2007 (on flight to RoboCup 2007, Atlanta)
6  * Copyright 2006-2007 Tim Niemueller [www.niemueller.de]
7  *
8  ****************************************************************************/
9 
10 /* This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU Library General Public License for more details.
19  *
20  * Read the full text in the LICENSE.GPL file in the doc directory.
21  */
22 
23 #ifndef _PLUGINS_TTMAINLOOP_THREAD_H_
24 #define _PLUGINS_TTMAINLOOP_THREAD_H_
25 
26 #include <aspect/blocked_timing.h>
27 #include <aspect/clock.h>
28 #include <aspect/configurable.h>
29 #include <aspect/logging.h>
30 #include <aspect/mainloop.h>
31 #include <core/threading/thread.h>
32 
33 namespace fawkes {
34 class Time;
35 class TimeTracker;
36 } // namespace fawkes
37 
39  public fawkes::LoggingAspect,
40  public fawkes::ClockAspect,
43 {
44 public:
47 
48  virtual void init();
49  virtual void loop();
50  virtual void finalize();
51 
52  /** Stub to see name in backtrace for easier debugging. @see Thread::run() */
53 protected:
54  virtual void
55  run()
56  {
57  Thread::run();
58  }
59 
60 private:
61  float output_interval_;
62  fawkes::Time *last_outp_time_;
63  fawkes::Time *now_;
64 
65  fawkes::Time *loop_start_;
66  fawkes::Time *loop_end_;
67 
69  unsigned int tt_loopcount_;
70  unsigned int ttc_pre_loop_;
71  unsigned int ttc_sensor_acquire_;
72  unsigned int ttc_sensor_prepare_;
73  unsigned int ttc_sensor_process_;
74  unsigned int ttc_worldstate_;
75  unsigned int ttc_think_;
76  unsigned int ttc_skill_;
77  unsigned int ttc_act_;
78  unsigned int ttc_post_loop_;
79  unsigned int ttc_netproc_;
80  unsigned int ttc_full_loop_;
81  unsigned int ttc_real_loop_;
82 };
83 
84 #endif
Thread aspect that allows to obtain the current time from the clock.
Definition: clock.h:33
Thread aspect that allows to replace the main loop of the main application of Fawkes.
Definition: mainloop.h:34
TimeTrackerMainLoopThread()
Constructor.
Definition: thread.cpp:36
Fawkes library namespace.
virtual void loop()
Code to execute in the thread.
Definition: thread.cpp:101
virtual void finalize()
Finalize the thread.
Definition: thread.cpp:91
A class for handling time.
Definition: time.h:92
virtual ~TimeTrackerMainLoopThread()
Destructor.
Definition: thread.cpp:42
Thread class encapsulation of pthreads.
Definition: thread.h:45
virtual void run()
Stub to see name in backtrace for easier debugging.
Definition: thread.h:55
Time tracking utility.
Definition: tracker.h:36
Thread aspect to log output.
Definition: logging.h:32
Thread aspect to access configuration data.
Definition: configurable.h:32
Main thread of time tracker main loop plugin.
Definition: thread.h:38
virtual void init()
Initialize the thread.
Definition: thread.cpp:47