summaryrefslogtreecommitdiff
path: root/TAO/orbsvcs/orbsvcs/LWFT/Utilization_Monitor.h
blob: ae112f56f92009cb1436602bdba79c0eb7b97c04 (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
// -*- C++ -*-
// $Id$

#ifndef UTILIZATION_MONITOR_H
#define UTILIZATION_MONITOR_H

#include <fstream>

#include "Timer.h"

#if !defined (ACE_LACKS_PRAGMA_ONCE)
#pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */

#include "Monitor_Manager.h"
#include "host_monitor_export.h"

#if defined (ACE_HAS_MONITOR_FRAMEWORK) && (ACE_HAS_MONITOR_FRAMEWORK == 1)

using namespace ACE_VERSIONED_NAMESPACE_NAME::ACE::Monitor_Control;

#endif /* ACE_HAS_MONITOR_FRAMEWORK==1 */

class RM_Proxy;

class HostMonitor_Export Utilization_Monitor : protected Timer
{
public:
  using Timer::start;
  using Timer::stop;
  using Timer::hertz;

  Utilization_Monitor (void);
  virtual ~Utilization_Monitor (void);

  /// Helper function to be called back after a timeout.
  virtual int pulse (void);
  virtual double percent_load (void);
  void set_RM_Proxy (RM_Proxy *rm_proxy);

private:
  Monitor_Manager load_calc_;
  RM_Proxy *rm_proxy_;
  double load_;
  std::ofstream outfile_;
};

#endif /* UTILIZATION_MONITOR_H */