3 //=============================================================================
5 * @file CPU_Load_Monitor.h
7 * @author Jeff Parsons <j.parsons@vanderbilt.edu>
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)
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"
28 #include "ace/Monitor_Control/Monitor_Control_export.h"
30 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
34 namespace Monitor_Control
37 * @class CPU_Load_Monitor
39 * @brief Monitors percentage CPU utilization.
41 class MONITOR_CONTROL_Export CPU_Load_Monitor
43 #if defined (ACE_HAS_WIN32_PDH)
44 , public Windows_Monitor
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 ();
57 /// Overridden reset, calls platform-specific reset.
58 virtual void clear_i ();
60 /// Common code to the constructor and to clear_i().
64 #if defined (ACE_LINUX)
65 void access_proc_stat (unsigned long *which_idle
);
69 static const char* default_name_
;
71 /// Linux implementation
72 #if defined (ACE_LINUX)
75 unsigned long kernel_
;
77 unsigned long prev_idle_
;
80 #if defined (ACE_LINUX)
88 ACE_END_VERSIONED_NAMESPACE_DECL
90 #endif /* ACE_HAS_MONITOR_FRAMEWORK==1 */
92 #include /**/ "ace/post.h"
94 #endif // CPU_LOAD_MONITOR_H