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 <core/threading/thread.h>
27 #include <aspect/clock.h>
28 #include <aspect/logging.h>
29 #include <aspect/configurable.h>
30 #include <aspect/blocked_timing.h>
31 #include <aspect/mainloop.h>
32 
33 namespace fawkes {
34  class Time;
35  class TimeTracker;
36 }
37 
39 : public fawkes::Thread,
40  public fawkes::LoggingAspect,
41  public fawkes::ClockAspect,
44 {
45  public:
47  virtual ~TimeTrackerMainLoopThread();
48 
49  virtual void init();
50  virtual void loop();
51  virtual void finalize();
52 
53  /** Stub to see name in backtrace for easier debugging. @see Thread::run() */
54  protected: virtual void run() { Thread::run(); }
55 
56  private:
57  float __output_interval;
58  fawkes::Time *__last_outp_time;
59  fawkes::Time *__now;
60 
61  fawkes::Time *__loop_start;
62  fawkes::Time *__loop_end;
63 
64  fawkes::TimeTracker *__tt;
65  unsigned int __tt_loopcount;
66  unsigned int __ttc_pre_loop;
67  unsigned int __ttc_sensor_acquire;
68  unsigned int __ttc_sensor_prepare;
69  unsigned int __ttc_sensor_process;
70  unsigned int __ttc_worldstate;
71  unsigned int __ttc_think;
72  unsigned int __ttc_skill;
73  unsigned int __ttc_act;
74  unsigned int __ttc_post_loop;
75  unsigned int __ttc_netproc;
76  unsigned int __ttc_full_loop;
77  unsigned int __ttc_real_loop;
78 
79 };
80 
81 
82 #endif
Thread aspect that allows to obtain the current time from the clock.
Definition: clock.h:36
Thread aspect that allows to replace the main loop of the main application of Fawkes.
Definition: mainloop.h:37
Fawkes library namespace.
virtual void run()
Code to execute in the thread.
Definition: thread.cpp:939
A class for handling time.
Definition: time.h:91
Thread class encapsulation of pthreads.
Definition: thread.h:42
virtual void run()
Stub to see name in backtrace for easier debugging.
Definition: thread.h:54
Time tracking utility.
Definition: tracker.h:38
Thread aspect to log output.
Definition: logging.h:35
Thread aspect to access configuration data.
Definition: configurable.h:35
Main thread of time tracker main loop plugin.
Definition: thread.h:38