/* * function to retrieve transport level loss or display transport level stats * @ctxs -- contexts to retrieve transport stats for * @print_flag -- if 1, display stats, retrieve loss otherwise */ private static long get_loss_or_print_stats(LBMContext[] ctxs, bool print_flag) { long lost = 0; LBMReceiverStatistics stats = null; bool have_stats; for (int ctx = 0; ctx < ctxs.Length; ctx++) { have_stats = false; while (!have_stats) { try { stats = ctxs[ctx].getReceiverStatistics(nstats); have_stats = true; } catch (LBMException ex) { /* Double the number of stats passed to the API to be retrieved */ /* Do so until we retrieve stats successfully or hit the max limit */ nstats *= 2; if (nstats > DEFAULT_MAX_NUM_SRCS) { System.Console.Error.WriteLine("Error getting receiver statistics: " + ex.Message); System.Environment.Exit(1); } /* have_stats is still false */ } } /* If we get here, we have the stats */ if (print_flag) { /* Display transport level stats */ print_stats(stats); } else { /* Accumlate transport level loss */ for (int stat = 0; stat < stats.size(); stat++) { switch (stats.type(stat)) { case LBM.TRANSPORT_STAT_LBTRU: case LBM.TRANSPORT_STAT_LBTRM: lost += stats.lost(stat); break; } } } } return(lost); }
private static void print_stats(LBMReceiverStatistics stats, LBMEventQueue evq) { if (evq != null) { if (Convert.ToInt32(evq.getAttributeValue("queue_size_warning")) > 0) { System.Console.Out.WriteLine("Event queue size: " + evq.size()); } } for (int i = 0; i < stats.size(); i++) { switch (stats.type(i)) { case LBM.TRANSPORT_STAT_TCP: System.Console.Out.WriteLine("TCP, source " + stats.source(i) + ", received " + stats.messagesReceived(i) + "/" + stats.bytesReceived(i) + ", no topics " + stats.noTopicMessagesReceived(i) + ", requests " + stats.lbmRequestsReceived(i)); break; case LBM.TRANSPORT_STAT_LBTRU: case LBM.TRANSPORT_STAT_LBTRM: if (stats.type() == LBM.TRANSPORT_STAT_LBTRU) { System.Console.Out.Write("LBT-RU"); } else { System.Console.Out.Write("LBT-RM"); } System.Console.Out.WriteLine(", source " + stats.source(i) + ", received " + stats.messagesReceived(i) + "/" + stats.bytesReceived(i) + ", naks " + stats.nakPacketsSent(i) + "/" + stats.naksSent(i) + ", lost " + stats.lost(i) + ", ncfs " + stats.ncfsIgnored(i) + "/" + stats.ncfsShed(i) + "/" + stats.ncfsRetransmissionDelay(i) + "/" + stats.ncfsUnknown(i) + ", recovery " + stats.minimumRecoveryTime(i) + "/" + stats.meanRecoveryTime(i) + "/" + stats.maximumRecoveryTime(i) + ", nak tx " + stats.minimumNakTransmissions(i) + "/" + stats.minimumNakTransmissions(i) + "/" + stats.maximumNakTransmissions(i) + ", dup " + stats.duplicateMessages(i) + ", unrecovered " + stats.unrecoveredMessagesWindowAdvance(i) + "/" + stats.unrecoveredMessagesNakGenerationTimeout(i) + ", LBM msgs " + stats.lbmMessagesReceived(i) + ", no topics " + stats.noTopicMessagesReceived(i) + ", requests " + stats.lbmRequestsReceived(i)); break; case LBM.TRANSPORT_STAT_LBTIPC: System.Console.Out.WriteLine("LBT-IPC, source " + stats.source(i) + ", received " + stats.messagesReceived(i) + "/" + stats.bytesReceived(i) + ", LBM msgs " + stats.lbmMessagesReceived(i) + ", no topics " + stats.noTopicMessagesReceived(i) + ", requests " + stats.lbmRequestsReceived(i)); break; case LBM.TRANSPORT_STAT_LBTRDMA: System.Console.Out.WriteLine("LBT-RDMA, source " + stats.source(i) + ", received " + stats.messagesReceived(i) + "/" + stats.bytesReceived(i) + ", LBM msgs " + stats.lbmMessagesReceived(i) + ", no topics " + stats.noTopicMessagesReceived(i) + ", requests " + stats.lbmRequestsReceived(i)); break; } } System.Console.Out.Flush(); }
public virtual void onReceive(LBMReceiverStatistics stats) { System.Console.Error.Write("\nReceiver statistics received"); System.Console.Error.Write(" from " + stats.getApplicationSourceId()); System.Console.Error.Write(" at " + stats.getSender().ToString()); System.Console.Error.WriteLine(", sent " + stats.getTimestamp().ToLocalTime().ToString()); System.Console.Error.WriteLine("Source: " + stats.source()); System.Console.Error.WriteLine("Transport: " + stats.typeName()); switch (stats.type()) { case LBM.TRANSPORT_STAT_TCP: System.Console.Error.WriteLine("\tLBT-TCP bytes received : " + stats.bytesReceived()); System.Console.Error.WriteLine("\tLBM messages received : " + stats.lbmMessagesReceived()); System.Console.Error.WriteLine("\tLBM messages received with uninteresting topic : " + stats.noTopicMessagesReceived()); System.Console.Error.WriteLine("\tLBM requests received : " + stats.lbmRequestsReceived()); break; case LBM.TRANSPORT_STAT_LBTRM: System.Console.Error.WriteLine("\tLBT-RM datagrams received : " + stats.messagesReceived()); System.Console.Error.WriteLine("\tLBT-RM datagram bytes received : " + stats.bytesReceived()); System.Console.Error.WriteLine("\tLBT-RM NAK packets sent : " + stats.nakPacketsSent()); System.Console.Error.WriteLine("\tLBT-RM NAKs sent : " + stats.naksSent()); System.Console.Error.WriteLine("\tLost LBT-RM datagrams detected : " + stats.lost()); System.Console.Error.WriteLine("\tNCFs received (ignored) : " + stats.ncfsIgnored()); System.Console.Error.WriteLine("\tNCFs received (shed) : " + stats.ncfsShed()); System.Console.Error.WriteLine("\tNCFs received (retransmit delay) : " + stats.ncfsRetransmissionDelay()); System.Console.Error.WriteLine("\tNCFs received (unknown) : " + stats.ncfsUnknown()); System.Console.Error.WriteLine("\tLoss recovery minimum time : " + stats.minimumRecoveryTime() + "ms"); System.Console.Error.WriteLine("\tLoss recovery mean time : " + stats.meanRecoveryTime() + "ms"); System.Console.Error.WriteLine("\tLoss recovery maximum time : " + stats.maximumRecoveryTime() + "ms"); System.Console.Error.WriteLine("\tMinimum transmissions per individual NAK : " + stats.minimumNakTransmissions()); System.Console.Error.WriteLine("\tMean transmissions per individual NAK : " + stats.meanNakTransmissions()); System.Console.Error.WriteLine("\tMaximum transmissions per individual NAK : " + stats.maximumNakTransmissions()); System.Console.Error.WriteLine("\tDuplicate LBT-RM datagrams received : " + stats.duplicateMessages()); System.Console.Error.WriteLine("\tLBT-RM datagrams unrecoverable (window advance) : " + stats.unrecoveredMessagesWindowAdvance()); System.Console.Error.WriteLine("\tLBT-RM datagrams unrecoverable (NAK generation expiration): " + stats.unrecoveredMessagesNakGenerationTimeout()); System.Console.Error.WriteLine("\tLBT-RM LBM messages received : " + stats.lbmMessagesReceived()); System.Console.Error.WriteLine("\tLBT-RM LBM messages received with uninteresting topic : " + stats.noTopicMessagesReceived()); System.Console.Error.WriteLine("\tLBT-RM LBM requests received : " + stats.lbmRequestsReceived()); System.Console.Error.WriteLine("\tLBT-RM datagrams dropped (size) : " + stats.datagramsDroppedIncorrectSize()); System.Console.Error.WriteLine("\tLBT-RM datagrams dropped (type) : " + stats.datagramsDroppedType()); System.Console.Error.WriteLine("\tLBT-RM datagrams dropped (version) : " + stats.datagramsDroppedVersion()); System.Console.Error.WriteLine("\tLBT-RM datagrams dropped (header) : " + stats.datagramsDroppedHeader()); System.Console.Error.WriteLine("\tLBT-RM datagrams dropped (other) : " + stats.datagramsDroppedOther()); System.Console.Error.WriteLine("\tLBT-RM datagrams received out of order : " + stats.outOfOrder()); break; case LBM.TRANSPORT_STAT_LBTRU: System.Console.Error.WriteLine("\tLBT-RU datagrams received : " + stats.messagesReceived()); System.Console.Error.WriteLine("\tLBT-RU datagram bytes received : " + stats.bytesReceived()); System.Console.Error.WriteLine("\tLBT-RU NAK packets sent : " + stats.nakPacketsSent()); System.Console.Error.WriteLine("\tLBT-RU NAKs sent : " + stats.naksSent()); System.Console.Error.WriteLine("\tLost LBT-RU datagrams detected : " + stats.lost()); System.Console.Error.WriteLine("\tNCFs received (ignored) : " + stats.ncfsIgnored()); System.Console.Error.WriteLine("\tNCFs received (shed) : " + stats.ncfsShed()); System.Console.Error.WriteLine("\tNCFs received (retransmit delay) : " + stats.ncfsRetransmissionDelay()); System.Console.Error.WriteLine("\tNCFs received (unknown) : " + stats.ncfsUnknown()); System.Console.Error.WriteLine("\tLoss recovery minimum time : " + stats.minimumRecoveryTime() + "ms"); System.Console.Error.WriteLine("\tLoss recovery mean time : " + stats.meanRecoveryTime() + "ms"); System.Console.Error.WriteLine("\tLoss recovery maximum time : " + stats.maximumRecoveryTime() + "ms"); System.Console.Error.WriteLine("\tMinimum transmissions per individual NAK : " + stats.minimumNakTransmissions()); System.Console.Error.WriteLine("\tMean transmissions per individual NAK : " + stats.meanNakTransmissions()); System.Console.Error.WriteLine("\tMaximum transmissions per individual NAK : " + stats.maximumNakTransmissions()); System.Console.Error.WriteLine("\tDuplicate LBT-RU datagrams received : " + stats.duplicateMessages()); System.Console.Error.WriteLine("\tLBT-RU datagrams unrecoverable (window advance) : " + stats.unrecoveredMessagesWindowAdvance()); System.Console.Error.WriteLine("\tLBT-RU datagrams unrecoverable (NAK generation expiration): " + stats.unrecoveredMessagesNakGenerationTimeout()); System.Console.Error.WriteLine("\tLBT-RU LBM messages received : " + stats.lbmMessagesReceived()); System.Console.Error.WriteLine("\tLBT-RU LBM messages received with uninteresting topic : " + stats.noTopicMessagesReceived()); System.Console.Error.WriteLine("\tLBT-RU LBM requests received : " + stats.lbmRequestsReceived()); System.Console.Error.WriteLine("\tLBT-RU datagrams dropped (size) : " + stats.datagramsDroppedIncorrectSize()); System.Console.Error.WriteLine("\tLBT-RU datagrams dropped (type) : " + stats.datagramsDroppedType()); System.Console.Error.WriteLine("\tLBT-RU datagrams dropped (version) : " + stats.datagramsDroppedVersion()); System.Console.Error.WriteLine("\tLBT-RU datagrams dropped (header) : " + stats.datagramsDroppedHeader()); System.Console.Error.WriteLine("\tLBT-RU datagrams dropped (SID) : " + stats.datagramsDroppedSID()); System.Console.Error.WriteLine("\tLBT-RU datagrams dropped (other) : " + stats.datagramsDroppedOther()); break; case LBM.TRANSPORT_STAT_LBTIPC: System.Console.Error.WriteLine("\tLBT-IPC datagrams received :" + stats.messagesReceived()); System.Console.Error.WriteLine("\tLBT-IPC datagram bytes received :" + stats.bytesReceived()); System.Console.Error.WriteLine("\tLBT-IPC LBM messages received :" + stats.lbmMessagesReceived()); System.Console.Error.WriteLine("\tLBT-IPC LBM messages received with uninteresting topic :" + stats.noTopicMessagesReceived()); System.Console.Error.WriteLine("\tLBT-IPC LBM requests received :" + stats.lbmRequestsReceived()); break; case LBM.TRANSPORT_STAT_LBTSMX: System.Console.Error.WriteLine("\tLBT-SMX datagrams received :" + stats.messagesReceived()); System.Console.Error.WriteLine("\tLBT-SMX datagram bytes received :" + stats.bytesReceived()); System.Console.Error.WriteLine("\tLBT-SMX LBM messages received :" + stats.lbmMessagesReceived()); System.Console.Error.WriteLine("\tLBT-SMX LBM messages received with uninteresting topic :" + stats.noTopicMessagesReceived()); System.Console.Error.WriteLine("\tLBT-SMX LBM requests received :" + stats.lbmRequestsReceived()); break; case LBM.TRANSPORT_STAT_LBTRDMA: System.Console.Error.WriteLine("\tLBT-RDMA datagrams received :" + stats.messagesReceived()); System.Console.Error.WriteLine("\tLBT-RDMA datagram bytes received :" + stats.bytesReceived()); System.Console.Error.WriteLine("\tLBT-RDMA LBM messages received :" + stats.lbmMessagesReceived()); System.Console.Error.WriteLine("\tLBT-RDMA LBM messages received with uninteresting topic :" + stats.noTopicMessagesReceived()); System.Console.Error.WriteLine("\tLBT-RDMA LBM requests received :" + stats.lbmRequestsReceived()); break; case LBM.TRANSPORT_STAT_BROKER: System.Console.Error.WriteLine("\tBROKER messages received : " + stats.messagesReceived()); System.Console.Error.WriteLine("\tBROKER message bytes received : " + stats.bytesReceived()); break; default: System.Console.Error.WriteLine("Error: Unknown transport type received:" + stats.type()); break; } _recycler.doneWithReceiverStatistics(stats); }