Fawkes API  Fawkes Development Version
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
rrd_thread.h
1 
2 /***************************************************************************
3  * rrd_thread.h - RRD thread
4  *
5  * Created: Fri Dec 17 00:32:48 2010
6  * Copyright 2006-2010 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_RRD_RRD_THREAD_H_
24 #define __PLUGINS_RRD_RRD_THREAD_H_
25 
26 #include <plugins/rrd/aspect/rrd_manager.h>
27 #include <plugins/rrd/aspect/rrd_inifin.h>
28 #include <core/threading/thread.h>
29 #include <core/utils/rwlock_vector.h>
30 #include <aspect/logging.h>
31 #include <aspect/configurable.h>
32 #include <aspect/clock.h>
33 #include <aspect/aspect_provider.h>
34 #include <utils/time/wait.h>
35 
36 class RRDThread
37 : public fawkes::Thread,
38  public fawkes::LoggingAspect,
40  public fawkes::ClockAspect,
42  public fawkes::RRDManager
43 {
44  public:
45  RRDThread();
46  virtual ~RRDThread();
47 
48  virtual void init();
49  virtual void loop();
50  virtual void finalize();
51 
52  // for RRDManager
53  virtual void add_rrd(fawkes::RRDDefinition *rrd_def);
54  virtual void remove_rrd(fawkes::RRDDefinition *rrd_def);
55  virtual void add_graph(fawkes::RRDGraphDefinition *rrd_graph_def);
56 
57  virtual void add_data(const char *rrd_name, const char *format, ...);
58 
61  get_graphs() const;
62 
63  void generate_graphs();
64 
65  /** Stub to see name in backtrace for easier debugging. @see Thread::run() */
66  protected: virtual void run() { Thread::run(); }
67 
68  private:
69  fawkes::RRDAspectIniFin __rrd_aspect_inifin;
70 
73 
74  fawkes::TimeWait *__time_wait;
75  float __cfg_graph_interval;
76  unsigned int __loop_count;
77 };
78 
79 #endif