Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

ready jitter and rtt, reduced size for goodput test

  • Loading branch information...
commit d1098208ef12640c0630e1ed028f6362c5af670f 1 parent 6352db5
@narseo narseo authored
View
18 SigcommDemoAndroid/res/layout/main.xml
@@ -58,33 +58,33 @@
android:stretchColumns="0,1">
-
-
<TableRow
- android:id="@+id/tableRow1"
+ android:id="@+id/tableRow2"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<uk.ac.cam.cl.dtg.snowdon.AreaGraphView android:layout_width="wrap_content"
- android:layout_height="120dp" android:id="@+id/graphLatency"
+ android:layout_height="120dp" android:id="@+id/graphGoodput"
android:layout_weight="1"/>
</TableRow>
-
-
-
+
<TableRow
- android:id="@+id/tableRow2"
+ android:id="@+id/tableRow1"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<uk.ac.cam.cl.dtg.snowdon.AreaGraphView android:layout_width="wrap_content"
- android:layout_height="120dp" android:id="@+id/graphGoodput"
+ android:layout_height="120dp" android:id="@+id/graphLatency"
android:layout_weight="1"/>
</TableRow>
+
+
+
+
<TableRow
android:id="@+id/tableRow3"
android:layout_width="fill_parent"
View
72 SigcommDemoAndroid/src/cl/signpost/narseo/com/SigcommDemoAndroidActivity.java
@@ -81,18 +81,20 @@
private static float [] arrayUpstreamBandwidth = new float[MAX_HISTORIC_VALS];
private static float [] arrayDownstreamLatency = new float[MAX_HISTORIC_VALS];
private static float [] arrayUpstreamLatency = new float[MAX_HISTORIC_VALS];
+ private static float [] arrayJitter = new float[MAX_HISTORIC_VALS];
private static float [] timestampDownstreamBandwidth = new float[MAX_HISTORIC_VALS];
private static float [] timestampUpstreamBandwidth = new float[MAX_HISTORIC_VALS];
private static float [] timestampDownstreamLatency = new float[MAX_HISTORIC_VALS];
private static float [] timestampUpstreamLatency = new float[MAX_HISTORIC_VALS];
+ private static float [] timestampJitter = new float[MAX_HISTORIC_VALS];
private static float maxTimestampBandwidth = 0.0f;
private static float minTimestampBandwidth = 0.0f;
//Parameters about the configuration of the plots, ticks, axis, etc
private static String [] yTicksLabelsBandwidth = new String []{"0", "10", "20", "30", "40"};
private static float [] yTicksPosBandwidth = new float []{0.0f, 0.25f, 0.5f, 0.75f, 1.0f};
- private static String [] yTicksLabelsLatency = new String []{"0", "0.12", "0.25", "0.37", "0.5"};
- private static String [] yTicksLabelsJitter = new String []{"0", "2", "4", "6", "8", "10"};
+ private static String [] yTicksLabelsLatency = new String []{"0", "0.1", "0.2", "0.3", "0.4"};
+ private static String [] yTicksLabelsJitter = new String []{"0", "0.1", "0.2", "0.3", "0.4", "0.5"};
private static float [] yTicksPosJitter = new float []{0.0f, 0.2f, 0.4f, 0.6f, 0.8f, 1.0f};
//Default values
private static String [] xTicksLabelsTime = new String []{"0s"};
@@ -116,10 +118,12 @@ public void onCreate(Bundle savedInstanceState) {
for (int i=0; i<MAX_HISTORIC_VALS; i++){
arrayDownstreamBandwidth [i] = 0.0f;
arrayUpstreamBandwidth [i] = 0.0f;
+ arrayJitter[i]=0.0f;
timestampDownstreamBandwidth [i] = 0.0f;
timestampUpstreamBandwidth [i] = 0.0f;
timestampDownstreamLatency [i] = 0.0f;
timestampUpstreamLatency [i] = 0.0f;
+ timestampJitter [i] = 0.0f;
}
mGoodputGraph = (GraphView) findViewById(R.id.graphGoodput);
@@ -129,10 +133,10 @@ public void onCreate(Bundle savedInstanceState) {
mGoodputGraph.setYAxisLabel("Goodput (Mbps)");
//mGoodputGraph.setXAxisLabel("Elapsed Time (s)");
- mLatencyGraph.setYAxisLabel("Latency (s)");
+ mLatencyGraph.setYAxisLabel("RTT (s)");
//mLatencyGraph.setXAxisLabel("Elapsed Time (s)");
- mJitterGraph.setYAxisLabel("Jitter (ms)");
+ mJitterGraph.setYAxisLabel("Jitter (s)");
mJitterGraph.setXAxisLabel("Elapsed Time (s)");
@@ -144,8 +148,9 @@ public void onCreate(Bundle savedInstanceState) {
mGoodputGraph.setXLabels(xTicksLabelsTime);
mGoodputGraph.setXLabelPositions(xTicksPosBandwidth);
- mLatencyGraph.setYLabels(yTicksLabelsLatency);
- mLatencyGraph.setYLabelPositions(yTicksPosBandwidth);
+ //Same axis as jitter
+ mLatencyGraph.setYLabels(yTicksLabelsJitter);
+ mLatencyGraph.setYLabelPositions(yTicksPosJitter);
mLatencyGraph.setXLabels(xTicksLabelsTime);
mLatencyGraph.setXLabelPositions(xTicksPosBandwidth);
@@ -284,7 +289,8 @@ public void onReceive(Context context, Intent intent) {
//Everything updated at the same time, otherwise time
//intervals do not match and they might look ugly
plotBandwidthPairs(timestampDownstreamBandwidth, arrayDownstreamBandwidth, timestampUpstreamBandwidth, arrayUpstreamBandwidth);
- plotLatencyPairs(timestampDownstreamLatency, arrayDownstreamLatency, timestampUpstreamLatency, arrayUpstreamLatency);
+ plotLatencySingle(timestampDownstreamLatency, arrayDownstreamLatency);
+ plotJitterSingle(timestampJitter, arrayJitter);
}
int goodputDownstreamVal = intent.getIntExtra(REFRESH_GOODPUTDOWNSTREAM_INTENT, -1);
@@ -294,6 +300,13 @@ public void onReceive(Context context, Intent intent) {
updateTimestampArray(timestampDownstreamBandwidth,elapsedTime);
arrayDownstreamBandwidth = updateHistoricValFloat(arrayDownstreamBandwidth, (float)goodputDownstreamVal/1000.0f);
}
+ int jitterVal = intent.getIntExtra(REFRESH_JITTER_INTENT, -1);
+ if (jitterVal>-1){
+ Log.i(TAG, "Received Jitter: "+jitterVal);
+ float elapsedTime = (float)(System.currentTimeMillis()-startTime)/1000.0f;
+ updateTimestampArray(timestampJitter,elapsedTime);
+ arrayJitter = updateHistoricValFloat(arrayJitter, (float)jitterVal/1000.0f);
+ }
}
}
}
@@ -328,6 +341,51 @@ public void onReceive(Context context, Intent intent) {
return array;
}
+
+ public void plotJitterSingle (float [] timestampsDownstream, float [] arrayLatencyDownstream){
+ mJitterGraph.redraw();
+
+ float[][] data1 = {timestampsDownstream, arrayLatencyDownstream};
+
+ mJitterGraph.setData(new float[][][]{data1}, minValBandwidth, timestampsDownstream[timestampsDownstream.length-1], 0, 1000);
+ //mLatencyGraph.addData(data2, minValBandwidth, Math.min(timestampsUpstream[timestampsUpstream.length-1], timestampsDownstream[timestampsDownstream.length-1]), 0, 1000);
+
+ float midTime = (maxValBandwidth-minValBandwidth)/2.0f+minValBandwidth;
+ float mid = (float)Math.round(midTime*10)/10;
+ float firstquarterTime = (float)Math.round(((midTime-minValBandwidth)/2.0f+minValBandwidth)*10)/10;
+ float secondquarterTime = (float)Math.round(((maxValBandwidth-midTime)/2.0f+midTime)*10)/10;
+ float max = (float)Math.round(maxValBandwidth*10)/10;
+ float min = (float)Math.round(minValBandwidth*10)/10;
+
+ String [] xTicksLabelsLatency = new String []{String.valueOf(min), String.valueOf(firstquarterTime), String.valueOf(mid), String.valueOf(secondquarterTime), String.valueOf(max)};
+ float [] xTicksPosLatency = new float []{0.0f, 0.25f, 0.5f, 0.75f, 1.0f};
+
+ mJitterGraph.setXLabels(xTicksLabelsLatency);
+ mJitterGraph.setXLabelPositions(xTicksPosLatency);
+ }
+
+ public void plotLatencySingle (float [] timestampsDownstream, float [] arrayLatencyDownstream){
+ mLatencyGraph.redraw();
+
+ float[][] data1 = {timestampsDownstream, arrayLatencyDownstream};
+
+ mLatencyGraph.setData(new float[][][]{data1}, minValBandwidth, timestampsDownstream[timestampsDownstream.length-1], 0, 1000);
+ //mLatencyGraph.addData(data2, minValBandwidth, Math.min(timestampsUpstream[timestampsUpstream.length-1], timestampsDownstream[timestampsDownstream.length-1]), 0, 1000);
+
+ float midTime = (maxValBandwidth-minValBandwidth)/2.0f+minValBandwidth;
+ float mid = (float)Math.round(midTime*10)/10;
+ float firstquarterTime = (float)Math.round(((midTime-minValBandwidth)/2.0f+minValBandwidth)*10)/10;
+ float secondquarterTime = (float)Math.round(((maxValBandwidth-midTime)/2.0f+midTime)*10)/10;
+ float max = (float)Math.round(maxValBandwidth*10)/10;
+ float min = (float)Math.round(minValBandwidth*10)/10;
+
+ String [] xTicksLabelsLatency = new String []{String.valueOf(min), String.valueOf(firstquarterTime), String.valueOf(mid), String.valueOf(secondquarterTime), String.valueOf(max)};
+ float [] xTicksPosLatency = new float []{0.0f, 0.25f, 0.5f, 0.75f, 1.0f};
+
+ mLatencyGraph.setXLabels(xTicksLabelsLatency);
+ mLatencyGraph.setXLabelPositions(xTicksPosLatency);
+ }
+
public void plotLatencyPairs (float [] timestampsDownstream, float [] arrayLatencyDownstream, float[] timestampsUpstream, float[] arrayLatencyUpstream){
mLatencyGraph.redraw();
View
28 SigcommDemoAndroid/src/cl/signpost/narseo/com/SigcommDemoAndroidService.java
@@ -159,6 +159,9 @@ public void notifyActivity (int value, int caseId){
case LATENCY_DOWNSTREAM_ID:
extraVal = REFRESH_LATENCYDOWNSTREAM_INTENT;
break;
+ case JITTER_ID:
+ extraVal = REFRESH_JITTER_INTENT;
+ break;
default:
Log.i(TAG, "Unknown value");
return;
@@ -242,7 +245,7 @@ public void run (){
in = inFromServer.readLine();
int numBytes = Integer.parseInt(in);
int latency = (int)(System.currentTimeMillis()-startTime)*1000/2;
- notifyActivity(latency, LATENCY_UPSTREAM_ID);
+ //notifyActivity(latency, LATENCY_UPSTREAM_ID);
Log.i(TAG, "Packet Length (string): "+in+" - Packet Length (int): "+numBytes);
long startDownloadTime = System.currentTimeMillis();
@@ -268,7 +271,7 @@ public void run (){
//Wait for server latency
int serverLatencyInt = Integer.parseInt(inFromServer.readLine());
- notifyActivity (serverLatencyInt, LATENCY_DOWNSTREAM_ID);
+ //notifyActivity (serverLatencyInt, LATENCY_DOWNSTREAM_ID);
//GET UPSTREAM GOODPUT
@@ -406,15 +409,30 @@ public void run() {
long t4 = System.currentTimeMillis();
String r2 = new String(dpReceive.getData(), 0, dpReceive.getLength());
//Log.e(TAG, "Server response2: "+r2);
-
+ //server;1;1343690067729;
//Compute values!!! t1,t2,t3,t4, r1 and r2
long rtt=((t4-t3)+(t2-t1))/2;
- System.out.println("RTT: "+rtt);
+ String [] serverResp1 = r1.split(";");
+ String [] serverResp2 = r2.split(";");
+
+ long servTimestamp1 = Long.parseLong(serverResp1[2]);
+ long servTimestamp2 = Long.parseLong(serverResp2[2]);
+ long deltaRemote = servTimestamp2-servTimestamp1;
+ long deltaLocal = t3-t1;
+ //Log.i(TAG, "R1: "+servTimestamp1+"; R2: "+servTimestamp2+"; DELTA: "+(servTimestamp2-servTimestamp1));
+
+ long jitter = Math.abs(deltaLocal-deltaRemote);
+ notifyActivity((int)rtt*1000, LATENCY_DOWNSTREAM_ID);
+ notifyActivity((int)jitter*1000, JITTER_ID);
+
+ System.out.println("RTT: "+rtt+"\tJitter: "+jitter);
+
long error = System.currentTimeMillis()-t1;
//Sleep thread
- Log.i(TAG, "Sleep error "+error);
+ //Log.i(TAG, "Sleep error "+error);
Thread.sleep(2000-error);
+
}
catch(Exception e){
Log.e(TAG, "Test failed: "+e.getMessage());
View
2  SignpostServerOCaml/server.ml
@@ -5,7 +5,7 @@ open Printf
open Re_str
let bytes_per_megabit = 131072.0
-let num_bytes = 1000000
+let num_bytes = 400000
let udp_listening_port = "57654"
(* let udp_sending_port = "57655" *)
let d = String.create num_bytes

0 comments on commit d109820

Please sign in to comment.
Something went wrong with that request. Please try again.