Browse files

Added some addinitinal statistics to SCTP

  • Loading branch information...
1 parent 47aeb43 commit a258c1998aaf4d636a7c3ba9294ca796e51ce677 @rhornig rhornig committed Oct 29, 2010
View
12 src/transport/sctp/SCTP.cc
@@ -804,6 +804,18 @@ void SCTP::removeAssociation(SCTPAssociation *conn)
snprintf((char*)&str, sizeof(str), "Number of Timer-Based Retransmissions %d:%s",
conn->assocId, path->remoteAddress.str().c_str());
recordScalar(str, path->numberOfTimerBasedRetransmissions);
+ snprintf((char*)&str, sizeof(str), "Number of Heartbeats Sent %d:%s",
+ conn->assocId, path->remoteAddress.str().c_str());
+ recordScalar(str, path->numberOfHeartbeatsSent);
+ snprintf((char*)&str, sizeof(str), "Number of Heartbeats Received %d:%s",
+ conn->assocId, path->remoteAddress.str().c_str());
+ recordScalar(str, path->numberOfHeartbeatsRcvd);
+ snprintf((char*)&str, sizeof(str), "Number of Heartbeat ACKs Sent %d:%s",
+ conn->assocId, path->remoteAddress.str().c_str());
+ recordScalar(str, path->numberOfHeartbeatAcksSent);
+ snprintf((char*)&str, sizeof(str), "Number of Heartbeat ACKs Received %d:%s",
+ conn->assocId, path->remoteAddress.str().c_str());
+ recordScalar(str, path->numberOfHeartbeatAcksRcvd);
}
View
10 src/transport/sctp/SCTPAssociation.h
@@ -263,10 +263,18 @@ class INET_API SCTPPathVariables : public cPolymorphic
unsigned int numberOfDuplicates;
unsigned int numberOfFastRetransmissions;
unsigned int numberOfTimerBasedRetransmissions;
+ unsigned int numberOfHeartbeatsSent;
+ unsigned int numberOfHeartbeatAcksSent;
+ unsigned int numberOfHeartbeatsRcvd;
+ unsigned int numberOfHeartbeatAcksRcvd;
// ====== Output Vectors ==============================================
cOutVector* pathTSN;
cOutVector* pathRcvdTSN;
+ cOutVector* pathHb;
+ cOutVector* pathRcvdHb;
+ cOutVector* pathHbAck;
+ cOutVector* pathRcvdHbAck;
cOutVector* statisticsPathRTO;
cOutVector* statisticsPathRTT;
cOutVector* statisticsPathSSthresh;
@@ -718,7 +726,7 @@ class INET_API SCTPAssociation : public cObject
inline void sendToIP(SCTPMessage* sctpmsg, const bool qs = false) {
sendToIP(sctpmsg, remoteAddr, qs);
}
- void recordInPathTsnVector(SCTPMessage* p_msg, const IPvXAddress& dest);
+ void recordInPathVectors(SCTPMessage* pMsg, const IPvXAddress& rDest);
void scheduleSack();
/** Utility: signal to user that connection timed out */
void signalConnectionTimeout();
View
17 src/transport/sctp/SCTPAssociationBase.cc
@@ -75,6 +75,10 @@ SCTPPathVariables::SCTPPathVariables(const IPvXAddress& addr, SCTPAssociation* a
numberOfFastRetransmissions = 0;
numberOfTimerBasedRetransmissions = 0;
+ numberOfHeartbeatsSent = 0;
+ numberOfHeartbeatsRcvd = 0;
+ numberOfHeartbeatAcksSent = 0;
+ numberOfHeartbeatAcksRcvd = 0;
char str[128];
snprintf(str, sizeof(str), "HB_TIMER %d:%s",assoc->assocId,addr.str().c_str());
@@ -105,6 +109,15 @@ SCTPPathVariables::SCTPPathVariables(const IPvXAddress& addr, SCTPAssociation* a
snprintf(str, sizeof(str), "TSN Received %d:%s",assoc->assocId,addr.str().c_str());
pathRcvdTSN = new cOutVector(str);
+ snprintf(str, sizeof(str), "HB Sent %d:%s",assoc->assocId,addr.str().c_str());
+ pathHb = new cOutVector(str);
+ snprintf(str, sizeof(str), "HB ACK Sent %d:%s",assoc->assocId,addr.str().c_str());
+ pathHbAck = new cOutVector(str);
+ snprintf(str, sizeof(str), "HB Received %d:%s",assoc->assocId,addr.str().c_str());
+ pathRcvdHb = new cOutVector(str);
+ snprintf(str, sizeof(str), "HB ACK Received %d:%s",assoc->assocId,addr.str().c_str());
+ pathRcvdHbAck = new cOutVector(str);
+
SCTPPathInfo* pinfo = new SCTPPathInfo("pinfo");
@@ -129,6 +142,10 @@ SCTPPathVariables::~SCTPPathVariables()
delete pathTSN;
delete pathRcvdTSN;
+ delete pathHb;
+ delete pathRcvdHb;
+ delete pathHbAck;
+ delete pathRcvdHbAck;
}
View
6 src/transport/sctp/SCTPAssociationRcvMessage.cc
@@ -223,6 +223,10 @@ bool SCTPAssociation::process_RCV_Message(SCTPMessage* sctpmsg,
}
trans = true;
delete heartbeatChunk;
+ if (path) {
+ path->numberOfHeartbeatsRcvd++;
+ path->pathRcvdHb->record(path->numberOfHeartbeatsRcvd);
+ }
break;
case HEARTBEAT_ACK:
sctpEV3 << "SCTPAssociationRcvMessage: HEARTBEAT_ACK received" << endl;
@@ -1348,6 +1352,8 @@ SCTPEventCode SCTPAssociation::processDataArrived(SCTPDataChunk* dataChunk)
SCTPEventCode SCTPAssociation::processHeartbeatAckArrived(SCTPHeartbeatAckChunk* hback,
SCTPPathVariables* path)
{
+ path->numberOfHeartbeatAcksRcvd++;
+ path->pathRcvdHbAck->record(path->numberOfHeartbeatAcksRcvd);
/* hb-ack goes to pathmanagement, reset error counters, stop timeout timer */
const IPvXAddress addr = hback->getRemoteAddr();
const simtime_t hbTimeField = hback->getTimeField();
View
12 src/transport/sctp/SCTPAssociationUtil.cc
@@ -187,8 +187,8 @@ SCTPAssociation* SCTPAssociation::cloneAssociation()
return assoc;
}
-void SCTPAssociation::recordInPathTsnVector(SCTPMessage* pMsg,
- const IPvXAddress& rDest)
+void SCTPAssociation::recordInPathVectors(SCTPMessage* pMsg,
+ const IPvXAddress& rDest)
{
uint32 n_chunks = pMsg->getChunksArraySize();
if (n_chunks == 0)
@@ -201,6 +201,12 @@ void SCTPAssociation::recordInPathTsnVector(SCTPMessage* pMsg,
if (p_chunk->getChunkType() == DATA) {
const SCTPDataChunk* p_data_chunk = check_and_cast<const SCTPDataChunk *>(p_chunk);
p_path->pathTSN->record(p_data_chunk->getTsn());
+ } else if (p_chunk->getChunkType() == HEARTBEAT) {
+ p_path->numberOfHeartbeatsSent++;
+ p_path->pathHb->record(p_path->numberOfHeartbeatsSent);
+ } else if (p_chunk->getChunkType() == HEARTBEAT_ACK) {
+ p_path->numberOfHeartbeatAcksSent++;
+ p_path->pathHbAck->record(p_path->numberOfHeartbeatAcksSent);
}
}
}
@@ -252,7 +258,7 @@ void SCTPAssociation::sendToIP(SCTPMessage* sctpmsg,
sctpmsg->setControlInfo(controlInfo);
sctpMain->send(sctpmsg, "to_ip");
}
- recordInPathTsnVector(sctpmsg, dest);
+ recordInPathVectors(sctpmsg, dest);
}
sctpEV3 << "Sent to " << dest << endl;
}

0 comments on commit a258c19

Please sign in to comment.