1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103
|
// $Id: MC_Test_Utilities.cpp 90163 2010-05-18 21:42:20Z mitza $
#include "ace/Date_Time.h"
#include "ace/streams.h"
#include "MC_Test_Utilities.h"
#if defined (ACE_HAS_MONITOR_FRAMEWORK) && (ACE_HAS_MONITOR_FRAMEWORK == 1)
void
MC_Test_Utilities::display_timestamp (
const Monitor_Control_Types::Data &data)
{
/// The heavy lifting of converting an ACE_Time_Value
/// to something that's easily outputted in a pretty
/// format has already been done in ACE_Date_Time.
ACE_Date_Time dt (data.timestamp_);
cout << setfill ('0')
<< setw (2) << dt.month () << '-'
<< setw (2) << dt.day () << '-'
<< dt.year () << ' '
<< setw (2) << dt.hour () << ':'
<< setw (2) << dt.minute () << ':'
<< setw (2) << dt.second () << '.'
<< setw (6) << dt.microsec () << ": ";
}
void
MC_Test_Utilities::display_num_threads (
const Monitor_Control_Types::Data &data)
{
cout << "# of threads: ";
display_timestamp (data);
cout << static_cast<unsigned int> (data.value_) << endl;
}
void
MC_Test_Utilities::display_mq_size (
const Monitor_Control_Types::Data &data)
{
cout << "Message queue size: ";
display_timestamp (data);
cout << static_cast<unsigned int> (data.value_) << endl;
}
void
MC_Test_Utilities::display_memory_usage (
const Monitor_Control_Types::Data &data)
{
cout << "% memory used: ";
display_timestamp (data);
cout << setiosflags (ios::showpoint | ios::fixed)
<< setprecision (2) << data.value_ << endl;
}
void
MC_Test_Utilities::display_cpu_load (
const Monitor_Control_Types::Data &data)
{
cout << "% CPU load: ";
display_timestamp (data);
cout << setiosflags (ios::showpoint | ios::fixed)
<< setprecision (2) << data.value_ << endl;
}
void
MC_Test_Utilities::display_bytes_sent (
const Monitor_Control_Types::Data &data)
{
cout << "total bytes sent: ";
display_timestamp (data);
cout << static_cast<ACE_UINT64> (data.value_) << endl;
}
void
MC_Test_Utilities::display_bytes_received (
const Monitor_Control_Types::Data &data)
{
cout << "total bytes received: ";
display_timestamp (data);
cout << static_cast<ACE_UINT64> (data.value_) << endl;
}
void
MC_Test_Utilities::display_packets_sent (
const Monitor_Control_Types::Data &data)
{
cout << "total packets sent: ";
display_timestamp (data);
cout << static_cast<ACE_UINT64> (data.value_) << endl;
}
void
MC_Test_Utilities::display_packets_received (
const Monitor_Control_Types::Data &data)
{
cout << "total packets received: ";
display_timestamp (data);
cout << static_cast<ACE_UINT64> (data.value_) << endl;
}
#endif /* ACE_HAS_MONITOR_FRAMEWORK==1 */
|