3 //=============================================================================
5 * @file Monitor_Control_utils.h
7 * @author Jeff Parsons <j.parsons@vanderbilt.edu>
9 //=============================================================================
11 #ifndef MONITOR_CONTROL_UTILS_H
12 #define MONITOR_CONTROL_UTILS_H
14 #include /**/ "ace/pre.h"
16 #if !defined (ACE_LACKS_PRAGMA_ONCE)
18 #endif /* ACE_LACKS_PRAGMA_ONCE */
20 #if defined (ACE_HAS_MONITOR_FRAMEWORK) && (ACE_HAS_MONITOR_FRAMEWORK == 1)
22 #include "ace/Service_Config.h"
23 #include "ace/Dynamic_Service.h"
24 #include "ace/Reactor.h"
26 #include "ace/Monitor_Control/Auto_Update_Starter.h"
28 typedef ACE_VERSIONED_NAMESPACE_NAME::ACE::Monitor_Control::CPU_Load_Monitor
30 typedef ACE_VERSIONED_NAMESPACE_NAME::ACE::Monitor_Control::Memory_Usage_Monitor
32 typedef ACE_VERSIONED_NAMESPACE_NAME::ACE::Monitor_Control::Num_Threads_Monitor
34 typedef ACE_VERSIONED_NAMESPACE_NAME::ACE::Monitor_Control::Bytes_Sent_Monitor
36 typedef ACE_VERSIONED_NAMESPACE_NAME::ACE::Monitor_Control::Packets_Sent_Monitor
38 typedef ACE_VERSIONED_NAMESPACE_NAME::ACE::Monitor_Control::Bytes_Received_Monitor
39 BYTES_RECEIVED_MONITOR
;
40 typedef ACE_VERSIONED_NAMESPACE_NAME::ACE::Monitor_Control::Packets_Received_Monitor
41 PACKETS_RECEIVED_MONITOR
;
43 using namespace ACE_VERSIONED_NAMESPACE_NAME::ACE::Monitor_Control
;
45 template<typename OS_MP_TYPE
>
47 create_os_monitor (const char* name
= 0,
48 ACE_Time_Value period
= ACE_Time_Value::zero
)
50 Monitor_Base
* retval
= 0;
52 ACE_VERSIONED_NAMESPACE_NAME::MC_ADMINMANAGER
*mgr
=
53 ACE_VERSIONED_NAMESPACE_NAME::ACE_Dynamic_Service
<
54 ACE_VERSIONED_NAMESPACE_NAME::MC_ADMINMANAGER
>::instance (
57 const char* working_name
=
58 (name
== 0 ? OS_MP_TYPE::default_name () : name
);
60 retval
= mgr
->admin ().monitor_point (working_name
);
64 ACE_NEW_RETURN (retval
, OS_MP_TYPE (working_name
), 0);
65 (void) mgr
->admin ().monitor_point (retval
, period
);
71 #define START_PERIODIC_MONITORS \
72 ACE_VERSIONED_NAMESPACE_NAME::STARTER starter; \
75 #define STOP_PERIODIC_MONITORS \
76 ACE_VERSIONED_NAMESPACE_NAME::ACE_Dynamic_Service< \
77 ACE_VERSIONED_NAMESPACE_NAME::MC_ADMINMANAGER>::instance ( \
78 "MC_ADMINMANAGER")->admin ().reactor ()->end_reactor_event_loop (); \
79 ACE_VERSIONED_NAMESPACE_NAME::ACE_Thread_Manager::instance ()->wait ()
81 #define ADD_PERIODIC_QUERY(HANDLER,QUERY,INTERVAL_SEC) \
82 ACE_VERSIONED_NAMESPACE_NAME::ACE_Dynamic_Service< \
83 ACE_VERSIONED_NAMESPACE_NAME::MC_ADMINMANAGER>::instance ( \
84 "MC_ADMINMANAGER")->admin ().auto_query (HANDLER, QUERY, INTERVAL_SEC)
86 #endif /* ACE_HAS_MONITOR_FRAMEWORK==1 */
88 #include /**/ "ace/post.h"
90 #endif // MONITOR_CONTROL_UTILS_H