Commit 3044b042 authored by Omar Gabella's avatar Omar Gabella

add some counters to test

parent 602a43af
......@@ -24,12 +24,24 @@ int wr_present(struct pp_instance *ppi, unsigned char *pkt, int plen)
MsgSignaling wrsig_msg;
if (ppi->is_new_state) {
#ifdef BROADCAST_BASE
/* ONLY FOR TESTS */
WR_DSPOR(ppi)->ctr_wr_present_0_1++;
#endif // BROADCAST_BASE
wrp->wrStateRetry = WR_STATE_RETRY;
sendmsg = 1;
} else if (pp_timeout(ppi, PP_TO_EXT_0)) {
#ifdef BROADCAST_BASE
/* ONLY FOR TESTS */
WR_DSPOR(ppi)->ctr_wr_present_0_2++;
#endif // BROADCAST_BASE
if (wr_handshake_retry(ppi))
sendmsg = 1;
else
#ifdef BROADCAST_BASE
/* ONLY FOR TESTS */
WR_DSPOR(ppi)->ctr_wr_present_0_3++;
#endif // BROADCAST_BASE
return 0; /* non-wr already */
}
......@@ -38,30 +50,37 @@ int wr_present(struct pp_instance *ppi, unsigned char *pkt, int plen)
ppi->next_state = WRS_S_LOCK;
#else
if (sendmsg) {
#ifdef BROADCAST_BASE
/* ONLY FOR TESTS */
WR_DSPOR(ppi)->ctr_wr_present_0_4++;
#endif // BROADCAST_BASE
__pp_timeout_set(ppi, PP_TO_EXT_0, WR_WRS_PRESENT_TIMEOUT_MS);
e = msg_issue_wrsig(ppi, SLAVE_PRESENT);
}
if (ppi->received_ptp_header.messageType == PPM_SIGNALING) {
#ifdef BROADCAST_BASE
/* ONLY FOR TESTS */
WR_DSPOR(ppi)->ctr_wr_present_1++;
#endif // BROADCAST_BASE
msg_unpack_wrsig(ppi, pkt, &wrsig_msg,
&(wrp->msgTmpWrMessageID));
#ifdef BROADCAST_BASE
/* ONLY FOR TESTS */
WR_DSPOR(ppi)->ctr_wr_present_1++;
WR_DSPOR(ppi)->ctr_wr_present_2++;
#endif // BROADCAST_BASE
if (wrp->msgTmpWrMessageID == LOCK)
{
#ifdef BROADCAST_BASE
/* ONLY FOR TESTS */
WR_DSPOR(ppi)->ctr_wr_present_2++;
WR_DSPOR(ppi)->ctr_wr_present_3++;
if (memcmp(ppi->received_ptp_header.targetIdentity.clockIdentity.id,
DSPOR(ppi)->portIdentity.clockIdentity.id,
PP_CLOCK_IDENTITY_LENGTH)!=0)
{
/* ONLY FOR TESTS */
WR_DSPOR(ppi)->ctr_wr_present_3++;
WR_DSPOR(ppi)->ctr_wr_present_4++;
ppi->next_state = WRS_S_LOCK;
}
#else
......@@ -72,11 +91,20 @@ int wr_present(struct pp_instance *ppi, unsigned char *pkt, int plen)
#endif // BROADCAST_NODE
if (e == 0)
{
#ifdef BROADCAST_BASE
/* ONLY FOR TESTS */
WR_DSPOR(ppi)->ctr_wr_present_00_1++;
#endif // BROADCAST_BASE
st_com_execute_slave(ppi);
}
else {
/* nothing, just stay here again */
}
#ifdef BROADCAST_BASE
/* ONLY FOR TESTS */
WR_DSPOR(ppi)->ctr_wr_present_00_2++;
#endif // BROADCAST_BASE
ppi->next_delay = WR_DSPOR(ppi)->wrStateTimeout;
return e;
......
......@@ -62,9 +62,20 @@ struct wr_dsport {
#ifdef BROADCAST_BASE
/* ONLY FOR TESTS */
UInteger32 ctr_wr_present_1;
UInteger32 ctr_wr_present_2;
UInteger32 ctr_wr_present_3;
UInteger32 ctr_wr_present_0_1;
UInteger32 ctr_wr_present_0_2;
UInteger32 ctr_wr_present_0_3;
UInteger32 ctr_wr_present_0_4;
UInteger32 ctr_wr_present_1;
UInteger32 ctr_wr_present_2;
UInteger32 ctr_wr_present_3;
UInteger32 ctr_wr_present_4;
UInteger32 ctr_wr_present_00_1;
UInteger32 ctr_wr_present_00_2;
UInteger32 ctr_wr_present_00_3;
UInteger32 ctr_wr_present_00_4;
#endif // BROADCAST_BASE
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment