summaryrefslogtreecommitdiff
path: root/protocols/examples/RMCast/Send_Msg/Receiver.cpp
diff options
context:
space:
mode:
authorboris <boris@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2005-07-11 18:50:23 +0000
committerboris <boris@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2005-07-11 18:50:23 +0000
commit3c1a0828b68565e11715142336d5ac9cf1341afd (patch)
tree9639bb30ccf320ebbba2dce38af66e850b25805d /protocols/examples/RMCast/Send_Msg/Receiver.cpp
parent0c51de4219486246601f6d1be31c730e71a790e1 (diff)
downloadATCD-3c1a0828b68565e11715142336d5ac9cf1341afd.tar.gz
ChangeLogTag:Mon Jul 11 20:08:51 2005 Boris Kolpackov <boris@kolpackov.net>
Diffstat (limited to 'protocols/examples/RMCast/Send_Msg/Receiver.cpp')
-rw-r--r--protocols/examples/RMCast/Send_Msg/Receiver.cpp29
1 files changed, 23 insertions, 6 deletions
diff --git a/protocols/examples/RMCast/Send_Msg/Receiver.cpp b/protocols/examples/RMCast/Send_Msg/Receiver.cpp
index 39808151fe9..f86e95192f6 100644
--- a/protocols/examples/RMCast/Send_Msg/Receiver.cpp
+++ b/protocols/examples/RMCast/Send_Msg/Receiver.cpp
@@ -5,6 +5,8 @@
#include "ace/Vector_T.h"
#include "ace/Log_Msg.h"
#include "ace/OS_NS_string.h"
+#include "ace/Time_Value.h" // ACE_Time_Value
+#include "ace/OS_NS_sys_time.h" // gettimeofday
#include "ace/RMCast/Socket.h"
@@ -47,7 +49,7 @@ ACE_TMAIN (int argc, ACE_TCHAR* argv[])
// VC6 does not know about new rules.
//
{
- for (unsigned long i = 0; i < message_count; ++i)
+ for (unsigned int i = 0; i < message_count; ++i)
{
received.push_back (0);
damaged.push_back (0);
@@ -57,11 +59,19 @@ ACE_TMAIN (int argc, ACE_TCHAR* argv[])
Message msg;
+ bool first (true);
+ ACE_Time_Value start_time, time;
while (true)
{
ssize_t s = socket.size ();
+ if (first)
+ {
+ start_time = ACE_OS::gettimeofday ();
+ first = false;
+ }
+
if (s == -1 && errno == ENOENT)
{
ACE_ERROR ((LM_ERROR, "unavailable message detected\n"));
@@ -106,7 +116,9 @@ ACE_TMAIN (int argc, ACE_TCHAR* argv[])
if (msg.sn + 1 == message_count) break;
}
- unsigned long lost_count (0), damaged_count (0), duplicate_count (0);
+ time = ACE_OS::gettimeofday () - start_time;
+
+ unsigned int lost_count (0), damaged_count (0), duplicate_count (0);
{
for (Status_List::Iterator i (received); !i.done (); i.advance ())
@@ -140,13 +152,18 @@ ACE_TMAIN (int argc, ACE_TCHAR* argv[])
}
}
+ unsigned long tput =
+ (sizeof (msg) * message_count) / (time.msec () == 0 ? 1 : time.msec ());
+
ACE_DEBUG ((LM_DEBUG,
- "lost : %d\n"
- "damaged : %d\n"
- "duplicate : %d\n",
+ "lost : %d\n"
+ "damaged : %d\n"
+ "duplicate : %d\n"
+ "throughput : %d KB/sec\n",
lost_count,
damaged_count,
- duplicate_count));
+ duplicate_count,
+ tput));
/*
cout << "lost message dump:" << endl;