diff --git a/configure.ac b/configure.ac index 9442dee4b93a..45bdaedc518c 100644 --- a/configure.ac +++ b/configure.ac @@ -132,6 +132,12 @@ AC_ARG_WITH([bdb], [use_bdb=$withval], [use_bdb=auto]) +AC_ARG_ENABLE([ebpf], + [AS_HELP_STRING([--enable-ebpf], + [enable eBPF tracing (default is yes if sys/sdt.h is found)])], + [use_ebpf=$enableval], + [use_ebpf=yes]) + AC_ARG_WITH([miniupnpc], [AS_HELP_STRING([--with-miniupnpc], [enable UPNP (default is yes if libminiupnpc is found)])], @@ -1368,6 +1374,16 @@ if test x$enable_wallet != xno; then fi fi +if test x$use_ebpf != xno; then + AC_CHECK_HEADER([sys/sdt.h], [have_sdt=yes], [have_sdt=no]) +else + have_sdt=no +fi + +if test x$have_sdt = xyes; then + AC_DEFINE([ENABLE_TRACING], [1], [Define to 1 to enable eBPF user static defined tracepoints]) +fi + dnl Check for libminiupnpc (optional) if test x$use_upnp != xno; then AC_CHECK_HEADERS( @@ -1740,6 +1756,7 @@ AM_CONDITIONAL([TARGET_WINDOWS], [test x$TARGET_OS = xwindows]) AM_CONDITIONAL([ENABLE_WALLET],[test x$enable_wallet = xyes]) AM_CONDITIONAL([USE_SQLITE], [test "x$use_sqlite" = "xyes"]) AM_CONDITIONAL([USE_BDB], [test "x$use_bdb" = "xyes"]) +AM_CONDITIONAL([ENABLE_TRACING],[test x$have_sdt = xyes]) AM_CONDITIONAL([ENABLE_TESTS],[test x$BUILD_TEST = xyes]) AM_CONDITIONAL([ENABLE_FUZZ],[test x$enable_fuzz = xyes]) AM_CONDITIONAL([ENABLE_FUZZ_BINARY],[test x$enable_fuzz_binary = xyes]) @@ -1905,6 +1922,7 @@ echo " with bench = $use_bench" echo " with upnp = $use_upnp" echo " with natpmp = $use_natpmp" echo " use asm = $use_asm" +echo " ebpf tracing = $have_sdt" echo " sanitizers = $use_sanitizers" echo " debug enabled = $enable_debug" echo " stacktraces enabled = $enable_stacktraces" diff --git a/src/Makefile.am b/src/Makefile.am index b8d268b41967..559382876ebf 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -310,8 +310,10 @@ BITCOIN_CORE_H = \ util/check.h \ util/enumerate.h \ util/error.h \ + util/fastrange.h \ util/fees.h \ util/golombrice.h \ + util/hasher.h \ util/hash_type.h \ util/irange.h \ util/spanparsing.h \ @@ -321,6 +323,7 @@ BITCOIN_CORE_H = \ util/macros.h \ util/message.h \ util/moneystr.h \ + util/overflow.h \ util/ranges.h \ util/readwritefile.h \ util/underlying.h \ @@ -330,7 +333,9 @@ BITCOIN_CORE_H = \ util/sock.h \ util/string.h \ util/time.h \ + util/thread.h \ util/threadnames.h \ + util/trace.h \ util/translation.h \ util/vector.h \ util/url.h \ @@ -735,8 +740,10 @@ libbitcoin_util_a_SOURCES = \ util/asmap.cpp \ util/bip32.cpp \ util/bytevectorhash.cpp \ + util/check.cpp \ util/error.cpp \ util/fees.cpp \ + util/hasher.cpp \ util/getuniquepath.cpp \ util/sock.cpp \ util/system.cpp \ @@ -750,6 +757,7 @@ libbitcoin_util_a_SOURCES = \ util/time.cpp \ util/serfloat.cpp \ util/string.cpp \ + util/thread.cpp \ util/threadnames.cpp \ $(BITCOIN_CORE_H) diff --git a/src/bench/bench.h b/src/bench/bench.h index bafc7f8716a1..22f06d8cb8bc 100644 --- a/src/bench/bench.h +++ b/src/bench/bench.h @@ -5,6 +5,8 @@ #ifndef BITCOIN_BENCH_BENCH_H #define BITCOIN_BENCH_BENCH_H +#include + #include #include #include @@ -12,8 +14,6 @@ #include #include -#include -#include /* * Usage: @@ -56,8 +56,8 @@ class BenchRunner static void RunAll(const Args& args); }; } -// BENCHMARK(foo) expands to: benchmark::BenchRunner bench_11foo("foo"); +// BENCHMARK(foo) expands to: benchmark::BenchRunner bench_11foo("foo", foo); #define BENCHMARK(n) \ - benchmark::BenchRunner BOOST_PP_CAT(bench_, BOOST_PP_CAT(__LINE__, n))(BOOST_PP_STRINGIZE(n), n); + benchmark::BenchRunner PASTE2(bench_, PASTE2(__LINE__, n))(STRINGIZE(n), n); #endif // BITCOIN_BENCH_BENCH_H diff --git a/src/blockfilter.cpp b/src/blockfilter.cpp index 109784137950..551486fb782c 100644 --- a/src/blockfilter.cpp +++ b/src/blockfilter.cpp @@ -29,7 +29,7 @@ uint64_t GCSFilter::HashToRange(const Element& element) const uint64_t hash = CSipHasher(m_params.m_siphash_k0, m_params.m_siphash_k1) .Write(element.data(), element.size()) .Finalize(); - return MapIntoRange(hash, m_F); + return FastRange64(hash, m_F); } std::vector GCSFilter::BuildHashedSet(const ElementSet& elements) const diff --git a/src/bloom.cpp b/src/bloom.cpp index 4003c95c5a25..b9508b3da124 100644 --- a/src/bloom.cpp +++ b/src/bloom.cpp @@ -14,6 +14,7 @@ #include