0
0
mirror of https://github.com/yse/easy_profiler.git synced 2024-12-26 08:01:51 +08:00

Disable EasyProfiler by default. For building with profiler define macro BUILD_WITH_EASY_PROFILER

This commit is contained in:
Sergey Yagovtsev 2016-09-29 23:08:20 +03:00
parent 5b6c9210c7
commit 477e643040
4 changed files with 12 additions and 11 deletions

View File

@ -33,7 +33,7 @@ namespace profiler {
const uint32_t EASY_FULL_VERSION = ((uint32_t)EASY_VERSION_MAJOR << 24) | ((uint32_t)EASY_VERSION_MINOR << 16) | (uint32_t)EASY_VERSION_REV;
}
#ifndef FULL_DISABLE_PROFILER
#ifdef BUILD_WITH_EASY_PROFILER
/**
\defgroup profiler EasyProfiler
@ -275,7 +275,7 @@ Otherwise, no log messages will be printed.
# define EASY_LOG_ENABLED 1
#else // #ifndef FULL_DISABLE_PROFILER
#else // #ifdef BUILD_WITH_EASY_PROFILER
# define EASY_BLOCK(...)
# define EASY_FUNCTION(...)
@ -299,7 +299,7 @@ Otherwise, no log messages will be printed.
# define EASY_LOW_PRIORITY_EVENT_TRACING true
# define EASY_LOG_ENABLED 0
#endif // #ifndef FULL_DISABLE_PROFILER
#endif // #ifndef BUILD_WITH_EASY_PROFILER
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////

View File

@ -48,18 +48,16 @@ namespace profiler {
FORCE_ON_WITHOUT_CHILDREN = FORCE_ON | OFF_RECURSIVE, ///< The block is ALWAYS ON but all of it's children are OFF.
};
struct passthrough_hash EASY_FINAL {
template <class T> inline size_t operator () (T _value) const {
return static_cast<size_t>(_value);
}
struct passthrough_hash EASY_FINAL {
template <class T> inline size_t operator () (T _value) const {
return static_cast<size_t>(_value);
}
};
}
//////////////////////////////////////////////////////////////////////////
#ifndef FULL_DISABLE_PROFILER
#include <type_traits>
# define EASY_STRINGIFY(a) #a
@ -69,6 +67,8 @@ namespace profiler {
# define EASY_UNIQUE_BLOCK(x) EASY_TOKEN_CONCATENATE(unique_profiler_mark_name_, x)
# define EASY_UNIQUE_DESC(x) EASY_TOKEN_CONCATENATE(unique_profiler_descriptor_, x)
#ifdef BUILD_WITH_EASY_PROFILER
namespace profiler {
template <const bool IS_REF> struct NameSwitch EASY_FINAL {
@ -138,7 +138,7 @@ namespace profiler {
# define EASY_COMPILETIME_NAME(name) ::profiler::NameSwitch<::std::is_reference<decltype(name)>::value>::compiletime_name(name, EASY_UNIQUE_LINE_ID)
# define EASY_RUNTIME_NAME(name) ::profiler::NameSwitch<::std::is_reference<decltype(name)>::value>::runtime_name(name)
#endif // FULL_DISABLE_PROFILER
#endif // BUILD_WITH_EASY_PROFILER
//////////////////////////////////////////////////////////////////////////

View File

@ -22,4 +22,4 @@ endif(UNIX)
target_link_libraries(${PROJECT_NAME} easy_profiler ${SPEC_LIB})
target_link_libraries(${DISABLED_PROFILER_NAME} easy_profiler ${SPEC_LIB})
target_compile_definitions(${DISABLED_PROFILER_NAME} PRIVATE FULL_DISABLE_PROFILER)
target_compile_definitions(${PROJECT_NAME} PRIVATE BUILD_WITH_EASY_PROFILER)

View File

@ -25,6 +25,7 @@ set(SOURCES
)
add_definitions(
-D_BUILD_PROFILER
-DBUILD_WITH_EASY_PROFILER
)
if(WIN32)