Skip to Content.
Sympa Menu

ndt-dev - [ndt-dev] [ndt] r783 committed - utils.c test_mid_clt.c test_s2c_srv.c test_c2s_srv.c runningtest.c te...

Subject: NDT-DEV email list created

List archive

[ndt-dev] [ndt] r783 committed - utils.c test_mid_clt.c test_s2c_srv.c test_c2s_srv.c runningtest.c te...


Chronological Thread 
  • From:
  • To:
  • Subject: [ndt-dev] [ndt] r783 committed - utils.c test_mid_clt.c test_s2c_srv.c test_c2s_srv.c runningtest.c te...
  • Date: Tue, 25 Sep 2012 13:51:08 +0000

Revision: 783
Author:

Date: Tue Sep 25 06:49:57 2012
Log: utils.c test_mid_clt.c test_s2c_srv.c test_c2s_srv.c runningtest.c testoptions.c testoptions.h ndtptestconstants.h heuristics.h heuristics.c test_s2c_clt.c web100srv.c tests_srv.h logging.c

http://code.google.com/p/ndt/source/detail?r=783

Modified:
/trunk/src/heuristics.c
/trunk/src/heuristics.h
/trunk/src/logging.c
/trunk/src/ndt_odbc.c
/trunk/src/ndt_odbc.h
/trunk/src/ndtptestconstants.h
/trunk/src/runningtest.c
/trunk/src/test_c2s_srv.c
/trunk/src/test_mid_clt.c
/trunk/src/test_s2c_clt.c
/trunk/src/test_s2c_srv.c
/trunk/src/testoptions.c
/trunk/src/testoptions.h
/trunk/src/tests_srv.h
/trunk/src/utils.c
/trunk/src/web100-admin.c
/trunk/src/web100-pcap.c
/trunk/src/web100srv.c

=======================================
--- /trunk/src/heuristics.c Wed Aug 1 12:30:33 2012
+++ /trunk/src/heuristics.c Tue Sep 25 06:49:57 2012
@@ -10,8 +10,9 @@

#include "utils.h"
#include "logging.h"
+#include "heuristics.h"

