aboutsummaryrefslogtreecommitdiff
path: root/perf
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2017-01-16 00:43:03 -0800
committerGarrett D'Amore <garrett@damore.org>2017-01-16 00:43:03 -0800
commit39dbff5615631522d3ef98b83141957038502c0d (patch)
tree89becbf88ebb79df9c9202450acd476bd790bde0 /perf
parentf71209a0b429cddcd44f1f2473c49e986c9b4be7 (diff)
downloadnng-39dbff5615631522d3ef98b83141957038502c0d.tar.gz
nng-39dbff5615631522d3ef98b83141957038502c0d.tar.bz2
nng-39dbff5615631522d3ef98b83141957038502c0d.zip
Various complaints found in AppVeyor build.
Diffstat (limited to 'perf')
-rw-r--r--perf/CMakeLists.txt7
-rw-r--r--perf/perf.c24
2 files changed, 29 insertions, 2 deletions
diff --git a/perf/CMakeLists.txt b/perf/CMakeLists.txt
index c5fc1c3a..babf17e8 100644
--- a/perf/CMakeLists.txt
+++ b/perf/CMakeLists.txt
@@ -31,7 +31,12 @@ include_directories(AFTER SYSTEM ${PROJECT_SOURCE_DIR}/src)
if (NNG_TESTS)
macro (add_nng_perf NAME)
add_executable (${NAME} perf.c)
- target_link_libraries (${NAME} ${PROJECT_NAME})
+ target_link_libraries (${NAME} ${PROJECT_NAME}_static)
+ target_link_libraries (${NAME} ${NNG_REQUIRED_LIBRARIES})
+ target_compile_definitions(${NAME} PUBLIC -DNNG_STATIC_LIB)
+ if (CMAKE_THREAD_LIBS_INIT)
+ target_link_libraries (${NAME} "${CMAKE_THREAD_LIBS_INIT}")
+ endif()
endmacro (add_nng_perf)
else ()
diff --git a/perf/perf.c b/perf/perf.c
index 7f0349f6..202a3712 100644
--- a/perf/perf.c
+++ b/perf/perf.c
@@ -20,6 +20,17 @@
// API, so don't be lazy like this! All nni_ symbols are subject to
// change without notice, and not part of the stable API or ABI.
#include "core/nng_impl.h"
+#include "core/thread.c"
+#include "core/clock.c"
+#include "platform/posix/posix_impl.h"
+#include "platform/posix/posix_alloc.c"
+#include "platform/posix/posix_clock.c"
+#include "platform/posix/posix_debug.c"
+#include "platform/posix/posix_thread.c"
+#include "platform/windows/win_impl.h"
+#include "platform/windows/win_clock.c"
+#include "platform/windows/win_debug.c"
+#include "platform/windows/win_thread.c"
static void latency_client(const char *, int, int);
static void latency_server(const char *, int, int);
@@ -90,6 +101,17 @@ main(int argc, char **argv)
}
}
+int
+nop(void)
+{
+ return (0);
+}
+
+int
+nni_init(void)
+{
+ return (nni_plat_init(nop));
+}
static void
die(const char *fmt, ...)
@@ -298,7 +320,7 @@ latency_client(const char *addr, int msgsize, int trips)
nni_msg_free(msg);
nng_close(s);
- total = (end - start) / 1.0;
+ total = (float)(end - start);
latency = (total / (trips * 2));
printf("total time: %.3f [s]\n", total / 1000000.0);
printf("message size: %d [B]\n", msgsize);