Applicable Versions | NetSim Standard | NetSim Pro |
Applicable Releases | v9 |
Please use printf based debugging to get a clear understanding of your code flow. It is available in the link below - https://tetcos.freshdesk.com/solution/articles/14000028689-how-do-i-write-to-netsim-console-for-debugging
You can try printing the Device ID, Application ID, Duplicate Ack Count, Congestion Window Size and the RTT time from the functions fn_NetSim_TCP_Window_Expansion(TCB *pstruTCP_Connection_Var) or fn_NetSim_TCP_Window_Shrinkage(TCB *pstruTCP_Connection_Var) which are part of the Window_Expansion.c and Window_Shrinkage.c files. You can use the TCB connection variable pstruTCP_Connection_Var to print the required parameters.
The lines of code can be something like:
To print to a file:
fprintf (fp,"Device ID\tAppln ID\tDuplicate ACKs\tCongestion Window Size\tRTT\n");
fprintf(fp,"%d\t%d\t%d\t%d\t%f\n", pstruTCP_Connection_Var->nDevice_ID, pstruTCP_Connection_Var->nAppId, pstruTCP_Connection_Var->nDup_ACK_Count, pstruTCP_Connection_Var->un_cwnd, pstruTCP_Connection_Var->dRTT_TIME);
Where fp can be a file pointer to your log file.
To print to console:
fprintf (stderr,"Device ID\tAppln ID\tDuplicate ACKs\tCongestion Window Size\tRTT\n");
fprintf(stderr,"%d\t%d\t%d\t%d\t%f\n", pstruTCP_Connection_Var->nDevice_ID, pstruTCP_Connection_Var->nAppId, pstruTCP_Connection_Var->nDup_ACK_Count, pstruTCP_Connection_Var->un_cwnd, pstruTCP_Connection_Var->dRTT_TIME);
This will give you the values of these parameters at the current instant of "simulation time", whereas printing via custom the metrics will give you the values of these parameters at the last instant of the simulation.
Note:
Whenever Device Id is printed to console or to a file, it has to be invoked from the pstruEventDetails->deviceid variable. This is because it keeps changing every time a new event is called.