-#define log_lvl_heur 0
+#define log_lvl_heur 2
/**
* Compute link speed.
*
@@ -70,7 +71,7 @@
&links[0], &links[1], &links[2], &links[3],
&links[4],
&links[5], &links[6], &links[7], &links[8],
&links[9],
&links[10], &links[11], runave + n, &inc_cnt,
&dec_cnt,
- &same_cnt, &timeout, &dupack, &ifspeedlocal);
+ &same_cnt, timeout, dupack, &ifspeedlocal);
log_println(log_lvl_heur, " **First ele: spd=%s, runave=%f",
spds[n],
runave[n]);
max = 0;
=======================================
--- /trunk/src/heuristics.h Mon Apr 30 13:46:39 2012
+++ /trunk/src/heuristics.h Tue Sep 25 06:49:57 2012
@@ -9,7 +9,7 @@
#define HEURISTICS_H_

// link speed algorithms
-void calc_linkspeed(char *spds, int spd_index, int *c2sdata, int *c2sack,
+void calc_linkspeed(char spds[4][256], int spd_index, int *c2sdata, int *c2sack,
int* s2cdata, int *s2cack, float runave[4], u_int32_t
*dec_cnt,
u_int32_t *same_cnt, u_int32_t *inc_cnt, int *timeout, int
*dupack,
int isc2stest);
@@ -92,4 +92,8 @@
// Is congestion detected?
int detect_congestionwindow(double cwndtime, int mismatch, double cwin,
double rwin, double rttsec);
+
+// Is internal network link duplex mismatch detected?
+int detect_internal_duplexmismatch(double s2cspd, double realthruput,
+ double rwintime, double packetloss);
#endif /* HEURISTICS_H_ */
=======================================
--- /trunk/src/logging.c Mon Aug 13 10:49:28 2012
+++ /trunk/src/logging.c Tue Sep 25 06:49:57 2012
@@ -198,7 +198,7 @@
*
*/
void set_protologdir(char* dirname) {
- char * localstr[256];
+ char localstr[256];

// Protocol log location being set
if (dirname == NULL) {
@@ -293,12 +293,13 @@
char*
get_protologfile(int socketNum, char *protologfilename) {
char localAddr[64]="", remoteAddr[64]="";
+ I2Addr tmp_addr = NULL;
size_t tmpstrlen = sizeof(localAddr);
memset(localAddr, 0, tmpstrlen);
memset(remoteAddr, 0, tmpstrlen);

// get remote address
- I2Addr tmp_addr =
+ tmp_addr =
I2AddrBySockFD(get_errhandle(), socketNum, False);
I2AddrNodeName(tmp_addr, remoteAddr, &tmpstrlen); //client name

=======================================
--- /trunk/src/ndt_odbc.c Mon Apr 30 13:46:39 2012
+++ /trunk/src/ndt_odbc.c Tue Sep 25 06:49:57 2012
@@ -157,9 +157,9 @@
memset(loginstring, 0, 1024);
snprintf(loginstring, 256, "DSN=%s;", dsn);
if (uid) {
- /*strcat(loginstring, "UID=");
- strncat(loginstring, uid, 256);
- strcat(loginstring, ";");*/
+ //strcat(loginstring, "UID=");
+ // strncat(loginstring, uid, 256);
+ // strcat(loginstring, ";");
strlcat(loginstring, "UID=", sizeof(loginstring));
strlcat(loginstring, uid, sizeof(loginstring));
strlcat(loginstring, ";", sizeof(loginstring));
@@ -200,7 +200,7 @@
}
// How many columns are there?
SQLNumResultCols(stmt, &columns);
-
+ log_println(3,"Fetched SQLNumResults:%d", columns);
// Loop through the rows in the result-set
while (SQL_SUCCEEDED(ret = SQLFetch(stmt))) {
SQLUSMALLINT i;
@@ -268,9 +268,16 @@
#if defined(HAVE_ODBC) && defined(DATABASE_ENABLED) && defined(HAVE_SQL_H)
SQLRETURN ret;
char insertStmt[2048];
+ int i_iter = 0, arr_len = 4; // 4 runspeed-averages are obtained
if (!stmt) {
return 1;
}
+ // Check if any of the run averages are nan numbers
+ for (i_iter = 0; i_iter < arr_len; i_iter++) {
+ log_println(3,"Odbc:Padding %f?", runave[i_iter]);
+ pad_NaN(&runave[i_iter]);
+ log_println(3,"Odbc:After Padding %f", runave[i_iter]);
+ }
snprintf(insertStmt, 2040, "INSERT INTO ndt_test_results VALUES ("
"'%s','%s','%s','%s',%f,%f,%f,%f,"
"'%s','%s','%s','%s',%d,"
@@ -301,6 +308,7 @@
SubsequentTimeouts, ThruBytesAcked, minPeak, maxPeak,
peaks
);
ret = SQLExecDirect(stmt, (unsigned char*) insertStmt, strlen(insertStmt));
+ log_println(3, "Trying to insert data using the statement:%s", insertStmt);
if (!SQL_SUCCEEDED(ret)) {
log_println(0, " Failed to insert test results into the table\n Continuing without DB logging");
extract_error("SQLExecDirect", dbc, SQL_HANDLE_DBC);
@@ -313,3 +321,16 @@
return 1;
#endif
}
+
+/***
+* Check if the value is a NaN by comparing it with itself.
+* @args float_val value of the float variable which has to be checked for Nan
+*
+**/
+void pad_NaN(float *float_val) {
+ if (*float_val != *float_val) {
+ *float_val = -1;
+ log_println(0," A float value you tried to insert into the DB was NaN");
+ }
+}
+
=======================================
--- /trunk/src/ndt_odbc.h Mon Apr 30 13:46:39 2012
+++ /trunk/src/ndt_odbc.h Tue Sep 25 06:49:57 2012
@@ -27,4 +27,6 @@
int SubsequentTimeouts, int ThruBytesAcked, int minPeaks, int
maxPeaks,
int peaks);

+void pad_NaN(float *float_val);
+
#endif
=======================================
--- /trunk/src/ndtptestconstants.h Mon Apr 30 13:46:39 2012
+++ /trunk/src/ndtptestconstants.h Tue Sep 25 06:49:57 2012
@@ -28,17 +28,17 @@
#define PORT4 "3003"


-/* status of tests. Used mainly to log a "textual" explanation using below array */
+// status of tests. Used mainly to log a "textual" explanation using below array
enum TEST_STATUS_INT {
TEST_NOT_STARTED, TEST_STARTED, TEST_INPROGRESS, TEST_INCOMPLETE, TEST_ENDED
} teststatusint;

-/* Test IDs */
+// Test IDs
enum TEST_ID {
NONE, MIDDLEBOX, SFW, C2S, S2C, META
} testid;

-/* Transmission direction */
+// Transmission direction
enum Tx_DIRECTION {
NO_DIR, C_S, S_C
} txdirection;
=======================================
--- /trunk/src/runningtest.c Wed Aug 1 12:29:37 2012
+++ /trunk/src/runningtest.c Tue Sep 25 06:49:57 2012
@@ -60,9 +60,9 @@
*/

void setCurrentDirn(enum Tx_DIRECTION directionarg) {
- currentDirection = directionarg;
char currenttestdirn[TEST_DIRN_DESC_SIZE];
char othertestdirn[TEST_DIRN_DESC_SIZE];
+ currentDirection = directionarg;
switch (currentDirection) {
case S_C:
senddirnstr = get_testdirectiondesc(currentDirection,
currenttestdirn);
@@ -136,7 +136,7 @@
* */
char *get_procstatusdesc(enum PROCESS_STATUS_INT procstatusarg, char *sprocarg) {
sprocarg = _procstatusarray[procstatusarg];
- log_println(7,"--current process status = %s for %d\n", sprocarg, procstatusarg);
+ //log_println(7,"--current process status = %s for %d\n", sprocarg, procstatusarg);
return sprocarg;
}

@@ -148,7 +148,7 @@
* */
char *get_processtypedesc(enum PROCESS_TYPE_INT procidarg, char *snamearg) {
snamearg = _proctypesarray[procidarg];
- log_println(7,"--current process name = %s for %d\n", snamearg, procidarg);
+ //log_println(7,"--current process name = %s for %d\n", snamearg, procidarg);
return snamearg;
}

=======================================
--- /trunk/src/test_c2s_srv.c Wed Aug 1 12:30:33 2012
+++ /trunk/src/test_c2s_srv.c Tue Sep 25 06:49:57 2012
@@ -19,6 +19,7 @@
#include "logging.h"
#include "protocol.h"
#include "network.h"
+#include "mrange.h"

int mon_pipe1[2]; // used to store file descriptors of pipes created for ndttrace for C2S tests

=======================================
--- /trunk/src/test_mid_clt.c Mon Apr 30 13:46:39 2012
+++ /trunk/src/test_mid_clt.c Tue Sep 25 06:49:57 2012
@@ -15,6 +15,7 @@
#include "network.h"
#include "protocol.h"
#include "utils.h"
+#include "strlutils.h"

/**
* Perform the client part of the middleBox testing. The middlebox test
=======================================
--- /trunk/src/test_s2c_clt.c Mon Apr 30 13:46:39 2012
+++ /trunk/src/test_s2c_clt.c Tue Sep 25 06:49:57 2012
@@ -15,6 +15,7 @@
#include "network.h"
#include "protocol.h"
#include "utils.h"
+#include "strlutils.h"

int ssndqueue, sbytes;
double spdin, s2cspd;
=======================================
--- /trunk/src/test_s2c_srv.c Wed Aug 1 12:30:33 2012
+++ /trunk/src/test_s2c_srv.c Tue Sep 25 06:49:57 2012
@@ -10,6 +10,7 @@
#include <syslog.h>
#include <pthread.h>
#include <sys/times.h>
+#include <ctype.h>
#include "tests_srv.h"
#include "strlutils.h"
#include "ndtptestconstants.h"
=======================================
--- /trunk/src/testoptions.c Wed Aug 1 12:30:33 2012
+++ /trunk/src/testoptions.c Tue Sep 25 06:49:57 2012
@@ -7,7 +7,7 @@

#include <assert.h>
#include <string.h>
-#include <ctype.h>
+//#include <ctype.h>
#include <pthread.h>

#include "testoptions.h"
=======================================
--- /trunk/src/testoptions.h Wed Aug 1 12:31:44 2012
+++ /trunk/src/testoptions.h Tue Sep 25 06:49:57 2012
@@ -81,4 +81,5 @@
web100_agent* agentarg, Options* optionsarg);

int is_buffer_clogged(int nextseqtosend, int lastunackedseq);
+void stop_packet_trace(int *monpipe_arr);
#endif
=======================================
--- /trunk/src/tests_srv.h Mon Apr 30 13:46:39 2012
+++ /trunk/src/tests_srv.h Tue Sep 25 06:49:57 2012
@@ -1,6 +1,6 @@
/*
* This file contains the definitions and function declarations to
- * handle the C2S test.
+ * handle the server-side tests.
*
*

* Oct 2011
=======================================
--- /trunk/src/utils.c Fri Aug 31 12:30:23 2012
+++ /trunk/src/utils.c Tue Sep 25 06:49:57 2012
@@ -192,8 +192,8 @@
}
}
output_buf[j] = '\0'; // null terminate
- log_println(8,"Received=%s; len=%d; dest=%d; MSG=%s\n", line,
line_size,
- strlen(output_buf), output_buf);
+ //log_println(8,"Received=%s; len=%d; dest=%d; MSG=%s\n", line,
line_size,
+ // strlen(output_buf), output_buf);
return j - 1;
}

=======================================
--- /trunk/src/web100-admin.c Mon Apr 30 13:46:39 2012
+++ /trunk/src/web100-admin.c Tue Sep 25 06:49:57 2012
@@ -16,6 +16,8 @@
#include "logging.h"
#include "web100-admin.h"
#include "utils.h"
+#include "strlutils.h"
+#include "heuristics.h"

/* Initialize the Administrator view. Process the data in the existing log file to
* catch up on what's happened before.
@@ -69,15 +71,15 @@
int congestion2 = 0, i;
static int totalcnt;
double rttsec;
- double rwintime, cwndtime, sendtime;
- int totaltime;
+ double rwintime=0, cwndtime=0, sendtime=0;
+ int totaltime=0;
char view_string[256], *str, tmpstr[32];
FILE * fp;

if (view_flag == 1) {
fp = fopen("/tmp/view.string", "r");
fgets(view_string, 256, fp);
-
+ log_println(3, "View_string=%s", view_string);
str = view_string;
sscanf(str, "%[^,]s", tmpstr);
maxc2sspd = atoi(tmpstr);
@@ -253,13 +255,15 @@

totaltime = calc_totaltesttime(SndLimTimeRwin, SndLimTimeCwnd,
SndLimTimeSender);
-
+ log_println(3, "totaltime=%d, sndLim %d", totaltime, SndLimTimeRwin);
// time spent being send-limited due to client's recv window
rwintime = calc_sendlimited_rcvrfault(SndLimTimeRwin, totaltime);
+ log_println(3, "rwintime=%f", rwintime);

+ log_println(3, "before calling cwndtime cal. %d,%d", SndLimTimeCwnd, totaltime);
// time spent in being send-limited due to congestion window
cwndtime = calc_sendlimited_cong(SndLimTimeCwnd, totaltime);
-
+ log_println(3, "cwndtime=%f", cwndtime);
// time spent in being send-limited due to own fault
sendtime = calc_sendlimited_sndrfault(SndLimTimeSender, totaltime);
timesec = totaltime / MEGA; // total time in microsecs
@@ -574,8 +578,12 @@
DataPktsOut;
int AckPktsOut, CurrentMSS, DupAcksIn, AckPktsIn, MaxRwinRcvd = 0, Sndbuf =
0;
- int CurrentCwnd = 0, SndLimTimeRwin, SndLimTimeCwnd, SndLimTimeSender,
- DataBytesOut;
+ //int CurrentCwnd = 0, SndLimTimeRwin, SndLimTimeCwnd,
SndLimTimeSender,
+ // DataBytesOut;
+ // commenting out lines above to assign values
+ int CurrentCwnd = 0, SndLimTimeRwin=0, SndLimTimeCwnd=0, SndLimTimeSender=0,
+ DataBytesOut=0;
+
int SndLimTransRwin, SndLimTransCwnd, SndLimTransSender, MaxSsthresh;
int CurrentRTO, CurrentRwinRcvd, CongestionSignals, PktsOut = 0;
FILE * fp;
@@ -590,6 +598,7 @@
return;

while ((fgets(buff, 512, fp)) != NULL) {
+ log_println(3,"Reading line: %s",buff);
if ((str = strchr(buff, ',')) != NULL) {
sscanf(buff, "%[^,]s", date);
str++;
=======================================
--- /trunk/src/web100-pcap.c Mon Aug 13 10:49:28 2012
+++ /trunk/src/web100-pcap.c Tue Sep 25 06:49:57 2012
@@ -435,7 +435,7 @@
void calculate_spd(struct spdpair *cur, struct spdpair *cur2, int portA,
int portB) {

- float bits = 0, spd, time;
+ float bits = 0, spd = 0, time = 0;

assert(cur);
assert(cur2);
@@ -466,7 +466,9 @@
cur2->dec_cnt++;
}
// get throughput
+log_println(8, "0BITS=%f, time=%f, SPD=%f", bits, time, spd);
spd = (bits / time); /* convert to mbits/sec) */
+log_println(8, "1BITS=%f, time=%f, SPD=%f", bits, time, spd);
// increment speed bin based on throughput range
if ((spd > 0) && (spd <= 0.01))
cur2->links[0]++;
@@ -498,11 +500,20 @@
cur2->time = cur->time;
cur2->sec = cur->sec;
cur2->usec = cur->usec;
+log_println(8, "BITS=%f, time=%f, SPD=%f", bits, time, spd);
if ((time > 10) && (spd > 0)) {
+log_println(8, ">10 : totalcount=%f, spd=%f, cur2->totalcount=%d", cur2->totalspd2, spd, cur2->totalcount);
cur2->totalspd += spd;
cur2->totalcount++;
cur2->totalspd2 = (cur2->totalspd2 + spd) / 2;
}
+ // debug
+//
+//else {
+// log_println(0, "ELSE totalspd2=%f, spd=%f, cur2->totalcount=%d", cur2->totalspd2, spd, cur2->totalcount);
+//}
+
+log_println(8, "totalspd2 in the end=%f, spd=%f", cur2->totalspd2,spd);
}

/**
=======================================
--- /trunk/src/web100srv.c Mon Aug 13 11:01:24 2012
+++ /trunk/src/web100srv.c Tue Sep 25 06:49:57 2012
@@ -84,6 +84,7 @@
#include "runningtest.h"
#include "strlutils.h"
#include "heuristics.h"
+#include "tests_srv.h"

static char lgfn[FILENAME_SIZE]; // log file name
static char wvfn[FILENAME_SIZE]; // file name of web100-variables list
@@ -173,7 +174,7 @@
{ "file", 1, 0, 'f' },
{ "interface", 1, 0, 'i' },
{ "log", 1, 0, 'l' },
- { "protocol_log", 1, 0, 'u' },
+ { "protolog_dir", 1, 0, 'u' },
{ "enableprotolog", 0, 0, 'e' },
{ "port", 1, 0, 'p' },
{ "midport", 1, 0, 302 },
@@ -645,7 +646,7 @@
set_logfile(lgfn);
sprintf(lgfn, "%s", val);
continue;
- } else if (strncasecmp(key, "protocol_log", 12) == 0) {
+ } else if (strncasecmp(key, "protolog_dir", 12) == 0) {
sprintf(lgfn, "%s", val);
set_protologdir(lgfn);
continue;


  • [ndt-dev] [ndt] r783 committed - utils.c test_mid_clt.c test_s2c_srv.c test_c2s_srv.c runningtest.c te..., ndt, 09/25/2012

Archive powered by MHonArc 2.6.16.

Top of Page