Changes to attempt to silence bcc64x
[ACE_TAO.git] / ACE / ace / Monitor_Control / Monitor_Control_utils.h
blob46130542fead14236c3b9607d3d058a8c5cc98b2
1 // -*- C++ -*-
3 //=============================================================================
4 /**
5 * @file Monitor_Control_utils.h
7 * @author Jeff Parsons <j.parsons@vanderbilt.edu>
8 */
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)
17 #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
29 CPU_LOAD_MONITOR;
30 typedef ACE_VERSIONED_NAMESPACE_NAME::ACE::Monitor_Control::Memory_Usage_Monitor
31 MEMORY_USAGE_MONITOR;
32 typedef ACE_VERSIONED_NAMESPACE_NAME::ACE::Monitor_Control::Num_Threads_Monitor
33 NUM_THREADS_MONITOR;
34 typedef ACE_VERSIONED_NAMESPACE_NAME::ACE::Monitor_Control::Bytes_Sent_Monitor
35 BYTES_SENT_MONITOR;
36 typedef ACE_VERSIONED_NAMESPACE_NAME::ACE::Monitor_Control::Packets_Sent_Monitor
37 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>
46 Monitor_Base*
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 (
55 "MC_ADMINMANAGER");
57 const char* working_name =
58 (name == 0 ? OS_MP_TYPE::default_name () : name);
60 retval = mgr->admin ().monitor_point (working_name);
62 if (retval == 0)
64 ACE_NEW_RETURN (retval, OS_MP_TYPE (working_name), 0);
65 (void) mgr->admin ().monitor_point (retval, period);
68 return retval;
71 #define START_PERIODIC_MONITORS \
72 ACE_VERSIONED_NAMESPACE_NAME::STARTER starter; \
73 starter.activate ()
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