Commit 2e5cae01 authored by Grzegorz Daniluk's avatar Grzegorz Daniluk

smartbits-tester: calculate loss rate with fractional part too

parent a9997dcd
...@@ -162,17 +162,18 @@ int clear_allcntrs(int mask) ...@@ -162,17 +162,18 @@ int clear_allcntrs(int mask)
int show_floss(FILE *f, HTCountStructure *cntrs, unsigned long *total) int show_floss(FILE *f, HTCountStructure *cntrs, unsigned long *total)
{ {
int i, loss[SMB_PORTS]; int i;
float loss[SMB_PORTS];
fprintf(f, "===========================\n"); fprintf(f, "===========================\n");
fprintf(f, "| Port \t| Loss rate \t|\n"); fprintf(f, "| Port \t| Loss rate \t|\n");
fprintf(f, "===========================\n"); fprintf(f, "===========================\n");
for(i=0; i<SMB_PORTS; ++i) { for(i=0; i<SMB_PORTS; ++i) {
if(total[i]!=0) if(total[i]!=0)
loss[i] = (total[i]-cntrs[i].RcvTrig)*100/total[i]; loss[i] = (total[i]-cntrs[i].RcvTrig)*100.0/total[i];
else else
loss[i] = 0; loss[i] = 0;
fprintf(f, "| %d \t| %d \t|\n", i, loss[i]); fprintf(f, "| %d \t| %f \t|\n", i, loss[i]);
} }
} }
...@@ -464,7 +465,7 @@ int exp_rx_frames(struct smb_test *wrst, HTCountStructure *cntrs, unsigned long ...@@ -464,7 +465,7 @@ int exp_rx_frames(struct smb_test *wrst, HTCountStructure *cntrs, unsigned long
exp[ p_tx->d_ports[idp] ] += cntrs[i_port].TmtPkt/p_tx->d_ports_n; exp[ p_tx->d_ports[idp] ] += cntrs[i_port].TmtPkt/p_tx->d_ports_n;
/* now check if at the end of the stream run, one more frame wasn't sent /* now check if at the end of the stream run, one more frame wasn't sent
* to analyzed port */ * to analyzed port */
if( cntrs[i_port].TmtPkt % p_tx->d_ports_n > p_tx->d_ports[idp] ) if( cntrs[i_port].TmtPkt % p_tx->d_ports_n > idp )
exp[ p_tx->d_ports[idp] ]++; exp[ p_tx->d_ports[idp] ]++;
} }
else if(p_tx->d_ports[idp] == TX_PALL){ else if(p_tx->d_ports[idp] == TX_PALL){
......
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