summaryrefslogtreecommitdiff
path: root/CIAO/DAnCE/NodeManager/CIAO_Monitor.h
blob: e317288b02a0e7f757d1ab328f3fe1341508c0c9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
// $Id$
//==========================================================================
/**
 * @file CIAO_Monitor.h
 *
 * @brief The Monitor class.
 *
 * This class periodically records the loadavg value of the machine in which it
 * loaded
 *
 * @author Nilabja Roy <nilabjar@dre.vanderbilt.edu>
 */
//==========================================================================


#ifndef CIAO_MONITORH
#define CIAO_MONITORH

#include "BaseMonitor.h"
#include "ace/Auto_Ptr.h"
#include <memory>

/**
 * @namespace CIAO
 *
 * @brief The top level CIAO namespace
 *
 */
namespace CIAO
{
  class ReceiverThread;

  /**
   * @class CIAO_Monitor
   *
   * @brief The Monitor class
   *
   */
  class CIAO_Monitor : public MonitorBase
  {
  public:

    /** @function Constructor
     */
    CIAO_Monitor ();

    /** @function initialize_params
     *  @param domain The Initial Domain for this host
     *  @param   target_manager TargetManager_ptr
     *  @param   interval The time interval after whic updates need to be send.
     *  @description This function is called by the controller to initialize
     *               parameters.
     */
    virtual int  initialize_params (
                                    ::Deployment::Domain& domain,
                                    ::Deployment::TargetManager_ptr target_manager,
                                    int interval
                                    );
    /**
     * @function Destructor
     */
    virtual ~CIAO_Monitor ();

    /** @function start.
     *  @brief This method will starts up the Monitor
     *  in this case,
     *  @param orb The orb needed for resolving.
     *  @return -1 on error
     */
    int start (CORBA::ORB_ptr orb);

    /**
     * @function stop.
     * @brief This method will starts up the Monitor
     *  in this case
     * @return -1 on error
     */
    int stop ();

    /**
     * @function get_current_date.
     * @brief This function retrieves the current
     * Domain data
     * @return -1 on error
     */
    ::Deployment::Domain* get_current_data ();

  protected:

    /// The TargetManager Object to be sent to the RSSSubscriber ..
    ::Deployment::TargetManager_ptr target_ptr_;

    /// The interval after which update is to be returned.
    int interval_;

    /// The Domain data structure
    auto_ptr <Deployment::Domain> current_domain_;

    /// The previous user cpu
    long prev_user_cpu_;

    /// The previous user cpu low priority
    long prev_user_cpu_low_;

    /// The previous system cpu
    long prev_sys_cpu_;

    /// The previous idle time
    long prev_idle_time_;
  };

} // CIAO
#endif /* CIAO_MONITORH */