Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the timers macro, configure it with a cmake option #1914

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 5 additions & 0 deletions cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ option(
option(ARCTICDB_USING_ADDRESS_SANITIZER "Enable address sanitizer." OFF)
option(ARCTICDB_USING_THREAD_SANITIZER "Enable thread sanitizer." OFF)
option(ARCTICDB_USING_UB_SANITIZER "Enable undefined behavior sanitizer." OFF)
option(ARCTICDB_LOG_PERFORMANCE "Whether to log performance timings." OFF)

set(ARCTICDB_SANITIZER_FLAGS)
if(${ARCTICDB_USING_ADDRESS_SANITIZER})
Expand All @@ -42,6 +43,10 @@ if(${ARCTICDB_USING_UB_SANITIZER})
message(STATUS "Building ArcticDB with UB Sanitizer")
endif()

if(${ARCTICDB_LOG_PERFORMANCE})
add_compile_definitions(ARCTICDB_LOG_PERFORMANCE)
endif()

if(ARCTICDB_SANITIZER_FLAGS)
list(APPEND ARCTICDB_SANITIZER_FLAGS "-g;-fno-omit-frame-pointer;-fno-optimize-sibling-calls;")
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
Expand Down
8 changes: 4 additions & 4 deletions cpp/arcticdb/entity/performance_tracing.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,22 +88,22 @@ void set_remotery_thread_name(const char* task_name);

#elif defined(ARCTICDB_LOG_PERFORMANCE)
#define ARCTICDB_SAMPLE(name, flags) \
arcticdb::ScopedTimer timer{#name, [](auto msg) { \
arcticdb::ScopedTimer _timer{#name, [](auto msg) { \
std::cout << msg; \
}};

#define ARCTICDB_SUBSAMPLE(name, flags) \
arcticdb::ScopedTimer sub_timer_##name{#name, [](auto msg) { \
arcticdb::ScopedTimer _sub_timer_##name{#name, [](auto msg) { \
std::cout << msg; \
}};

#define ARCTICDB_SAMPLE_DEFAULT(name) \
arcticdb::ScopedTimer default_timer{#name, [](auto msg) { \
arcticdb::ScopedTimer _default_timer{#name, [](auto msg) { \
std::cout << msg; \
}};

#define ARCTICDB_SUBSAMPLE_DEFAULT(name) \
arcticdb::ScopedTimer sub_timer_##name{#name, [](auto msg) { \
arcticdb::ScopedTimer _sub_timer_##name{#name, [](auto msg) { \
std::cout << msg; \
}};

Expand Down
Loading