summaryrefslogtreecommitdiff
path: root/CIAO/DAnCE/NodeManager/CIAO_Monitor.h
blob: 5a1345387015b560fafe77f8d8e4ef7ad848d3a5 (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
// $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"

/**
 * @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 ();

    /**
     * This function is called by the controller to initialize
     * parameters.
     * @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.
     */
    virtual int  initialize_params (
                                    ::Deployment::Domain& domain,
                                    ::Deployment::TargetManager_ptr target_manager,
                                    int interval
                                    );
    /**
     * Destructor
     */
    virtual ~CIAO_Monitor ();

    /**
     * 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);

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

    /**
     * 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 */