Skip to content

Commit

Permalink
Rename deactivate cmake flags
Browse files Browse the repository at this point in the history
  • Loading branch information
G-071 committed Aug 23, 2023
1 parent 6457301 commit b012fd7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
18 changes: 10 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ set(CPPUDDLE_WITH_NUMBER_BUCKETS "128" CACHE STRING "Number of internal recycle
option(CPPUDDLE_WITH_COUNTERS "Turns on allocations counters. Useful for extended testing" OFF)
option(CPPUDDLE_WITH_TESTS "Build tests/examples" OFF)
set(CPPUDDLE_WITH_DEADLOCK_TEST_REPETITONS "100000" CACHE STRING "Number of repetitions for the aggregation executor deadlock tests")
option(CPPUDDLE_DEACTIVATE_BUFFER_RECYCLING "Deactivates the default recycling behaviour" OFF)
option(CPPUDDLE_DEACTIVATE_AGGRESSIVE_ALLOCATORS "Deactivates the aggressive allocators" OFF)
option(CPPUDDLE_WITH_BUFFER_RECYCLING "Enables the default recycling behaviour! Turning this off will have a major negative performance impact and is only intended for testing!" ON)
option(CPPUDDLE_WITH_AGGRESSIVE_CONTENT_RECYCLING "Allows the aggressive allocators variants to reuse contents from previous buffers (and thus skip initializations)" ON)
# Tooling options
option(CPPUDDLE_WITH_CLANG_TIDY "Enable clang tidy warnings" OFF)
option(CPPUDDLE_WITH_CLANG_FORMAT "Enable clang format target" OFF)
Expand Down Expand Up @@ -213,16 +213,18 @@ else()
message(INFO " Compiling with std::mutex!")
endif()

if(CPPUDDLE_DEACTIVATE_BUFFER_RECYCLING)
target_compile_definitions(buffer_manager INTERFACE "CPPUDDLE_DEACTIVATE_BUFFER_RECYCLING")
message(WARNING " Slow Build: Buffer recycling is deactivated. This should only be used for performance tests!")
else()
if(CPPUDDLE_WITH_BUFFER_RECYCLING)
message(INFO " Using default buffer recycling behaviour!")
else()
message(WARNING " Slow Build: Buffer recycling is deactivated. This should only be used for performance tests!")
target_compile_definitions(buffer_manager INTERFACE "CPPUDDLE_DEACTIVATE_BUFFER_RECYCLING")
endif()

if(CPPUDDLE_DEACTIVATE_AGGRESSIVE_ALLOCATORS)
if(CPPUDDLE_WITH_AGGRESSIVE_CONTENT_RECYCLING)
message(INFO " Using default behaviour for aggressive content reusage (only relevant for aggressive allocators)!")
else()
target_compile_definitions(buffer_manager INTERFACE "CPPUDDLE_DEACTIVATE_AGGRESSIVE_ALLOCATORS")
message(WARNING " Slow Build: Aggressive allocators disabled. This should only be used for performance tests!")
message(WARNING " Slow Build: Aggressive allocators (and thus content recycling) is disabled. This should only be used for performance tests!")
endif()

# install libs with the defitions:
Expand Down
4 changes: 2 additions & 2 deletions include/buffer_manager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class buffer_recycler {
// Warn about suboptimal performance without recycling
#pragma message \
"Warning: Building without buffer recycling! Use only for performance testing! \
For better performance configure CPPuddle with CPPUDDLE_DEACTIVATE_BUFFER_RECYCLING=OFF!"
For better performance configure CPPuddle with CPPUDDLE_WITH_BUFFER_RECYCLING=ON!"

template <typename T, typename Host_Allocator>
static T *get(size_t number_elements, bool manage_content_lifetime = false,
Expand Down Expand Up @@ -887,7 +887,7 @@ struct aggressive_recycle_allocator {
// Warn about suboptimal performance without recycling
#pragma message \
"Warning: Building without content reusage for aggressive allocators! \
For better performance configure with CPPUDDLE_DEACTIVATE_AGGRESSIVE_ALLOCATORS=OFF !"
For better performance configure with CPPUDDLE_WITH_AGGRESSIVE_CONTENT_RECYCLING=ON !"
template <typename... Args>
inline void construct(T *p, Args... args) noexcept {
::new (static_cast<void *>(p)) T(std::forward<Args>(args)...);
Expand Down

0 comments on commit b012fd7

Please sign in to comment.