diff --git a/OffloadingDemo/.idea/misc.xml b/OffloadingDemo/.idea/misc.xml
index 1caa136..95f0f03 100755
--- a/OffloadingDemo/.idea/misc.xml
+++ b/OffloadingDemo/.idea/misc.xml
@@ -37,7 +37,7 @@
-
+
diff --git a/OffloadingDemo/mobile/mobile.iml b/OffloadingDemo/mobile/mobile.iml
index f15575d..ae10d2d 100755
--- a/OffloadingDemo/mobile/mobile.iml
+++ b/OffloadingDemo/mobile/mobile.iml
@@ -66,14 +66,6 @@
-
-
-
-
-
-
-
-
@@ -82,6 +74,14 @@
+
+
+
+
+
+
+
+
diff --git a/OffloadingDemo/mobile/src/main/java/edu/ucsb/cs/sandlab/offloadingdemo/MainActivity.java b/OffloadingDemo/mobile/src/main/java/edu/ucsb/cs/sandlab/offloadingdemo/MainActivity.java
index ebddc27..8c0c753 100755
--- a/OffloadingDemo/mobile/src/main/java/edu/ucsb/cs/sandlab/offloadingdemo/MainActivity.java
+++ b/OffloadingDemo/mobile/src/main/java/edu/ucsb/cs/sandlab/offloadingdemo/MainActivity.java
@@ -55,7 +55,7 @@ class MainActivity extends Activity {
protected static int time_wait_for = 100; // ms
protected static int wifiDriverPID = -1;
// maintained variables
- private Button btn_startTransmit, btn_startReceive;
+ private Button btn_startTransmit, btn_startReceive, btn_measureBg;
private Button btn_setByte2send, btn_setRepeatTimes, btn_setTCPDumpInterface,
btn_clearStatus, btn_setLogFreq, btn_setOthers;
private WifiManager wm;
@@ -630,6 +630,7 @@ class MainActivity extends Activity {
txt_results = (TextView) findViewById(R.id.txt_results);
btn_startTransmit = (Button) findViewById(R.id.btn_startTransmit);
btn_startReceive = (Button) findViewById(R.id.btn_startReceive);
+ btn_measureBg = (Button) findViewById(R.id.btn_measureBg);
btn_setByte2send = (Button) findViewById(R.id.btn_setByte2send);
btn_setRepeatTimes = (Button) findViewById(R.id.btn_setRepeatTimes);
btn_setTCPDumpInterface = (Button) findViewById(R.id.btn_setTCPDumpInterface);
@@ -656,6 +657,73 @@ class MainActivity extends Activity {
startRecording(true);
}
});
+ btn_measureBg.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ new Thread(new Runnable() {
+ @Override
+ public void run() {
+ // msg indicating starting
+ myHandler.post(new Runnable() {
+ @Override
+ public void run() {
+ txt_results.append("Starting.. will come back after 1min\n");
+ }
+ });
+ // disable tcpdump
+ boolean isUsingTCPDump_backup = isUsingTCPDump;
+ isUsingTCPDump = false;
+ // change screen brightness to 0
+ Utilities.switchScreenStatus();
+
+ btn_click_time = Long.toString(
+ System.currentTimeMillis());
+ startService(intentSSLogger);
+ try {
+ Thread.sleep(60000); // sleep for 60s
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ stopService(intentSSLogger);
+ myServiceCheck();
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ // change screen back on
+ Utilities.switchScreenStatus();
+ Runtime.getRuntime().gc();
+ System.gc();
+ String tarName = "bg_measure_"
+ + (new SimpleDateFormat(
+ "yyyyMMdd_HHmmss", Locale.US)
+ .format(new Date()))
+ + ".tar.gz";
+ String[] commd = new String[3];
+ commd[0] = "su";
+ commd[1] = "&&";
+ commd[2] = "cd " + outFolderPath
+ + " && busybox tar -czf "
+ + tarName + " *.cpu *.cpuRaw *.ss";
+ try {
+ Runtime.getRuntime().exec(commd).waitFor();
+ } catch (InterruptedException | IOException e) {
+ e.printStackTrace();
+ }
+ isUsingTCPDump = isUsingTCPDump_backup;
+ // msg indicating all done
+ myHandler.post(new Runnable() {
+ @Override
+ public void run() {
+ txt_results.append("Done\n");
+ }
+ });
+ }
+ }).start();
+
+ }
+ });
btn_setByte2send.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
diff --git a/OffloadingDemo/mobile/src/main/java/edu/ucsb/cs/sandlab/offloadingdemo/SSLogger.java b/OffloadingDemo/mobile/src/main/java/edu/ucsb/cs/sandlab/offloadingdemo/SSLogger.java
index dde7b47..7368067 100755
--- a/OffloadingDemo/mobile/src/main/java/edu/ucsb/cs/sandlab/offloadingdemo/SSLogger.java
+++ b/OffloadingDemo/mobile/src/main/java/edu/ucsb/cs/sandlab/offloadingdemo/SSLogger.java
@@ -345,7 +345,7 @@ class SSLogger extends Service {
* @return string that's been parsed
*/
private static String parseProcPIDStat(String line) {
- if (line == null) return "-1 -1 -1"; // -1 means it does not exist
+ if (line == null) return "nan nan nan"; // -1 means it does not exist
String[] toks = line.split("\\s+");
long idle = Long.parseLong(toks[15]) + Long.parseLong(toks[16]);
long cpu = Long.parseLong(toks[13]) + Long.parseLong(toks[14]);
diff --git a/OffloadingDemo/mobile/src/main/java/edu/ucsb/cs/sandlab/offloadingdemo/Thread_TX_CNormalUDP.java b/OffloadingDemo/mobile/src/main/java/edu/ucsb/cs/sandlab/offloadingdemo/Thread_TX_CNormalUDP.java
index 71e2b58..94dc328 100755
--- a/OffloadingDemo/mobile/src/main/java/edu/ucsb/cs/sandlab/offloadingdemo/Thread_TX_CNormalUDP.java
+++ b/OffloadingDemo/mobile/src/main/java/edu/ucsb/cs/sandlab/offloadingdemo/Thread_TX_CNormalUDP.java
@@ -41,7 +41,8 @@ class Thread_TX_CNormalUDP implements Runnable {
+ (MainActivity.isLocal ? Utilities.myInetIP : MainActivity.remoteIP) + " "
+ Utilities.UDP_port + " "
+ ((MainActivity.currentBandwidth < 0) ? "" : String.valueOf(
- MainActivity.currentBandwidth));
+ MainActivity.currentBandwidth))
+ + ((Utilities.udpsendsize == -1) ? "" : String.valueOf(Utilities.udpsendsize));
Log.d("TX_NormalUDP", "Start TX Normal UDP");
diff --git a/OffloadingDemo/mobile/src/main/res/layout/activity_main.xml b/OffloadingDemo/mobile/src/main/res/layout/activity_main.xml
index f503f98..f47798f 100755
--- a/OffloadingDemo/mobile/src/main/res/layout/activity_main.xml
+++ b/OffloadingDemo/mobile/src/main/res/layout/activity_main.xml
@@ -21,7 +21,7 @@
android:id="@+id/btn_startTransmit"
android:layout_width="0dp"
android:layout_height="match_parent"
- android:layout_weight="1"
+ android:layout_weight="2"
android:text="@string/btn_begintx"
android:textStyle="bold"
android:textSize="20dp"
@@ -32,12 +32,23 @@
android:id="@+id/btn_startReceive"
android:layout_width="0dp"
android:layout_height="match_parent"
- android:layout_weight="1"
+ android:layout_weight="2"
android:text="@string/btn_beginrx"
android:textStyle="bold"
android:textSize="20dp"
android:textColor="#FFFFFF"/>
+
+
Setup\nTCPDump
Misc.
Clear
- Begin RX
- Begin TX
+ Start RX
+ Start TX
Not rooted!! Must be rooted!
WiFi is ON!\n
WiFi is NOT On!\n
diff --git a/OffloadingDemo/mobile/src/main/res/values/styles.xml b/OffloadingDemo/mobile/src/main/res/values/styles.xml
old mode 100755
new mode 100644
index 10125ba..de4821d
--- a/OffloadingDemo/mobile/src/main/res/values/styles.xml
+++ b/OffloadingDemo/mobile/src/main/res/values/styles.xml
@@ -8,4 +8,7 @@
+
\ No newline at end of file
diff --git a/OffloadingDemo/wear/wear.iml b/OffloadingDemo/wear/wear.iml
index 57a96cb..23b52f0 100755
--- a/OffloadingDemo/wear/wear.iml
+++ b/OffloadingDemo/wear/wear.iml
@@ -66,14 +66,6 @@
-
-
-
-
-
-
-
-
@@ -82,6 +74,14 @@
+
+
+
+
+
+
+
+