summaryrefslogtreecommitdiffstats
path: root/test/test-client-latency.c
diff options
context:
space:
mode:
authorTimo Dritschler <timo.dritschler@kit.edu>2014-12-10 16:23:49 +0100
committerTimo Dritschler <timo.dritschler@kit.edu>2014-12-10 16:23:49 +0100
commit8d50558755b93f26108313e40e92a8ae457864ab (patch)
tree7190a92e2bc2f13e3b20fc85caea10f349cfee37 /test/test-client-latency.c
parent9f0b6da7cf20f085d2729e5433f85ffa60a6fd94 (diff)
parent0dc8c19937b52dfb793672226183697b6987b9fe (diff)
downloadkiro-8d50558755b93f26108313e40e92a8ae457864ab.tar.gz
kiro-8d50558755b93f26108313e40e92a8ae457864ab.tar.bz2
kiro-8d50558755b93f26108313e40e92a8ae457864ab.tar.xz
kiro-8d50558755b93f26108313e40e92a8ae457864ab.zip
Merge pull request #14 from ufo-kit/communicationHandling
Release Version 2 (0.2.0) Added kiro_client_ping_server to KIRO client
Diffstat (limited to 'test/test-client-latency.c')
-rw-r--r--test/test-client-latency.c32
1 files changed, 12 insertions, 20 deletions
diff --git a/test/test-client-latency.c b/test/test-client-latency.c
index d05747d..208c37c 100644
--- a/test/test-client-latency.c
+++ b/test/test-client-latency.c
@@ -6,7 +6,7 @@
#include <assert.h>
-int
+int
main ( int argc, char *argv[] )
{
if (argc < 3) {
@@ -15,38 +15,30 @@ main ( int argc, char *argv[] )
}
KiroClient *client = kiro_client_new ();
- KiroTrb *trb = kiro_trb_new ();
if (-1 == kiro_client_connect (client, argv[1], argv[2])) {
kiro_client_free (client);
return -1;
}
- kiro_client_sync (client);
- kiro_trb_adopt (trb, kiro_client_get_memory (client));
+ int iterations = 10000;
- GTimer *timer = g_timer_new ();
-while (1) {
- g_timer_reset (timer);
+while (1) {
int i = 0;
- while(i < 50000) {
- kiro_client_sync (client);
+ float ping_us = 0;
+ int fail_count = 0;
+ while(i < iterations) {
+ float tmp = kiro_client_ping_server (client);
+ if (tmp < 0)
+ fail_count++;
+ else
+ ping_us += tmp;
i++;
}
- double elapsed = g_timer_elapsed (timer, NULL);
- printf ("Average Latency: %fus\n", (elapsed/50000.)*1000*1000);
+ printf ("Average Latency: %fus\n", ping_us/(float)(iterations - fail_count));
}
- g_timer_stop (timer);
kiro_client_free (client);
- kiro_trb_free (trb);
return 0;
}
-
-
-
-
-
-
-