Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
bb3beeb
Added tracy profiling integration. Link with with-tracy.
eynhaender May 21, 2025
72c3f36
First instrumentation without macros
eynhaender May 21, 2025
5ec84c3
verzeichnistest
eynhaender May 21, 2025
c9cb53a
tracy korrektur
eynhaender May 21, 2025
18a86c1
tracy der nächste
eynhaender May 21, 2025
2413e4f
tracy
eynhaender May 21, 2025
2ab3edb
tracy
eynhaender May 21, 2025
08c6320
tracy
eynhaender May 21, 2025
afaeeb1
tracy wieder ganz raus
eynhaender May 21, 2025
06d87b3
tracy wieder rein
eynhaender May 21, 2025
838d7ce
tracy erweitert
eynhaender May 22, 2025
e01eb25
jetzt gehts ab
eynhaender May 22, 2025
23145d7
--with-tracy angefangen
eynhaender May 22, 2025
73e0c8c
tracy erweitert
eynhaender May 22, 2025
f13d2e0
verzeichnis korrigiert
eynhaender May 22, 2025
dc99f12
verzeichnis korrigiert
eynhaender May 22, 2025
e38bd45
verzeichnisse angepasst
eynhaender May 22, 2025
389e94f
tracy wieder raus
eynhaender May 22, 2025
882420c
build-konfiguration geändert
eynhaender May 24, 2025
266e92f
tracy wieder rein
eynhaender May 24, 2025
e94ca3b
shani raus
eynhaender May 24, 2025
1de5562
optimierungen hinzugefügt
eynhaender May 24, 2025
1da4dce
Merge branch 'libbitcoin:master' into master
eynhaender May 25, 2025
c3dc8c8
Merge branch 'libbitcoin:master' into master
eynhaender May 25, 2025
0d24b48
Compileroptionen geändert
eynhaender May 25, 2025
57fac2f
Merge branch 'libbitcoin:master' into master
eynhaender May 26, 2025
5cb2895
Boost entfernt, tracy standardmäßig aus, Kommentar hinzugefügt
eynhaender May 26, 2025
a516f92
--with-tracy eingepflegt
eynhaender May 26, 2025
f7598a8
tracy wird jetzt auch nur geholt wenn with-tracy
eynhaender May 26, 2025
55ea506
tracy in Makros verpackt
eynhaender May 26, 2025
ae52203
tracy removed
eynhaender May 26, 2025
a071a86
WITH_TRACY zu compile definitions hinzugefügt
eynhaender May 26, 2025
3189613
tracy header include umgezogen
eynhaender May 26, 2025
5e1bd18
tracy include wieder eingebaut
eynhaender May 26, 2025
18da746
schreibweise geändert
eynhaender May 26, 2025
5a5091c
built back
eynhaender May 27, 2025
b6401e4
built more back
eynhaender May 27, 2025
1ecf674
Typos
eynhaender May 27, 2025
b07026e
Built back
eynhaender May 27, 2025
d01fc6e
git repo eynhaender -> libbitcoin
eynhaender May 27, 2025
e161cb3
spaces
eynhaender May 27, 2025
fa56e77
spaces
eynhaender May 27, 2025
9bda54f
more formatting
eynhaender May 27, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 35 additions & 2 deletions builds/cmake/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,21 @@ include(CheckSymbolExists)
include(CheckCXXCompilerFlag)
include(CheckCXXSourceCompiles)
include(CheckLinkerFlag)
include(FetchContent)

# Conditionally get tracy profiler
if (with-tracy)
# Define tracy version and define the source
FetchContent_Declare(
tracy
GIT_REPOSITORY https://github.com/wolfpld/tracy.git
GIT_TAG master
GIT_SHALLOW TRUE
GIT_PROGRESS TRUE
)
# Download and make tracy available
FetchContent_MakeAvailable(tracy)
endif()

set_property(GLOBAL PROPERTY USE_FOLDERS ON)

Expand Down Expand Up @@ -148,6 +163,10 @@ set( with-tests "yes" CACHE BOOL "Compile with unit tests." )
#------------------------------------------------------------------------------
set( with-examples "yes" CACHE BOOL "Compile with examples." )

# Implement -Dwith-tracy and declare with-tracy.
#------------------------------------------------------------------------------
set( with-tracy "no" CACHE BOOL "Compile/Build with tracy profiler." )

# Implement -Dwith-icu and define BOOST_HAS_ICU and output ${icu}.
#------------------------------------------------------------------------------
set( with-icu "no" CACHE BOOL "Compile with International Components for Unicode." )
Expand Down Expand Up @@ -631,11 +650,23 @@ target_include_directories( ${CANONICAL_LIB_NAME} PRIVATE
${rt_INCLUDE_DIRS}
${icu_i18n_FOR_BUILD_INCLUDE_DIRS}
${dl_INCLUDE_DIRS}
${secp256k1_FOR_BUILD_INCLUDE_DIRS} )
${secp256k1_FOR_BUILD_INCLUDE_DIRS}
# Conditionally add tracy includes
"$<$<BOOL:${with-tracy}>:${tracy_SOURCE_DIR}/public>" )

target_include_directories( ${CANONICAL_LIB_NAME} PUBLIC
"../../include" )

