Changes to attempt to silence bcc64x
[ACE_TAO.git] / ACE / ace / Monitor_Control / CPU_Load_Monitor.h
blobf286478039b2d57e858a86b26c4efe1d66c80c0f
1 // -*- C++ -*-
3 //=============================================================================
4 /**
5 * @file CPU_Load_Monitor.h
7 * @author Jeff Parsons <j.parsons@vanderbilt.edu>
8 */
9 //=============================================================================
11 #ifndef CPU_LOAD_MONITOR_H
12 #define CPU_LOAD_MONITOR_H
14 #include /**/ "ace/pre.h"
16 #include "ace/Monitor_Base.h"
18 #if !defined (ACE_LACKS_PRAGMA_ONCE)
19 #pragma once
20 #endif /* ACE_LACKS_PRAGMA_ONCE */
22 #if defined (ACE_HAS_MONITOR_FRAMEWORK) && (ACE_HAS_MONITOR_FRAMEWORK == 1)
24 #if defined (ACE_HAS_PDH_H) && !defined (ACE_LACKS_PDH_H)
25 #include "ace/Monitor_Control/Windows_Monitor.h"
26 #endif
28 #include "ace/Monitor_Control/Monitor_Control_export.h"
30 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
32 namespace ACE
34 namespace Monitor_Control
36 /**
37 * @class CPU_Load_Monitor
39 * @brief Monitors percentage CPU utilization.
41 class MONITOR_CONTROL_Export CPU_Load_Monitor
42 : public Monitor_Base
43 #if defined (ACE_HAS_WIN32_PDH)
44 , public Windows_Monitor
45 #endif
47 public:
48 CPU_Load_Monitor (const char* name);
50 /// Implementation of the pure virtual method.
51 virtual void update ();
53 /// Stores the default name, used if none is supplied by the user.
54 static const char* default_name ();
56 private:
57 /// Overridden reset, calls platform-specific reset.
58 virtual void clear_i ();
60 /// Common code to the constructor and to clear_i().
61 void init ();
63 private:
64 #if defined (ACE_LINUX)
65 void access_proc_stat (unsigned long *which_idle);
66 #endif
68 private:
69 static const char* default_name_;
71 /// Linux implementation
72 #if defined (ACE_LINUX)
73 unsigned long user_;
74 unsigned long wait_;
75 unsigned long kernel_;
76 unsigned long idle_;
77 unsigned long prev_idle_;
78 double prev_total_;
79 #endif
80 #if defined (ACE_LINUX)
81 FILE *file_ptr_;
82 char buf_[1024];
83 #endif
88 ACE_END_VERSIONED_NAMESPACE_DECL
90 #endif /* ACE_HAS_MONITOR_FRAMEWORK==1 */
92 #include /**/ "ace/post.h"
94 #endif // CPU_LOAD_MONITOR_H