// to compile g++ -Wall sqnanalyzer.c -o sqnanalyzer // //syntax: // sqngenanalyzer // //This program is free software; you can redistribute it and/or //modify it under the terms of the GNU General Public License //s published by the Free Software Foundation; either version //2 of the License, or (at your option) any later version. // //Author: Fabio Ludovici //Version 1.0 final //July 2009 // //This program was used to test the loss generation algorithm implemented in Netem2 //available at http://netgroup.uniroma2.it/twiki/bin/view.cgi/Main/NetEm2 // #include #include #include #include #include #define UNO 4294967295 #include #include using namespace std; void blind_external_check(int length, int gmin_max, int sequence[], int sample, float *ploss, float *mean_length_of_burst, float *density, float *pisolated_loss, float *mean_length_of_good_burst) { bool this_is_burst; int num_of_bursts; int length_of_all_bursts; int num_of_good_bursts; int length_of_all_good_bursts; int num_of_drops; int num_of_burst_drops; int num_of_isolated_drops; for(int gmin=2;gmin0) mean_length_of_burst[sample*j+i-1]=(float) length_of_all_bursts/num_of_bursts; else mean_length_of_burst[sample*j+i-1]=0; if (num_of_good_bursts>0) mean_length_of_good_burst[sample*j+i-1]=(float) length_of_all_good_bursts/num_of_good_bursts; else mean_length_of_good_burst[sample*j+i-1]=0; density[sample*j+i-1]=100*(((float)num_of_burst_drops)/((float)length_of_all_bursts)); printf("P_loss %.3f%% Mean_length_of_burst %.3f Density %.3f%% P_isol %.3f%% Mean_length_of_good_burst %.3f\n", ploss[sample*j+i-1], mean_length_of_burst[sample*j+i-1], density[sample*j+i-1], pisolated_loss[sample*j+i-1], mean_length_of_good_burst[sample*j+i-1]); fstream data; data.open("data.dat", ios::out | ios::app); data<