Skip to content

Commit

Permalink
Added some addinitinal statistics to SCTP
Browse files Browse the repository at this point in the history
  • Loading branch information
rhornig committed Oct 29, 2010
1 parent 47aeb43 commit a258c19
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 4 deletions.
12 changes: 12 additions & 0 deletions src/transport/sctp/SCTP.cc
Expand Up @@ -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);
}


Expand Down
10 changes: 9 additions & 1 deletion src/transport/sctp/SCTPAssociation.h
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
Expand Down
17 changes: 17 additions & 0 deletions src/transport/sctp/SCTPAssociationBase.cc
Expand Up @@ -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());
Expand Down Expand Up @@ -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");
Expand All @@ -129,6 +142,10 @@ SCTPPathVariables::~SCTPPathVariables()

delete pathTSN;
delete pathRcvdTSN;
delete pathHb;
delete pathRcvdHb;
delete pathHbAck;
delete pathRcvdHbAck;

}

Expand Down
6 changes: 6 additions & 0 deletions src/transport/sctp/SCTPAssociationRcvMessage.cc
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
Expand Down
12 changes: 9 additions & 3 deletions src/transport/sctp/SCTPAssociationUtil.cc
Expand Up @@ -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)
Expand All @@ -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);
}
}
}
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit a258c19

Please sign in to comment.