mirror of
https://github.com/yse/easy_profiler.git
synced 2025-01-14 00:27:55 +08:00
Disable EasyProfiler by default. For building with profiler define macro BUILD_WITH_EASY_PROFILER
This commit is contained in:
parent
5b6c9210c7
commit
477e643040
@ -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;
|
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
|
\defgroup profiler EasyProfiler
|
||||||
@ -275,7 +275,7 @@ Otherwise, no log messages will be printed.
|
|||||||
# define EASY_LOG_ENABLED 1
|
# define EASY_LOG_ENABLED 1
|
||||||
|
|
||||||
|
|
||||||
#else // #ifndef FULL_DISABLE_PROFILER
|
#else // #ifdef BUILD_WITH_EASY_PROFILER
|
||||||
|
|
||||||
# define EASY_BLOCK(...)
|
# define EASY_BLOCK(...)
|
||||||
# define EASY_FUNCTION(...)
|
# define EASY_FUNCTION(...)
|
||||||
@ -299,7 +299,7 @@ Otherwise, no log messages will be printed.
|
|||||||
# define EASY_LOW_PRIORITY_EVENT_TRACING true
|
# define EASY_LOW_PRIORITY_EVENT_TRACING true
|
||||||
# define EASY_LOG_ENABLED 0
|
# define EASY_LOG_ENABLED 0
|
||||||
|
|
||||||
#endif // #ifndef FULL_DISABLE_PROFILER
|
#endif // #ifndef BUILD_WITH_EASY_PROFILER
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -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.
|
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 {
|
struct passthrough_hash EASY_FINAL {
|
||||||
template <class T> inline size_t operator () (T _value) const {
|
template <class T> inline size_t operator () (T _value) const {
|
||||||
return static_cast<size_t>(_value);
|
return static_cast<size_t>(_value);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifndef FULL_DISABLE_PROFILER
|
|
||||||
|
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
|
|
||||||
# define EASY_STRINGIFY(a) #a
|
# 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_BLOCK(x) EASY_TOKEN_CONCATENATE(unique_profiler_mark_name_, x)
|
||||||
# define EASY_UNIQUE_DESC(x) EASY_TOKEN_CONCATENATE(unique_profiler_descriptor_, x)
|
# define EASY_UNIQUE_DESC(x) EASY_TOKEN_CONCATENATE(unique_profiler_descriptor_, x)
|
||||||
|
|
||||||
|
#ifdef BUILD_WITH_EASY_PROFILER
|
||||||
|
|
||||||
namespace profiler {
|
namespace profiler {
|
||||||
|
|
||||||
template <const bool IS_REF> struct NameSwitch EASY_FINAL {
|
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_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)
|
# 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
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
@ -22,4 +22,4 @@ endif(UNIX)
|
|||||||
target_link_libraries(${PROJECT_NAME} easy_profiler ${SPEC_LIB})
|
target_link_libraries(${PROJECT_NAME} easy_profiler ${SPEC_LIB})
|
||||||
target_link_libraries(${DISABLED_PROFILER_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)
|
||||||
|
@ -25,6 +25,7 @@ set(SOURCES
|
|||||||
)
|
)
|
||||||
add_definitions(
|
add_definitions(
|
||||||
-D_BUILD_PROFILER
|
-D_BUILD_PROFILER
|
||||||
|
-DBUILD_WITH_EASY_PROFILER
|
||||||
)
|
)
|
||||||
|
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user