# Conditionally enable tracy profiling.
#------------------------------------------------------------------------------
if (with-tracy)
target_compile_definitions( ${CANONICAL_LIB_NAME} PRIVATE
WITH_TRACY
TRACY_ENABLE
TRACY_ON_DEMAND
)
endif()

# ${CANONICAL_LIB_NAME} project specific libraries noramalization for build.
#------------------------------------------------------------------------------
if (BUILD_SHARED_LIBS)
Expand All @@ -657,7 +688,9 @@ target_link_libraries( ${CANONICAL_LIB_NAME}
${rt_LIBRARIES}
${icu_i18n_FOR_BUILD_LIBRARIES}
${dl_LIBRARIES}
${secp256k1_FOR_BUILD_LIBRARIES} )
${secp256k1_FOR_BUILD_LIBRARIES}
# Conditionally add tracy libs
"$<$<BOOL:${with-tracy}>:Tracy::TracyClient>" )

# Define libbitcoin-system-examples project.
#------------------------------------------------------------------------------
Expand Down
4 changes: 4 additions & 0 deletions include/bitcoin/system/define.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@
// Pulls in all /system headers (except settings.hpp).
#include <bitcoin/system/constraints.hpp>

#ifdef WITH_TRACY
#include <tracy/Tracy.hpp>
#endif

#if defined(HAVE_MSC)
#include <windows.h>
#endif
Expand Down
16 changes: 12 additions & 4 deletions install-cmake.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
# accesses this feature, so if you do not intend to
# use passphrase normalization this dependency can
# be avoided.
# --with-tracy Add support for tracy profiler.
# --build-icu Builds ICU libraries.
# --build-boost Builds Boost libraries.
# --build-dir=<path> Location of downloaded and intermediate files.
Expand Down Expand Up @@ -232,6 +233,7 @@ display_help()
display_message " accesses this feature, so if you do not intend to "
display_message " use passphrase normalization this dependency can "
display_message " be avoided."
display_message " --with-tracy Add support for tracy profiler."
display_message " --build-icu Build ICU libraries."
display_message " --build-boost Build Boost libraries."
display_message " --build-secp256k1 Build libsecp256k1 libraries."
Expand Down Expand Up @@ -262,11 +264,12 @@ parse_command_line_options()

# Common project options.
(--with-icu) WITH_ICU="yes";;
(--with-tracy) WITH_TRACY="yes";;

# Custom build options.
(--build-icu) BUILD_ICU="yes";;
(--build-boost) BUILD_BOOST="yes";;
(--build-secp256k1) BUILD_SECP256K1="yes";;
(--build-icu) BUILD_ICU="yes";;
(--build-boost) BUILD_BOOST="yes";;
(--build-secp256k1) BUILD_SECP256K1="yes";;

# Unique script options.
(--build-dir=*) BUILD_DIR="${OPTION#*=}";;
Expand Down Expand Up @@ -399,6 +402,12 @@ handle_custom_options()
CUMULATIVE_FILTERED_ARGS+=" --with-icu"
CUMULATIVE_FILTERED_ARGS_CMAKE+=" -Dwith-icu=yes"
fi

# Process tracy
if [[ $WITH_TRACY ]]; then
CUMULATIVE_FILTERED_ARGS+=" --with-tracy"
CUMULATIVE_FILTERED_ARGS_CMAKE+=" -Dwith-tracy=yes"
fi
}

remove_build_options()
Expand Down Expand Up @@ -985,7 +994,6 @@ BOOST_FLAGS=(
SECP256K1_FLAGS=(
"-w")


# Define build options.
#==============================================================================
# Define icu options.
Expand Down
24 changes: 23 additions & 1 deletion src/arena.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@
#include <cstdlib>
#include <bitcoin/system/constants.hpp>

#ifdef WITH_TRACY
#include <tracy/Tracy.hpp>
#endif

namespace libbitcoin {

bool operator==(const arena& left, const arena& right) NOEXCEPT
Expand All @@ -38,18 +42,36 @@ arena* default_arena::get() NOEXCEPT

void* default_arena::do_allocate(size_t bytes, size_t) THROWS
{
#ifdef WITH_TRACY
ZoneScopedN("default_arena::do_allocate");
#endif

////if (align > __STDCPP_DEFAULT_NEW_ALIGNMENT__)
//// return ::operator new(bytes, std::align_val_t{ align });
BC_PUSH_WARNING(NO_MALLOC_OR_FREE)
return std::malloc(bytes);
#ifdef WITH_TRACY
auto ptr = std::malloc(bytes);
TracyAlloc(ptr, bytes);
return ptr;
#else
return std::malloc(bytes);
#endif

BC_POP_WARNING()
}

void default_arena::do_deallocate(void* ptr, size_t, size_t) NOEXCEPT
{
#ifdef WITH_TRACY
ZoneScopedN("default_arena::do_deallocate");
#endif

////if (align > __STDCPP_DEFAULT_NEW_ALIGNMENT__)
//// ::operator delete(ptr, std::align_val_t{ align });
BC_PUSH_WARNING(NO_MALLOC_OR_FREE)
#ifdef WITH_TRACY
TracyFree(ptr);
#endif
std::free(ptr);
BC_POP_WARNING()
}
Expand Down