Merge pull request #2216 from jwillemsen/jwi-cxxversionchecks
[ACE_TAO.git] / ACE / examples / Monitor / MC_Test_Utilities.cpp
blobd6daa81d20e33d0e3e0fd7eb6b429a2f04c3efcf
1 #include "ace/Date_Time.h"
2 #include "ace/streams.h"
4 #include "MC_Test_Utilities.h"
6 #if defined (ACE_HAS_MONITOR_FRAMEWORK) && (ACE_HAS_MONITOR_FRAMEWORK == 1)
8 void
9 MC_Test_Utilities::display_timestamp (
10 const Monitor_Control_Types::Data &data)
12 /// The heavy lifting of converting an ACE_Time_Value
13 /// to something that's easily outputted in a pretty
14 /// format has already been done in ACE_Date_Time.
15 ACE_Date_Time dt (data.timestamp_);
16 cout << setfill ('0')
17 << setw (2) << dt.month () << '-'
18 << setw (2) << dt.day () << '-'
19 << dt.year () << ' '
20 << setw (2) << dt.hour () << ':'
21 << setw (2) << dt.minute () << ':'
22 << setw (2) << dt.second () << '.'
23 << setw (6) << dt.microsec () << ": ";
26 void
27 MC_Test_Utilities::display_num_threads (
28 const Monitor_Control_Types::Data &data)
30 cout << "# of threads: ";
31 display_timestamp (data);
32 cout << static_cast<unsigned int> (data.value_) << endl;
35 void
36 MC_Test_Utilities::display_mq_size (
37 const Monitor_Control_Types::Data &data)
39 cout << "Message queue size: ";
40 display_timestamp (data);
41 cout << static_cast<unsigned int> (data.value_) << endl;
44 void
45 MC_Test_Utilities::display_memory_usage (
46 const Monitor_Control_Types::Data &data)
48 cout << "% memory used: ";
49 display_timestamp (data);
50 cout << setiosflags (ios::showpoint | ios::fixed)
51 << setprecision (2) << data.value_ << endl;
54 void
55 MC_Test_Utilities::display_cpu_load (
56 const Monitor_Control_Types::Data &data)
58 cout << "% CPU load: ";
59 display_timestamp (data);
60 cout << setiosflags (ios::showpoint | ios::fixed)
61 << setprecision (2) << data.value_ << endl;
64 void
65 MC_Test_Utilities::display_bytes_sent (
66 const Monitor_Control_Types::Data &data)
68 cout << "total bytes sent: ";
69 display_timestamp (data);
70 cout << static_cast<ACE_UINT64> (data.value_) << endl;
72 void
73 MC_Test_Utilities::display_bytes_received (
74 const Monitor_Control_Types::Data &data)
76 cout << "total bytes received: ";
77 display_timestamp (data);
78 cout << static_cast<ACE_UINT64> (data.value_) << endl;
81 void
82 MC_Test_Utilities::display_packets_sent (
83 const Monitor_Control_Types::Data &data)
85 cout << "total packets sent: ";
86 display_timestamp (data);
87 cout << static_cast<ACE_UINT64> (data.value_) << endl;
89 void
90 MC_Test_Utilities::display_packets_received (
91 const Monitor_Control_Types::Data &data)
93 cout << "total packets received: ";
94 display_timestamp (data);
95 cout << static_cast<ACE_UINT64> (data.value_) << endl;
98 #endif /* ACE_HAS_MONITOR_FRAMEWORK==1 */