Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
c304bed
first attempt adding the travis file
zaf6862 Jul 22, 2019
2e64cad
first attempt at adding the travis file
zaf6862 Jul 22, 2019
ee860b9
added an extra file to see if travis build now
zaf6862 Jul 22, 2019
90ccd5f
added an extra file to see if travis build now
zaf6862 Jul 22, 2019
bca15ac
added an extra file to see if travis build now
zaf6862 Jul 22, 2019
e16a6c7
added an extra file to see if travis build now
zaf6862 Jul 22, 2019
c02cd44
added an extra file to see if travis build now
zaf6862 Jul 22, 2019
c7f1390
added performance test for msocket
zaf6862 Jul 23, 2019
d3b699c
added performance test for msocket in travis
zaf6862 Jul 23, 2019
e517116
added performance test for msocket in travis
zaf6862 Jul 23, 2019
78c1d81
added performance test for msocket in travis
zaf6862 Jul 23, 2019
422b7b6
added performance test for msocket in travis
zaf6862 Jul 23, 2019
25fb9ca
added performance test for msocket in travis
zaf6862 Jul 23, 2019
5eab190
added performance test for msocket in travis
zaf6862 Jul 23, 2019
71ed9aa
added the ThreePathWritingPolicy
zaf6862 Aug 28, 2019
9ca0577
bug fix with travis performance test
zaf6862 Aug 28, 2019
8c00729
removed moot prints
zaf6862 Aug 28, 2019
6543916
removed the extra file
zaf6862 Sep 25, 2019
1a5c73f
fixed few log statements. Fixed app level client server code to match…
zaf6862 Oct 11, 2019
410ff6b
jar compiles now.
zaf6862 Oct 11, 2019
15ce3d1
renamed the ReMP policy to match its actual description
zaf6862 Oct 11, 2019
8a30769
increased the range for overhead so that the pull request TRAVIS CI b…
zaf6862 Oct 11, 2019
73c85f5
fixed tobeSent variable in the ReMP policy
zaf6862 Oct 14, 2019
9862339
updated the app level code used for performance experiments
zaf6862 Oct 14, 2019
2e2bc0e
removed the import that was causing travis check to fail
zaf6862 Oct 14, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.DS_Store
19 changes: 19 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
language: java
# sudo: required instructs Travis to use a "real VM" instead of a docker VM
sudo: required
jdk:
- oraclejdk9

before_install:
- sudo apt-get update -qq
- sudo apt-get install -qq ant-optional

#notifications:
# email:
# on_success: always
# on_failure: always
install:
- sudo apt-get install ant
script:
- cd scripts
- ./travis_performance_test.sh
100 changes: 100 additions & 0 deletions scripts/MSocketClient.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
import edu.umass.cs.msocket.FlowPath;
import edu.umass.cs.msocket.MSocket;
import edu.umass.cs.msocket.mobility.MobilityManagerClient;

import java.io.InputStream;
import java.io.OutputStream;
import java.net.InetAddress;
import java.nio.ByteBuffer;
import java.text.DecimalFormat;
import java.util.Arrays;

public class MSocketClient implements Runnable {


private static final int LOCAL_PORT = 5556;
private static final String LOCALHOST = "127.0.0.1";
private static DecimalFormat df = new DecimalFormat("0.00##");
private static final int TOTAL_ROUND = 100;
private static int numBytes = 64000000;

public static Long calc_median(Long[] input){
Arrays.sort(input);
Long median;
if (input.length % 2 == 0)
median = ((long)input[input.length/2] + (long)input[input.length/2 - 1])/2;
else
median = (long) input[input.length/2];
return median;
}
public static Long calc_avg(Long[] input){
int len = input.length;
Long sum = 0L;
for(int i=0;i<len;i++){
sum = sum + input[i];
}
return sum/len;
}
public MSocketClient(){

}
public void run(){

String serverIPOrName = LOCALHOST;
int serverPort = LOCAL_PORT;
int numRound = TOTAL_ROUND;
int numOfBytes= numBytes;
long median_time = 0;

try{
MSocket ms = new MSocket(InetAddress.getByName(serverIPOrName), serverPort);
OutputStream os = ms.getOutputStream();
InputStream is = ms.getInputStream();
try {
Thread.sleep(2000); // wait for 2 seconds for all connections
} catch (InterruptedException e) {
e.printStackTrace();
}

int current_round = 0;
Long[] transferTime = new Long[numRound];
while (current_round < numRound) {
int numSent = numOfBytes;
byte[] b = new byte[numSent];
ByteBuffer dbuf = ByteBuffer.allocate(4);
dbuf.putInt(numSent);
byte[] bytes = dbuf.array();
int numRead;
int totalRead = 0;
long start = System.currentTimeMillis();
os.write(bytes);
do {
numRead = is.read(b);
if (numRead >= 0)
totalRead += numRead;

} while (totalRead < numSent);

long elapsed = System.currentTimeMillis() - start;
transferTime[current_round] = elapsed;
current_round++;
}

os.write(-1);
os.flush();

median_time = calc_avg(transferTime);
System.out.println(median_time);
ms.close();


return;

}catch(Exception e){
e.printStackTrace();
}



}
}
108 changes: 108 additions & 0 deletions scripts/MSocketServer.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
import edu.umass.cs.msocket.MServerSocket;
import edu.umass.cs.msocket.MSocket;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.nio.ByteBuffer;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Random;
import java.util.Scanner;

