diff options
author | Timo <timo.dritschler@kit.edu> | 2014-09-30 14:55:26 +0200 |
---|---|---|
committer | Timo <timo.dritschler@kit.edu> | 2014-09-30 14:55:26 +0200 |
commit | e71b75575658c435bc77c01ef098336c563af740 (patch) | |
tree | dd2d852820339cf84df216e62a76ebbda9d32fc0 | |
parent | 6ffe22890f901238318c68c38c099ccd62321a9a (diff) | |
download | kiro-e71b75575658c435bc77c01ef098336c563af740.tar.gz kiro-e71b75575658c435bc77c01ef098336c563af740.tar.bz2 kiro-e71b75575658c435bc77c01ef098336c563af740.tar.xz kiro-e71b75575658c435bc77c01ef098336c563af740.zip |
Fixed a bug in RDMA memory allocation (Size information was missing)
Added test-latency and test-bandwith tests
-rw-r--r-- | src/kiro-client.h | 4 | ||||
-rw-r--r-- | src/kiro-rdma.h | 4 | ||||
-rw-r--r-- | test/CMakeLists.txt | 10 | ||||
-rw-r--r-- | test/test-client-bandwith.c | 53 | ||||
-rw-r--r-- | test/test-client-latency.c | 52 |
5 files changed, 117 insertions, 6 deletions
diff --git a/src/kiro-client.h b/src/kiro-client.h index b03bab9..b4e1b09 100644 --- a/src/kiro-client.h +++ b/src/kiro-client.h @@ -83,8 +83,8 @@ int kiro_client_sync (KiroClient *client); void *kiro_client_get_memory (KiroClient *client); -size_t kior_client_get_memory_size (KiroClient *client); +size_t kiro_client_get_memory_size (KiroClient *client); G_END_DECLS -#endif //__KIRO_CLIENT_H
\ No newline at end of file +#endif //__KIRO_CLIENT_H diff --git a/src/kiro-rdma.h b/src/kiro-rdma.h index 2ebbcf6..9a3cbe8 100644 --- a/src/kiro-rdma.h +++ b/src/kiro-rdma.h @@ -147,6 +147,8 @@ kiro_create_rdma_memory (struct ibv_pd *pd, size_t mem_size, int access) if (!krm->mem) krm->mem = krm->mr->addr; + krm->size = mem_size; + return krm; } @@ -216,4 +218,4 @@ kiro_destroy_connection (struct rdma_cm_id **conn) } -#endif //__KIRO_RDMA_H__
\ No newline at end of file +#endif //__KIRO_RDMA_H__ diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index aee6c45..a37c16c 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -5,11 +5,15 @@ find_package(PkgConfig) pkg_check_modules(SDL sdl>=1.2.15) if (SDL_FOUND) - add_executable(client test-client.c) - target_link_libraries(client kiro SDL m gobject-2.0 glib-2.0) + add_executable(client-sdl test-client.c) + target_link_libraries(client-sdl kiro SDL m gobject-2.0 glib-2.0) else () - message("SDL not found: Won't build KIRO test-client binary.") + message("SDL not found: Won't build KIRO test-client-sdl binary.") endif () +add_executable(kiro-test-latency test-client-latency.c) +target_link_libraries(kiro-test-latency kiro gobject-2.0 glib-2.0) +add_executable(kiro-test-bandwith test-client-bandwith.c) +target_link_libraries(kiro-test-bandwith kiro gobject-2.0 glib-2.0) add_executable(server test-server.c) target_link_libraries(server kiro gobject-2.0 glib-2.0) diff --git a/test/test-client-bandwith.c b/test/test-client-bandwith.c new file mode 100644 index 0000000..c7f90ee --- /dev/null +++ b/test/test-client-bandwith.c @@ -0,0 +1,53 @@ +#include <stdint.h> +#include <stdio.h> +#include <stdlib.h> +#include "kiro-client.h" +#include "kiro-trb.h" +#include <assert.h> + + +int +main ( int argc, char *argv[] ) +{ + if (argc < 3) { + printf ("Not enough aruments. Usage: ./client <address> <port>\n"); + return -1; + } + + KiroClient *client = kiro_client_new (); + + if (-1 == kiro_client_connect (client, argv[1], argv[2])) { + g_object_unref (client); + return -1; + } + + kiro_client_sync (client); + KiroTrb *trb = kiro_trb_new (); + kiro_trb_adopt (trb, kiro_client_get_memory (client)); + + GTimer *timer = g_timer_new (); + + +while (1) { + int i = 0; + while(i < 500) { + kiro_client_sync (client); + i++; + } + + double elapsed = g_timer_elapsed (timer, NULL); + size_t size = kiro_client_get_memory_size (client); + printf ("Throughput: %.2fGbyte/s\n",((size * 500) / elapsed)/(1024*1024*1024)); +} + g_timer_stop (timer); + g_object_unref (client); + return 0; +} + + + + + + + + diff --git a/test/test-client-latency.c b/test/test-client-latency.c new file mode 100644 index 0000000..b50610b --- /dev/null +++ b/test/test-client-latency.c @@ -0,0 +1,52 @@ +#include <stdint.h> +#include <stdio.h> +#include <stdlib.h> +#include "kiro-client.h" +#include "kiro-trb.h" +#include <assert.h> + + +int +main ( int argc, char *argv[] ) +{ + if (argc < 3) { + printf ("Not enough aruments. Usage: ./client <address> <port>\n"); + return -1; + } + + KiroClient *client = kiro_client_new (); + + if (-1 == kiro_client_connect (client, argv[1], argv[2])) { + g_object_unref (client); + return -1; + } + + kiro_client_sync (client); + KiroTrb *trb = kiro_trb_new (); + kiro_trb_adopt (trb, kiro_client_get_memory (client)); + + GTimer *timer = g_timer_new (); +while (1) { + g_timer_reset (timer); + int i = 0; + while(i < 50000) { + kiro_client_sync (client); + i++; + } + + double elapsed = g_timer_elapsed (timer, NULL); + size_t size = kiro_client_get_memory_size (client); + printf ("Average Latency: %fus\n", (elapsed/50000.)*1000*1000); +} + g_timer_stop (timer); + g_object_unref (client); + return 0; +} + + + + + + + + |