fixed rx end for new binaries
This commit is contained in:
parent
99d73ad3ea
commit
62b08e13c2
|
|
@ -30,7 +30,7 @@ import java.util.Date;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
public class MainActivity extends Activity {
|
public class MainActivity extends Activity {
|
||||||
// unchanged stuff
|
// tmp fixed
|
||||||
protected static final String remoteIP = "128.111.68.220";
|
protected static final String remoteIP = "128.111.68.220";
|
||||||
protected static final String remoteMAC = "18:03:73:c8:86:52";
|
protected static final String remoteMAC = "18:03:73:c8:86:52";
|
||||||
protected static final String sshlinklab = "ssh linklab@hotcrp.cs.ucsb.edu"
|
protected static final String sshlinklab = "ssh linklab@hotcrp.cs.ucsb.edu"
|
||||||
|
|
@ -38,6 +38,7 @@ public class MainActivity extends Activity {
|
||||||
protected static final String sshlinklablocal = "ssh linklab@" + remoteIP
|
protected static final String sshlinklablocal = "ssh linklab@" + remoteIP
|
||||||
+ " -i /data/.ssh/id_rsa -o StrictHostKeyChecking=no";
|
+ " -i /data/.ssh/id_rsa -o StrictHostKeyChecking=no";
|
||||||
protected static final String udpserver_pathport = "~/mobileRDMABeach/UDPServer 32000 ";
|
protected static final String udpserver_pathport = "~/mobileRDMABeach/UDPServer 32000 ";
|
||||||
|
// unchanged stuff
|
||||||
protected static final String binaryFolderPath = "/data/local/tmp/";
|
protected static final String binaryFolderPath = "/data/local/tmp/";
|
||||||
protected static final String binary_tcpdump = "tcpdump";
|
protected static final String binary_tcpdump = "tcpdump";
|
||||||
private static final String TAG = "MainActivity";
|
private static final String TAG = "MainActivity";
|
||||||
|
|
@ -135,9 +136,7 @@ public class MainActivity extends Activity {
|
||||||
Runtime.getRuntime().exec("su -c killall -9 " + binary_RX_NormalUDP).waitFor();
|
Runtime.getRuntime().exec("su -c killall -9 " + binary_RX_NormalUDP).waitFor();
|
||||||
Runtime.getRuntime().exec("su -c killall -9 " + binary_RX_Splice).waitFor();
|
Runtime.getRuntime().exec("su -c killall -9 " + binary_RX_Splice).waitFor();
|
||||||
Runtime.getRuntime().exec("su -c killall -9 " + binary_RX_RawNormal).waitFor();
|
Runtime.getRuntime().exec("su -c killall -9 " + binary_RX_RawNormal).waitFor();
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException | IOException e) {
|
||||||
e.printStackTrace();
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -196,7 +195,7 @@ public class MainActivity extends Activity {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* start the record
|
* start the record
|
||||||
* @param myflag
|
* @param myflag:
|
||||||
*/
|
*/
|
||||||
protected void startRecording(boolean myflag) {
|
protected void startRecording(boolean myflag) {
|
||||||
final boolean flagRecv = myflag;
|
final boolean flagRecv = myflag;
|
||||||
|
|
@ -275,9 +274,7 @@ public class MainActivity extends Activity {
|
||||||
Runtime.getRuntime().exec(
|
Runtime.getRuntime().exec(
|
||||||
"su -c echo 0 > /sys/class/lcd/panel/lcd_power")
|
"su -c echo 0 > /sys/class/lcd/panel/lcd_power")
|
||||||
.waitFor();
|
.waitFor();
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException | IOException e) {
|
||||||
e.printStackTrace();
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
myHandler.post(new Runnable() {
|
myHandler.post(new Runnable() {
|
||||||
|
|
@ -311,9 +308,7 @@ public class MainActivity extends Activity {
|
||||||
// }
|
// }
|
||||||
// });
|
// });
|
||||||
// }
|
// }
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException | IOException e) {
|
||||||
e.printStackTrace();
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
// start iteration
|
// start iteration
|
||||||
|
|
|
||||||
|
|
@ -2,71 +2,105 @@ package edu.ucsb.cs.sandlab.offloadingdemo;
|
||||||
|
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
|
import java.io.BufferedReader;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by yanzi on 9/18/15.
|
* Created by yanzi on 9/18/15.
|
||||||
|
* Updated on 01/31/17
|
||||||
*/
|
*/
|
||||||
public class Thread_RX_CNormal implements Runnable {
|
|
||||||
|
class Thread_RX_CNormal implements Runnable {
|
||||||
|
private double recvBytes = 0.0;
|
||||||
|
private double duration = 0.0;
|
||||||
|
private double throughput = 0.0;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
|
||||||
|
// prevent multiple runs
|
||||||
if (MainActivity.isRunning_RX_Normal)
|
if (MainActivity.isRunning_RX_Normal)
|
||||||
return;
|
return;
|
||||||
if (MainActivity.isVerbose)
|
|
||||||
Log.d("RX_Normal", "Start RX Normal");
|
|
||||||
MainActivity.isRunning_RX_Normal = true;
|
MainActivity.isRunning_RX_Normal = true;
|
||||||
|
|
||||||
|
// variables
|
||||||
Process proc;
|
Process proc;
|
||||||
|
String stdout;
|
||||||
|
BufferedReader stdout_buf, error_buf;
|
||||||
String[] commd = new String[3];
|
String[] commd = new String[3];
|
||||||
|
|
||||||
|
// get the right command
|
||||||
commd[0] = "su";
|
commd[0] = "su";
|
||||||
commd[1] = "-c";
|
commd[1] = "-c";
|
||||||
|
// ./client_recv_normaltcp <ip> <port>
|
||||||
|
// <[optional] recvsize (bytes)> <[optional] filepath>
|
||||||
commd[2] = (MainActivity.isForcingCPU0?"taskset 1 ":"")
|
commd[2] = (MainActivity.isForcingCPU0?"taskset 1 ":"")
|
||||||
+ MainActivity.binaryFolderPath + MainActivity.binary_RX_Normal + " "
|
+ MainActivity.binaryFolderPath + MainActivity.binary_RX_Normal
|
||||||
+ MainActivity.bytes2send + " " + MainActivity.RXportNum;
|
+ " " + (MainActivity.isLocal ? Utilities.myInetIP : MainActivity.remoteIP)
|
||||||
|
+ " " + MainActivity.RXportNum
|
||||||
|
+ " " + MainActivity.bytes2send;
|
||||||
|
|
||||||
|
Log.d("RX_Normal", "Start RX Normal");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
// run process
|
||||||
proc = Runtime.getRuntime().exec(commd);
|
proc = Runtime.getRuntime().exec(commd);
|
||||||
|
|
||||||
|
// if config to log per process
|
||||||
while (MainActivity.isLoggingPerProcPID && MainActivity.perProcPID == -1) {
|
while (MainActivity.isLoggingPerProcPID && MainActivity.perProcPID == -1) {
|
||||||
MainActivity.perProcPID = Utilities.getMyPID(MainActivity.binary_RX_Normal, false);
|
MainActivity.perProcPID = Utilities.getMyPID(MainActivity.binary_RX_Splice, false);
|
||||||
}
|
}
|
||||||
proc.waitFor();
|
proc.waitFor();
|
||||||
InputStream stdout = proc.getInputStream();
|
|
||||||
byte[] buffer = new byte[20];
|
// read error
|
||||||
int read;
|
error_buf = new BufferedReader(new InputStreamReader(
|
||||||
StringBuilder out = new StringBuilder();
|
proc.getErrorStream()));
|
||||||
while(true){
|
final String error = error_buf.readLine(); // only one line error
|
||||||
read = stdout.read(buffer);
|
|
||||||
if(read<0){
|
// read std out
|
||||||
|
stdout_buf = new BufferedReader(new InputStreamReader(
|
||||||
|
proc.getInputStream()));
|
||||||
|
|
||||||
|
// get received bytes
|
||||||
|
stdout = stdout_buf.readLine();
|
||||||
|
if (stdout == null) {
|
||||||
|
// error happens
|
||||||
MainActivity.myHandler.post(new Runnable() {
|
MainActivity.myHandler.post(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
MainActivity.txt_results.append("Failed in RX_Normal at port " + MainActivity.RXportNum + "\n");
|
MainActivity.txt_results.append("Err in RX_Normal: " + error + "\n");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
break;
|
} else {
|
||||||
}
|
// sent bytes
|
||||||
out.append(new String(buffer, 0, read));
|
recvBytes = Utilities.parseBinOutput(stdout);
|
||||||
if(read<20){
|
|
||||||
break;
|
// duration
|
||||||
}
|
stdout = stdout_buf.readLine();
|
||||||
}
|
duration = Utilities.parseBinOutput(stdout);
|
||||||
final String mOut = out.toString().trim();
|
MainActivity.reportedFinishTime = duration;
|
||||||
MainActivity.reportedFinishTime = Double.parseDouble(mOut);
|
|
||||||
if (MainActivity.isVerbose) {
|
if (MainActivity.isVerbose) {
|
||||||
Log.d("Thread_RX_CNormal", mOut + "ms");
|
|
||||||
MainActivity.myHandler.post(new Runnable() {
|
MainActivity.myHandler.post(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
MainActivity.txt_results.append("Time: " + mOut + "ms\n");
|
MainActivity.txt_results.append("Time: " + duration + "ms\n");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
// throughput
|
||||||
} catch (InterruptedException e) {
|
stdout = stdout_buf.readLine();
|
||||||
|
throughput = Utilities.parseBinOutput(stdout);
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (IOException | InterruptedException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
if (MainActivity.isVerbose)
|
|
||||||
Log.d("RX_Normal", "Stop RX Normal");
|
Log.d("RX_Normal", "Stop RX Normal");
|
||||||
|
|
||||||
MainActivity.isRunning_RX_Normal = false;
|
MainActivity.isRunning_RX_Normal = false;
|
||||||
MainActivity.perProcPID = -1;
|
MainActivity.perProcPID = -1;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,74 +2,105 @@ package edu.ucsb.cs.sandlab.offloadingdemo;
|
||||||
|
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
|
import java.io.BufferedReader;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by yanzi on 9/18/15.
|
* Created by yanzi on 9/18/15.
|
||||||
|
* Updated on 01/31/17
|
||||||
*/
|
*/
|
||||||
public class Thread_RX_CNormalUDP implements Runnable {
|
|
||||||
|
class Thread_RX_CNormalUDP implements Runnable {
|
||||||
|
private double recvBytes = 0.0;
|
||||||
|
private double duration = 0.0;
|
||||||
|
private double throughput = 0.0;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
|
||||||
|
// prevent multiple runs
|
||||||
if (MainActivity.isRunning_RX_NormalUDP)
|
if (MainActivity.isRunning_RX_NormalUDP)
|
||||||
return;
|
return;
|
||||||
if (MainActivity.isVerbose)
|
|
||||||
Log.d("RX_NormalUDP", "Start RX NormalUDP");
|
|
||||||
MainActivity.isRunning_RX_NormalUDP = true;
|
MainActivity.isRunning_RX_NormalUDP = true;
|
||||||
|
|
||||||
|
// variables
|
||||||
Process proc;
|
Process proc;
|
||||||
|
String stdout;
|
||||||
|
BufferedReader stdout_buf, error_buf;
|
||||||
String[] commd = new String[3];
|
String[] commd = new String[3];
|
||||||
|
|
||||||
|
// get the right command
|
||||||
commd[0] = "su";
|
commd[0] = "su";
|
||||||
commd[1] = "-c";
|
commd[1] = "-c";
|
||||||
|
// ./client_recv_normaludp <ip> <port>
|
||||||
|
// <[optional] recvsize (bytes)> <[optional] filepath>
|
||||||
commd[2] = (MainActivity.isForcingCPU0?"taskset 1 ":"")
|
commd[2] = (MainActivity.isForcingCPU0?"taskset 1 ":"")
|
||||||
+ MainActivity.binaryFolderPath + MainActivity.binary_RX_NormalUDP + " "
|
+ MainActivity.binaryFolderPath + MainActivity.binary_RX_Normal
|
||||||
+ MainActivity.bytes2send + " 32000";
|
+ " " + (MainActivity.isLocal ? Utilities.myInetIP : MainActivity.remoteIP)
|
||||||
|
+ " " + MainActivity.RXportNum
|
||||||
|
+ " " + MainActivity.bytes2send;
|
||||||
|
|
||||||
|
Log.d("RX_NormalUDP", "Start RX NormalUDP");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
// run process
|
||||||
proc = Runtime.getRuntime().exec(commd);
|
proc = Runtime.getRuntime().exec(commd);
|
||||||
|
|
||||||
|
// if config to log per process
|
||||||
while (MainActivity.isLoggingPerProcPID && MainActivity.perProcPID == -1) {
|
while (MainActivity.isLoggingPerProcPID && MainActivity.perProcPID == -1) {
|
||||||
MainActivity.perProcPID = Utilities.getMyPID(MainActivity.binary_RX_NormalUDP, false);
|
MainActivity.perProcPID = Utilities.getMyPID(MainActivity.binary_RX_Splice, false);
|
||||||
}
|
}
|
||||||
proc.waitFor();
|
proc.waitFor();
|
||||||
InputStream stdout = proc.getInputStream();
|
|
||||||
byte[] buffer = new byte[20];
|
// read error
|
||||||
int read;
|
error_buf = new BufferedReader(new InputStreamReader(
|
||||||
StringBuilder out = new StringBuilder();
|
proc.getErrorStream()));
|
||||||
while(true){
|
final String error = error_buf.readLine(); // only one line error
|
||||||
read = stdout.read(buffer);
|
|
||||||
if(read<0){
|
// read std out
|
||||||
|
stdout_buf = new BufferedReader(new InputStreamReader(
|
||||||
|
proc.getInputStream()));
|
||||||
|
|
||||||
|
// get received bytes
|
||||||
|
stdout = stdout_buf.readLine();
|
||||||
|
if (stdout == null) {
|
||||||
|
// error happens
|
||||||
MainActivity.myHandler.post(new Runnable() {
|
MainActivity.myHandler.post(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
MainActivity.txt_results.append("Failed in RX_NormalUDP at port 32000\n");
|
MainActivity.txt_results.append("Err in RX_NormalUDP: " + error + "\n");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
break;
|
} else {
|
||||||
}
|
// sent bytes
|
||||||
out.append(new String(buffer, 0, read));
|
recvBytes = Utilities.parseBinOutput(stdout);
|
||||||
if(read<20){
|
|
||||||
break;
|
// duration
|
||||||
}
|
stdout = stdout_buf.readLine();
|
||||||
}
|
duration = Utilities.parseBinOutput(stdout);
|
||||||
if (out.length() > 0) {
|
MainActivity.reportedFinishTime = duration;
|
||||||
MainActivity.UDPfinishTime = (int)Float.parseFloat(out.toString().trim());
|
|
||||||
}
|
|
||||||
final String mOut = out.toString().trim();
|
|
||||||
MainActivity.reportedFinishTime = Double.parseDouble(mOut);
|
|
||||||
if (MainActivity.isVerbose) {
|
if (MainActivity.isVerbose) {
|
||||||
Log.d("Thread_RX_CNormalUDP", mOut + "ms");
|
|
||||||
MainActivity.myHandler.post(new Runnable() {
|
MainActivity.myHandler.post(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
MainActivity.txt_results.append("Time: " + mOut + "ms\n");
|
MainActivity.txt_results.append("Time: " + duration + "ms\n");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
// throughput
|
||||||
} catch (InterruptedException e) {
|
stdout = stdout_buf.readLine();
|
||||||
|
throughput = Utilities.parseBinOutput(stdout);
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (IOException | InterruptedException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
if (MainActivity.isVerbose)
|
|
||||||
Log.d("RX_NormalUDP", "Stop RX NormalUDP");
|
Log.d("RX_NormalUDP", "Stop RX NormalUDP");
|
||||||
|
|
||||||
MainActivity.isRunning_RX_NormalUDP = false;
|
MainActivity.isRunning_RX_NormalUDP = false;
|
||||||
MainActivity.perProcPID = -1;
|
MainActivity.perProcPID = -1;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,74 +2,105 @@ package edu.ucsb.cs.sandlab.offloadingdemo;
|
||||||
|
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
|
import java.io.BufferedReader;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by yanzi on 9/18/15.
|
* Created by yanzi on 9/18/15.
|
||||||
|
* Updated on 01/31/17
|
||||||
*/
|
*/
|
||||||
public class Thread_RX_CRawNormal implements Runnable {
|
|
||||||
|
class Thread_RX_CRawNormal implements Runnable {
|
||||||
|
private double recvBytes = 0.0;
|
||||||
|
private double duration = 0.0;
|
||||||
|
private double throughput = 0.0;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
|
||||||
|
// prevent multiple runs
|
||||||
if (MainActivity.isRunning_RX_RawNormal)
|
if (MainActivity.isRunning_RX_RawNormal)
|
||||||
return;
|
return;
|
||||||
if (MainActivity.isVerbose)
|
|
||||||
Log.d("RX_RawNormal", "Start RX RawNormal");
|
|
||||||
MainActivity.isRunning_RX_RawNormal = true;
|
MainActivity.isRunning_RX_RawNormal = true;
|
||||||
|
|
||||||
|
// variables
|
||||||
Process proc;
|
Process proc;
|
||||||
|
String stdout;
|
||||||
|
BufferedReader stdout_buf, error_buf;
|
||||||
String[] commd = new String[3];
|
String[] commd = new String[3];
|
||||||
|
|
||||||
|
// get the right command
|
||||||
commd[0] = "su";
|
commd[0] = "su";
|
||||||
commd[1] = "-c";
|
commd[1] = "-c";
|
||||||
|
// ./client_recv_bypassl3 <ip> <port>
|
||||||
|
// <[optional] recvsize (bytes)> <[optional] interface> <[optional] filepath>
|
||||||
commd[2] = (MainActivity.isForcingCPU0?"taskset 1 ":"")
|
commd[2] = (MainActivity.isForcingCPU0?"taskset 1 ":"")
|
||||||
+ MainActivity.binaryFolderPath + MainActivity.binary_RX_RawNormal + " "
|
+ MainActivity.binaryFolderPath + MainActivity.binary_RX_RawNormal
|
||||||
+ MainActivity.bytes2send;
|
+ " " + (MainActivity.isLocal ? Utilities.myInetIP : MainActivity.remoteIP)
|
||||||
|
+ " " + MainActivity.RXportNum
|
||||||
|
+ " " + MainActivity.bytes2send;
|
||||||
|
|
||||||
|
Log.d("RX_RawNormal", "Start RX RawNormal");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
// run process
|
||||||
proc = Runtime.getRuntime().exec(commd);
|
proc = Runtime.getRuntime().exec(commd);
|
||||||
|
|
||||||
|
// if config to log per process
|
||||||
while (MainActivity.isLoggingPerProcPID && MainActivity.perProcPID == -1) {
|
while (MainActivity.isLoggingPerProcPID && MainActivity.perProcPID == -1) {
|
||||||
MainActivity.perProcPID = Utilities.getMyPID(MainActivity.binary_RX_RawNormal, false);
|
MainActivity.perProcPID = Utilities.getMyPID(MainActivity.binary_RX_Splice, false);
|
||||||
}
|
}
|
||||||
proc.waitFor();
|
proc.waitFor();
|
||||||
InputStream stdout = proc.getInputStream();
|
|
||||||
byte[] buffer = new byte[20];
|
// read error
|
||||||
int read;
|
error_buf = new BufferedReader(new InputStreamReader(
|
||||||
StringBuilder out = new StringBuilder();
|
proc.getErrorStream()));
|
||||||
while(true){
|
final String error = error_buf.readLine(); // only one line error
|
||||||
read = stdout.read(buffer);
|
|
||||||
if(read<0){
|
// read std out
|
||||||
|
stdout_buf = new BufferedReader(new InputStreamReader(
|
||||||
|
proc.getInputStream()));
|
||||||
|
|
||||||
|
// get received bytes
|
||||||
|
stdout = stdout_buf.readLine();
|
||||||
|
if (stdout == null) {
|
||||||
|
// error happens
|
||||||
MainActivity.myHandler.post(new Runnable() {
|
MainActivity.myHandler.post(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
MainActivity.txt_results.append("Failed in RX_RawNormal at port " + MainActivity.RXportNum + "\n");
|
MainActivity.txt_results.append("Err in RX_RawNormal: " + error + "\n");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
break;
|
} else {
|
||||||
}
|
// sent bytes
|
||||||
out.append(new String(buffer, 0, read));
|
recvBytes = Utilities.parseBinOutput(stdout);
|
||||||
if(read<20){
|
|
||||||
break;
|
// duration
|
||||||
}
|
stdout = stdout_buf.readLine();
|
||||||
}
|
duration = Utilities.parseBinOutput(stdout);
|
||||||
if (out.length() > 0) {
|
MainActivity.reportedFinishTime = duration;
|
||||||
MainActivity.UDPfinishTime = (int)Float.parseFloat(out.toString().trim());
|
|
||||||
}
|
|
||||||
final String mOut = out.toString().trim();
|
|
||||||
MainActivity.reportedFinishTime = Double.parseDouble(mOut);
|
|
||||||
if (MainActivity.isVerbose) {
|
if (MainActivity.isVerbose) {
|
||||||
Log.d("Thread_RX_CRawNormal", mOut + "ms");
|
|
||||||
MainActivity.myHandler.post(new Runnable() {
|
MainActivity.myHandler.post(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
MainActivity.txt_results.append("Time: " + mOut + "ms\n");
|
MainActivity.txt_results.append("Time: " + duration + "ms\n");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
// throughput
|
||||||
} catch (InterruptedException e) {
|
stdout = stdout_buf.readLine();
|
||||||
|
throughput = Utilities.parseBinOutput(stdout);
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (IOException | InterruptedException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
if (MainActivity.isVerbose)
|
|
||||||
Log.d("RX_RawNormal", "Stop RX RawNormal");
|
Log.d("RX_RawNormal", "Stop RX RawNormal");
|
||||||
|
|
||||||
MainActivity.isRunning_RX_RawNormal = false;
|
MainActivity.isRunning_RX_RawNormal = false;
|
||||||
MainActivity.perProcPID = -1;
|
MainActivity.perProcPID = -1;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,71 +2,106 @@ package edu.ucsb.cs.sandlab.offloadingdemo;
|
||||||
|
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
|
import java.io.BufferedReader;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by yanzi on 9/18/15.
|
* Created by yanzi on 9/18/15.
|
||||||
|
* Updated on 01/31/17
|
||||||
*/
|
*/
|
||||||
public class Thread_RX_CSendfile implements Runnable {
|
|
||||||
|
class Thread_RX_CSendfile implements Runnable {
|
||||||
|
private double recvBytes = 0.0;
|
||||||
|
private double duration = 0.0;
|
||||||
|
private double throughput = 0.0;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
|
||||||
|
// prevent multiple runs
|
||||||
if (MainActivity.isRunning_RX_Sendfile)
|
if (MainActivity.isRunning_RX_Sendfile)
|
||||||
return;
|
return;
|
||||||
if (MainActivity.isVerbose)
|
|
||||||
Log.d("RX_Sendfile", "Start RX Sendfile");
|
|
||||||
MainActivity.isRunning_RX_Sendfile = true;
|
MainActivity.isRunning_RX_Sendfile = true;
|
||||||
|
|
||||||
|
// variables
|
||||||
Process proc;
|
Process proc;
|
||||||
|
String stdout;
|
||||||
|
BufferedReader stdout_buf, error_buf;
|
||||||
String[] commd = new String[3];
|
String[] commd = new String[3];
|
||||||
|
|
||||||
|
// get the right command
|
||||||
commd[0] = "su";
|
commd[0] = "su";
|
||||||
commd[1] = "-c";
|
commd[1] = "-c";
|
||||||
|
// ./client_recv_normaltcp_sendfile <ip> <port>
|
||||||
|
// <[optional] recvsize (bytes)> <[optional] filepath>
|
||||||
commd[2] = (MainActivity.isForcingCPU0?"taskset 1 ":"")
|
commd[2] = (MainActivity.isForcingCPU0?"taskset 1 ":"")
|
||||||
+ MainActivity.binaryFolderPath + MainActivity.binary_RX_Sendfile + " "
|
+ MainActivity.binaryFolderPath + MainActivity.binary_RX_Sendfile
|
||||||
+ MainActivity.bytes2send + " " + MainActivity.RXportNum;
|
+ " " + (MainActivity.isLocal ? Utilities.myInetIP : MainActivity.remoteIP)
|
||||||
|
+ " " + MainActivity.RXportNum
|
||||||
|
+ " " + MainActivity.bytes2send;
|
||||||
|
|
||||||
|
|
||||||
|
Log.d("RX_Sendfile", "Start RX Sendfile");
|
||||||
try {
|
try {
|
||||||
|
// run process
|
||||||
proc = Runtime.getRuntime().exec(commd);
|
proc = Runtime.getRuntime().exec(commd);
|
||||||
|
|
||||||
|
// if config to log per process
|
||||||
while (MainActivity.isLoggingPerProcPID && MainActivity.perProcPID == -1) {
|
while (MainActivity.isLoggingPerProcPID && MainActivity.perProcPID == -1) {
|
||||||
MainActivity.perProcPID = Utilities.getMyPID(MainActivity.binary_RX_Sendfile, false);
|
MainActivity.perProcPID = Utilities.getMyPID(MainActivity.binary_RX_Splice, false);
|
||||||
}
|
}
|
||||||
proc.waitFor();
|
proc.waitFor();
|
||||||
InputStream stdout = proc.getInputStream();
|
|
||||||
byte[] buffer = new byte[20];
|
// read error
|
||||||
int read;
|
error_buf = new BufferedReader(new InputStreamReader(
|
||||||
StringBuilder out = new StringBuilder();
|
proc.getErrorStream()));
|
||||||
while(true){
|
final String error = error_buf.readLine(); // only one line error
|
||||||
read = stdout.read(buffer);
|
|
||||||
if(read<0){
|
// read std out
|
||||||
|
stdout_buf = new BufferedReader(new InputStreamReader(
|
||||||
|
proc.getInputStream()));
|
||||||
|
|
||||||
|
// get received bytes
|
||||||
|
stdout = stdout_buf.readLine();
|
||||||
|
if (stdout == null) {
|
||||||
|
// error happens
|
||||||
MainActivity.myHandler.post(new Runnable() {
|
MainActivity.myHandler.post(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
MainActivity.txt_results.append("Failed in RX_Sendfile at port " + MainActivity.RXportNum + "\n");
|
MainActivity.txt_results.append(
|
||||||
|
"Err in RX_Normal_Sendfile: " + error + "\n");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
break;
|
} else {
|
||||||
}
|
// sent bytes
|
||||||
out.append(new String(buffer, 0, read));
|
recvBytes = Utilities.parseBinOutput(stdout);
|
||||||
if(read<20){
|
|
||||||
break;
|
// duration
|
||||||
}
|
stdout = stdout_buf.readLine();
|
||||||
}
|
duration = Utilities.parseBinOutput(stdout);
|
||||||
final String mOut = out.toString().trim();
|
MainActivity.reportedFinishTime = duration;
|
||||||
MainActivity.reportedFinishTime = Double.parseDouble(mOut);
|
|
||||||
if (MainActivity.isVerbose) {
|
if (MainActivity.isVerbose) {
|
||||||
Log.d("Thread_RX_CSendfile", mOut + "ms");
|
|
||||||
MainActivity.myHandler.post(new Runnable() {
|
MainActivity.myHandler.post(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
MainActivity.txt_results.append("Time: " + mOut + "ms\n");
|
MainActivity.txt_results.append("Time: " + duration + "ms\n");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
// throughput
|
||||||
} catch (InterruptedException e) {
|
stdout = stdout_buf.readLine();
|
||||||
|
throughput = Utilities.parseBinOutput(stdout);
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (IOException | InterruptedException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
if (MainActivity.isVerbose)
|
|
||||||
Log.d("RX_Sendfile", "Stop RX Sendfile");
|
Log.d("RX_Sendfile", "Stop RX Sendfile");
|
||||||
|
|
||||||
MainActivity.isRunning_RX_Sendfile = false;
|
MainActivity.isRunning_RX_Sendfile = false;
|
||||||
MainActivity.perProcPID = -1;
|
MainActivity.perProcPID = -1;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,71 +2,104 @@ package edu.ucsb.cs.sandlab.offloadingdemo;
|
||||||
|
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
|
import java.io.BufferedReader;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by yanzi on 9/18/15.
|
* Created by yanzi on 9/18/15.
|
||||||
|
* Updated on 01/31/17
|
||||||
*/
|
*/
|
||||||
public class Thread_RX_CSplice implements Runnable {
|
|
||||||
|
class Thread_RX_CSplice implements Runnable {
|
||||||
|
private double recvBytes = 0.0;
|
||||||
|
private double duration = 0.0;
|
||||||
|
private double throughput = 0.0;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
|
||||||
|
// prevent multiple runs
|
||||||
if (MainActivity.isRunning_RX_Splice)
|
if (MainActivity.isRunning_RX_Splice)
|
||||||
return;
|
return;
|
||||||
if (MainActivity.isVerbose)
|
|
||||||
Log.d("RX_Splicee", "Start RX Splice");
|
|
||||||
MainActivity.isRunning_RX_Splice = true;
|
MainActivity.isRunning_RX_Splice = true;
|
||||||
|
|
||||||
|
// variables
|
||||||
Process proc;
|
Process proc;
|
||||||
|
String stdout;
|
||||||
|
BufferedReader stdout_buf, error_buf;
|
||||||
String[] commd = new String[3];
|
String[] commd = new String[3];
|
||||||
|
|
||||||
|
// get the right command
|
||||||
commd[0] = "su";
|
commd[0] = "su";
|
||||||
commd[1] = "-c";
|
commd[1] = "-c";
|
||||||
|
// ./client_recv_normaltcp_splice <ip> <port>
|
||||||
|
// <[optional] recvsize (bytes)> <[optional] filepath>
|
||||||
commd[2] = (MainActivity.isForcingCPU0?"taskset 1 ":"")
|
commd[2] = (MainActivity.isForcingCPU0?"taskset 1 ":"")
|
||||||
+ MainActivity.binaryFolderPath + MainActivity.binary_RX_Splice + " "
|
+ MainActivity.binaryFolderPath + MainActivity.binary_RX_Splice
|
||||||
+ MainActivity.bytes2send + " " + MainActivity.RXportNum;
|
+ " " + (MainActivity.isLocal ? Utilities.myInetIP : MainActivity.remoteIP)
|
||||||
|
+ " " + MainActivity.RXportNum
|
||||||
|
+ " " + MainActivity.bytes2send;
|
||||||
|
|
||||||
|
Log.d("RX_Splice", "Start RX Splice");
|
||||||
try {
|
try {
|
||||||
|
// run process
|
||||||
proc = Runtime.getRuntime().exec(commd);
|
proc = Runtime.getRuntime().exec(commd);
|
||||||
|
|
||||||
|
// if config to log per process
|
||||||
while (MainActivity.isLoggingPerProcPID && MainActivity.perProcPID == -1) {
|
while (MainActivity.isLoggingPerProcPID && MainActivity.perProcPID == -1) {
|
||||||
MainActivity.perProcPID = Utilities.getMyPID(MainActivity.binary_RX_Splice, false);
|
MainActivity.perProcPID = Utilities.getMyPID(MainActivity.binary_RX_Splice, false);
|
||||||
}
|
}
|
||||||
proc.waitFor();
|
proc.waitFor();
|
||||||
InputStream stdout = proc.getInputStream();
|
|
||||||
byte[] buffer = new byte[20];
|
// read error
|
||||||
int read;
|
error_buf = new BufferedReader(new InputStreamReader(
|
||||||
StringBuilder out = new StringBuilder();
|
proc.getErrorStream()));
|
||||||
while(true){
|
final String error = error_buf.readLine(); // only one line error
|
||||||
read = stdout.read(buffer);
|
|
||||||
if(read<0){
|
// read std out
|
||||||
|
stdout_buf = new BufferedReader(new InputStreamReader(
|
||||||
|
proc.getInputStream()));
|
||||||
|
|
||||||
|
// get received bytes
|
||||||
|
stdout = stdout_buf.readLine();
|
||||||
|
if (stdout == null) {
|
||||||
|
// error happens
|
||||||
MainActivity.myHandler.post(new Runnable() {
|
MainActivity.myHandler.post(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
MainActivity.txt_results.append("Failed in RX_Splice at port " + MainActivity.RXportNum + "\n");
|
MainActivity.txt_results.append("Err in RX_Normal_Splice: " + error + "\n");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
break;
|
} else {
|
||||||
}
|
// sent bytes
|
||||||
out.append(new String(buffer, 0, read));
|
recvBytes = Utilities.parseBinOutput(stdout);
|
||||||
if(read<20){
|
|
||||||
break;
|
// duration
|
||||||
}
|
stdout = stdout_buf.readLine();
|
||||||
}
|
duration = Utilities.parseBinOutput(stdout);
|
||||||
final String mOut = out.toString().trim();
|
MainActivity.reportedFinishTime = duration;
|
||||||
MainActivity.reportedFinishTime = Double.parseDouble(mOut);
|
|
||||||
if (MainActivity.isVerbose) {
|
if (MainActivity.isVerbose) {
|
||||||
Log.d("Thread_RX_CSplice", mOut + "ms");
|
|
||||||
MainActivity.myHandler.post(new Runnable() {
|
MainActivity.myHandler.post(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
MainActivity.txt_results.append("Time: " + mOut + "ms\n");
|
MainActivity.txt_results.append("Time: " + duration + "ms\n");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
// throughput
|
||||||
} catch (InterruptedException e) {
|
stdout = stdout_buf.readLine();
|
||||||
|
throughput = Utilities.parseBinOutput(stdout);
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (IOException | InterruptedException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
if (MainActivity.isVerbose)
|
|
||||||
Log.d("RX_Splice", "Stop RX Splice");
|
Log.d("RX_Splice", "Stop RX Splice");
|
||||||
|
|
||||||
MainActivity.isRunning_RX_Splice = false;
|
MainActivity.isRunning_RX_Splice = false;
|
||||||
MainActivity.perProcPID = -1;
|
MainActivity.perProcPID = -1;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@ class Thread_TX_CRawNormal implements Runnable {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
|
||||||
// prevent multiple runs
|
// prevent multiple runs
|
||||||
if (MainActivity.isRunning_TX_RawNormal)
|
if (MainActivity.isRunning_TX_RawNormal)
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@ class Thread_TX_CSplice implements Runnable {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
|
||||||
// prevent multiple runs
|
// prevent multiple runs
|
||||||
if (MainActivity.isRunning_TX_Splice)
|
if (MainActivity.isRunning_TX_Splice)
|
||||||
return;
|
return;
|
||||||
|
|
@ -30,8 +31,6 @@ class Thread_TX_CSplice implements Runnable {
|
||||||
BufferedReader stdout_buf, error_buf;
|
BufferedReader stdout_buf, error_buf;
|
||||||
String[] commd = new String[3];
|
String[] commd = new String[3];
|
||||||
|
|
||||||
MainActivity.isRunning_TX_Splice = true;
|
|
||||||
|
|
||||||
// get the right command
|
// get the right command
|
||||||
commd[0] = "su";
|
commd[0] = "su";
|
||||||
commd[1] = "-c";
|
commd[1] = "-c";
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue