basic benchmarking
authorFlorian Dold <florian.dold@gmail.com>
Fri, 17 Aug 2018 22:47:04 +0000 (00:47 +0200)
committerFlorian Dold <florian.dold@gmail.com>
Fri, 17 Aug 2018 22:47:04 +0000 (00:47 +0200)
configure.ac
po/POTFILES.in
src/util/Makefile.am
src/util/crypto_ecc.c

index d37c2cb5f9a9b5903592006da7df81e9b8bb1e53..10991e574556cd5c16d40717a0c67b84aa990098 100644 (file)
@@ -1388,6 +1388,17 @@ fi
 AC_SUBST(MONKEYPREFIX)
 
 
+AC_MSG_CHECKING([whether to compile in benchmarks (currently for http and crypto)])
+AC_ARG_ENABLE([benchmark],
+   [AS_HELP_STRING([--enable-benchmark], [enable benchmarking])],
+   [enable_benchmark=${enableval}],
+   [enable_benchmark=no])
+AC_MSG_RESULT($enable_benchmark)
+AS_IF([test "x$enable_benchmark" = "xyes"],
+      [AC_DEFINE_UNQUOTED(ENABLE_BENCHMARK,1,[Benchmarks are enabled])])
+AM_CONDITIONAL([ENABLE_BENCHMARK], [test "x$enable_benchmark" = "xyes"])
+
+
 # should expensive tests be run?
 AC_MSG_CHECKING(whether to run expensive tests)
 AC_ARG_ENABLE([expensivetests],
index 0dd50e62b7b00464fd616a36f335ae99df9f8de9..45471731ce7619992c2e2ee5502712d7cd643a93 100644 (file)
@@ -445,6 +445,7 @@ src/transport/transport-testing-loggers.c
 src/transport/transport-testing-main.c
 src/transport/transport-testing-send.c
 src/util/bandwidth.c
+src/util/benchmark.c
 src/util/bio.c
 src/util/client.c
 src/util/common_allocation.c
index 4ae073c2ccb5210a07a1348dea6a9883955d492a..b0f45b1dae891684832d9bcc9f6e3f39712880d3 100644 (file)
@@ -40,6 +40,11 @@ if USE_COVERAGE
   XLIB = -lgcov
 endif
 
+if ENABLE_BENCHMARK
+  BENCHMARK = benchmark.c
+  PTHREAD = -lpthread
+endif
+
 w32cat_SOURCES = w32cat.c
 
 gnunet_helper_w32_console_SOURCES = \
@@ -60,6 +65,7 @@ test_common_logging_dummy_LDADD = \
 
 libgnunetutil_la_SOURCES = \
   bandwidth.c \
+  $(BENCHMARK) \
   bio.c \
   client.c \
   common_allocation.c \
@@ -121,7 +127,7 @@ libgnunetutil_la_LIBADD = \
   $(LIBGCRYPT_LIBS) \
   $(LTLIBICONV) \
   $(LTLIBINTL) \
-  -lltdl -lidn $(Z_LIBS) -lunistring $(XLIB)
+  -lltdl -lidn $(Z_LIBS) -lunistring $(XLIB) $(PTHREAD)
 
 libgnunetutil_la_LDFLAGS = \
   $(GN_LIB_LDFLAGS) \
index 07782b1815f076a54af69382d7c339145e8e08d6..ed20fa2c891e41b80e98f639f9a462224d58866b 100644 (file)
@@ -25,6 +25,7 @@
 #include <gcrypt.h>
 #include "gnunet_crypto_lib.h"
 #include "gnunet_strings_lib.h"
+#include "benchmark.h"
 
 #define EXTRA_CHECKS 0
 
@@ -873,6 +874,12 @@ GNUNET_CRYPTO_eddsa_sign (const struct GNUNET_CRYPTO_EddsaPrivateKey *priv,
   int rc;
   gcry_mpi_t rs[2];
 
+#if ENABLE_BENCHMARK
+  struct BenchmarkData *bd = get_benchmark_data ();
+  bd->eddsa_sign_count++;
+  printf("crypto eddsa sign\n");
+#endif
+
   priv_sexp = decode_private_eddsa_key (priv);
   data = data_to_eddsa_value (purpose);
   if (0 != (rc = gcry_pk_sign (&sig_sexp, data, priv_sexp)))