public class MSocketServer implements Runnable{

private static final int LOCAL_PORT = 5556;
private static final String LOCALHOST = "127.0.0.1";
private static MServerSocket mss = null;
static DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm:ss");

public MSocketServer(){

}
public void run(){
String serverIPOrName = LOCALHOST;
int serverPort = LOCAL_PORT;
try{
mss = new MServerSocket(serverPort, 0, InetAddress.getByName(serverIPOrName));
MSocket msocket = mss.accept();
RequestHandlingThread requestThread = new RequestHandlingThread(msocket);
requestThread.start();
}catch(IOException e){
e.printStackTrace();
}
}

private static class RequestHandlingThread extends Thread
{
private MSocket msocket;

public RequestHandlingThread(MSocket msocket)
{
this.msocket = msocket;
}

public void run()
{
int numRead = 0;
Scanner reader = new Scanner(System.in);
InputStream is = null;
OutputStream os = null;
try {
is = msocket.getInputStream();
os = msocket.getOutputStream();
} catch (IOException e) {
e.printStackTrace();
}
if(is != null) {


while(numRead >= 0) {
long start = System.currentTimeMillis();


byte[] numByteArr = new byte[8];
try {

is.read(numByteArr);
ByteBuffer wrapped = ByteBuffer.wrap(numByteArr);
numRead = wrapped.getInt();
} catch (IOException e) {
e.printStackTrace();
}
if (numRead > 0) {


byte[] b = new byte[numRead];
new Random().nextBytes(b);

try {
os.write(b);
os.flush();
} catch (IOException e) {
e.printStackTrace();
}
// reset
b = null;
numRead = 0;
long elapsed = System.currentTimeMillis() - start;
LocalDateTime now = LocalDateTime.now();

}

}

try {
msocket.close();
System.exit(0);
} catch (IOException e) {
e.printStackTrace();
}

}


}
}
}
105 changes: 105 additions & 0 deletions scripts/TCPClient.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
import java.io.InputStream;
import java.io.OutputStream;
import java.net.InetAddress;
import java.nio.ByteBuffer;
import java.text.DecimalFormat;
import java.io.*;
import java.net.*;
import java.lang.*;
import java.nio.*;
import java.util.Arrays;


public class TCPClient implements Runnable{


private static final int LOCAL_PORT = 5455;
private static final String LOCALHOST = "127.0.0.1";
private static final DecimalFormat df = new DecimalFormat("0.00##");
private static final int TOTAL_ROUND = 100;
private static final int numBytes = 64000000;

public TCPClient(){

}
public static Long calc_avg(Long[] input){
int len = input.length;
Long sum = 0L;
for(int i=0;i<len;i++){
sum = sum + input[i];
}
return sum/len;
}
public static Long calc_median(Long[] input){
Arrays.sort(input);
Long median;
if (input.length % 2 == 0)
median = ((long)input[input.length/2] + (long)input[input.length/2 - 1])/2;
else
median = (long) input[input.length/2];
return median;
}
public void run(){
String serverIPOrName = LOCALHOST;
int serverPort = LOCAL_PORT;
int numRound = TOTAL_ROUND;
int numOfBytes= numBytes;
long median_time = 0;

try {

Socket socket = null;
socket = new Socket(serverIPOrName,serverPort);
OutputStream os = socket.getOutputStream();
InputStream is = socket.getInputStream();
// wait for 2 seconds for all connections
try {
Thread.sleep(2000);
} catch (InterruptedException e) {
e.printStackTrace();
}

int current_round = 0;
Long[] transferTime = new Long[numRound];
while (current_round < numRound) {
int numSent = numOfBytes;

byte[] b = new byte[numSent];
ByteBuffer dbuf = ByteBuffer.allocate(4);
dbuf.putInt(numSent);
byte[] bytes = dbuf.array();
int numRead;
int totalRead = 0;
long start = System.currentTimeMillis();
os.write(bytes);
do {
numRead = is.read(b);
if (numRead >= 0)
totalRead += numRead;

} while (totalRead < numSent);

long elapsed = System.currentTimeMillis() - start;


transferTime[current_round] = elapsed;
current_round++;
}

os.write(-1);
os.flush();

median_time = calc_avg(transferTime);
System.out.println(median_time);
socket.close();

} catch (Exception e) {
e.printStackTrace();
}




}

}
Loading