Skip to Content.
Sympa Menu

ndt-dev - [ndt-dev] [ndt] r747 committed - Update to original for best performance. All logic remains the same.

Subject: NDT-DEV email list created

List archive

[ndt-dev] [ndt] r747 committed - Update to original for best performance. All logic remains the same.


Chronological Thread 
  • From:
  • To:
  • Subject: [ndt-dev] [ndt] r747 committed - Update to original for best performance. All logic remains the same.
  • Date: Sun, 30 Oct 2011 16:25:12 +0000

Revision: 747
Author:

Date: Sun Oct 30 09:24:09 2011
Log: Update to original for best performance. All logic remains the same.
http://code.google.com/p/ndt/source/detail?r=747

Modified:
/branches/kkumar_code_organize/src/test_c2s_srv.c
/branches/kkumar_code_organize/src/test_s2c_srv.c

=======================================
--- /branches/kkumar_code_organize/src/test_c2s_srv.c Fri Oct 28 08:06:41 2011
+++ /branches/kkumar_code_organize/src/test_c2s_srv.c Sun Oct 30 09:24:09 2011
@@ -100,7 +100,7 @@
enum PROCESS_STATUS_INT procstatusenum = UNKNOWN;
enum PROCESS_TYPE_INT proctypeenum = CONNECT_TYPE;
char namesuffix[256] = "c2s_snaplog";
- char currenttestdesc[TEST_NAME_DESC_SIZE] = "c2s" ; // todo hardcoded coz of pcap
+ char currenttestdesc[TEST_NAME_DESC_SIZE] = "c2s" ;

if (testOptions->c2sopt) {
setCurrentTest(TEST_C2S);
@@ -249,17 +249,43 @@

// set up packet tracing. Collected data is used for bottleneck link calculations
if (getuid() == 0) {
-
+ /*
pipe(mon_pipe1);
log_println(0, "%s test calling pkt_trace_start() with pd=%d for device %s, addr %s",
currenttestdesc, clilen, device ,
src_addr);
- /*start_packet_trace(recvsfd, testOptions->c2ssockfd,
&c2s_childpid,
- mon_pipe1, (struct sockaddr *)
&cli_addr, clilen, device,
- &pair, "c2s", options->compress,
meta.c2s_ndttrace);
- */
+
start_packet_trace(recvsfd, testOptions->c2ssockfd,
&c2s_childpid,
mon_pipe1,
(struct sockaddr *) &cli_addr, clilen, device,
&pair,
currenttestdesc, options->compress, meta.c2s_ndttrace);
+ */
+
+ pipe(mon_pipe1);
+ if ((c2s_childpid = fork()) == 0) {
+ /* close(ctlsockfd); */
+ close(testOptions->c2ssockfd);
+ close(recvsfd);
+ log_println(
+ 5,
+ "C2S test Child %d thinks pipe()
returned fd0=%d, fd1=%d",
+ testOptions->child0,
mon_pipe1[0], mon_pipe1[1]);
+ log_println(2, "C2S test calling init_pkttrace() with pd=0x%x", (int) &cli_addr);
+ init_pkttrace(src_addr, (struct sockaddr *)
&cli_addr, clilen,
+ mon_pipe1, device, &pair, "c2s",
options->compress);
+ exit(0); /* Packet trace finished, terminate
gracefully */
+ }
+
+ // Get data collected from packet tracing into the C2S
"ndttrace" file
+ memset(tmpstr, 0, 256);
+ for (i = 0; i < 5; i++) {
+ msgretvalue = read(mon_pipe1[0], tmpstr, 128);
+ if ((msgretvalue == -1) && (errno == EINTR))
+ continue;
+ break;
+ }
+ if (strlen(tmpstr) > 5)
+ memcpy(meta.c2s_ndttrace, tmpstr,
strlen(tmpstr));
+ //name of nettrace file passed back from pcap child
+
log_println(3, "--tracefile after packet_trace %s",
meta.c2s_ndttrace);
}
@@ -271,13 +297,10 @@
setCwndlimit(conn, group, agent, options);

// Create C->S snaplog directories, and perform some initialization based on options
-//todo remove logs
- log_println(0,"***Before create client, C2s");

create_client_logdir((struct sockaddr *) &cli_addr, clilen,
options->c2s_logname,
sizeof(options->c2s_logname), namesuffix,
sizeof(namesuffix));
- log_println(0,"***AFTER create client, C2s"); //todo remove
log
sleep(2);

// send empty TEST_START indicating start of the test
=======================================
--- /branches/kkumar_code_organize/src/test_s2c_srv.c Fri Oct 28 08:06:41 2011
+++ /branches/kkumar_code_organize/src/test_s2c_srv.c Sun Oct 30 09:24:09 2011
@@ -93,6 +93,7 @@
int i; // temporary var used for iterators etc
PortPair pair; // socket ports
I2Addr s2csrv_addr = NULL;
+ I2Addr src_addr = NULL;
char listens2cport[10];
int msgType;
int msgLen;
@@ -265,7 +266,7 @@
return -102;
}
}
- //src_addr = I2AddrByLocalSockFD(get_errhandle(), xmitsfd, 0);
+ src_addr = I2AddrByLocalSockFD(get_errhandle(), xmitsfd, 0);
conn = web100_connection_from_socket(agent, xmitsfd);

// set up packet capture. The data collected is used for bottleneck link calculations
@@ -273,11 +274,41 @@
log_println(6, "S2C child %d, ready to fork()",
testOptions->child0);
if (getuid() == 0) {
+ /*
pipe(mon_pipe2);
start_packet_trace(xmitsfd,
testOptions->s2csockfd,
&s2c_childpid, mon_pipe2, (struct
sockaddr *) &cli_addr,
clilen, device, &pair, "s2c",
options->compress,
meta.s2c_ndttrace);
+ */
+ pipe(mon_pipe2);
+ if ((s2c_childpid = fork()) == 0) {
+ /* close(ctlsockfd); */
+ close(testOptions->s2csockfd);
+ close(xmitsfd);
+ log_println(
+ 5,
+ "S2C test Child thinks
pipe() returned fd0=%d, fd1=%d",
+ mon_pipe2[0],
mon_pipe2[1]);
+ /* log_println(2, "S2C test calling init_pkttrace() with pd=0x%x", (int) &cli_addr); */
+ init_pkttrace(src_addr, (struct sockaddr
*) &cli_addr,
+ clilen, mon_pipe2, device,
&pair, "s2c",
+ options->compress);
+ log_println(6,
+ "S2C test ended, why is
timer still running?");
+ exit(0); /* Packet trace finished,
terminate gracefully */
+ }
+ memset(tmpstr, 0, 256);
+ for (i = 0; i < 5; i++) { // read nettrace file name
into "tmpstr"
+ ret = read(mon_pipe2[0], tmpstr, 128);
+ if ((ret == -1) && (errno == EINTR)) // socket interrupted, try reading again
+ continue;
+ break;
+ }
+
+ if (strlen(tmpstr) > 5)
+ memcpy(meta.s2c_ndttrace, tmpstr,
strlen(tmpstr));
+ // name of nettrace file passed back from pcap child copied into meta structure

}



  • [ndt-dev] [ndt] r747 committed - Update to original for best performance. All logic remains the same., ndt, 10/30/2011

Archive powered by MHonArc 2.6.16.

Top of Page