summaryrefslogtreecommitdiff
path: root/same-android/src/main/java/com/orbekk/same
diff options
context:
space:
mode:
authorKjetil Ørbekk <kjetil.orbekk@gmail.com>2012-04-09 21:58:36 +0200
committerKjetil Ørbekk <kjetil.orbekk@gmail.com>2012-04-09 21:58:36 +0200
commitf4da6504442ba16829ddd206ef73329a7b02ad8c (patch)
tree62b2028336b4f3ecc27ad1c5c9b540d6b02266cb /same-android/src/main/java/com/orbekk/same
parent4dbe03635e19bc894046c920ed1da5c94a023e36 (diff)
Run benchmark from Activities.
Diffstat (limited to 'same-android/src/main/java/com/orbekk/same')
-rw-r--r--same-android/src/main/java/com/orbekk/same/android/benchmark/ExampleHttpServerActivity.java4
-rw-r--r--same-android/src/main/java/com/orbekk/same/android/benchmark/ExampleProtobufServerActivity.java7
2 files changed, 11 insertions, 0 deletions
diff --git a/same-android/src/main/java/com/orbekk/same/android/benchmark/ExampleHttpServerActivity.java b/same-android/src/main/java/com/orbekk/same/android/benchmark/ExampleHttpServerActivity.java
index 695988d..700030c 100644
--- a/same-android/src/main/java/com/orbekk/same/android/benchmark/ExampleHttpServerActivity.java
+++ b/same-android/src/main/java/com/orbekk/same/android/benchmark/ExampleHttpServerActivity.java
@@ -3,6 +3,7 @@ package com.orbekk.same.android.benchmark;
import android.app.Activity;
import com.orbekk.same.benchmark.ExampleServer;
+import com.orbekk.same.benchmark.HttpClientBenchmark;
import com.orbekk.same.benchmark.HttpExampleServer;
public class ExampleHttpServerActivity extends Activity {
@@ -12,6 +13,9 @@ public class ExampleHttpServerActivity extends Activity {
super.onResume();
try {
server.runServer(12000);
+ HttpClientBenchmark.benchmark(
+ "http://localhost:12000/HttpExampleService.json",
+ 100, 2000);
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException(e);
diff --git a/same-android/src/main/java/com/orbekk/same/android/benchmark/ExampleProtobufServerActivity.java b/same-android/src/main/java/com/orbekk/same/android/benchmark/ExampleProtobufServerActivity.java
index c6be5a4..f4a2f05 100644
--- a/same-android/src/main/java/com/orbekk/same/android/benchmark/ExampleProtobufServerActivity.java
+++ b/same-android/src/main/java/com/orbekk/same/android/benchmark/ExampleProtobufServerActivity.java
@@ -1,7 +1,9 @@
package com.orbekk.same.android.benchmark;
import android.app.Activity;
+import android.os.Debug;
+import com.orbekk.same.benchmark.ClientBenchmark;
import com.orbekk.same.benchmark.ExampleServer;
public class ExampleProtobufServerActivity extends Activity {
@@ -10,6 +12,11 @@ public class ExampleProtobufServerActivity extends Activity {
@Override public void onResume() {
super.onResume();
server.runServer(12000);
+ try {
+ ClientBenchmark.benchmark("localhost", 12000, 100, 2000);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
}
@Override public void onStop() {