mirror of
https://github.com/yse/easy_profiler.git
synced 2024-12-27 00:31:02 +08:00
Merge branch 'develop' of https://github.com/yse/easy_profiler into develop
This commit is contained in:
commit
817083d3ff
@ -23,7 +23,7 @@ You can see the results of measuring in simple GUI application which provides fu
|
||||
|
||||
# Usage
|
||||
|
||||
First of all you can specify path to include directory which contains `include/profiler` directory.
|
||||
First of all you can specify path to include directory which contains `include/profiler` directory and define macro `BUILD_WITH_EASY_PROFILER`.
|
||||
For linking with easy_profiler you can specify path to library.
|
||||
|
||||
Example of usage.
|
||||
|
@ -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
|
||||
@ -212,7 +212,6 @@ breakdown, but if you care about that then you change set event tracing priority
|
||||
*/
|
||||
# define EASY_SET_LOW_PRIORITY_EVENT_TRACING(isLowPriority) ::profiler::setLowPriorityEventTracing(isLowPriority);
|
||||
|
||||
# ifndef _WIN32
|
||||
/** Macro for setting temporary log-file path for Unix event tracing system.
|
||||
|
||||
\note Default value is "/tmp/cs_profiling_info.log".
|
||||
@ -226,9 +225,6 @@ breakdown, but if you care about that then you change set event tracing priority
|
||||
\ingroup profiler
|
||||
*/
|
||||
# define EASY_EVENT_TRACING_LOG ::profiler::getContextSwitchLogFilename();
|
||||
# endif
|
||||
|
||||
|
||||
|
||||
// EasyProfiler settings:
|
||||
|
||||
@ -279,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(...)
|
||||
@ -303,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
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
@ -515,7 +511,6 @@ namespace profiler {
|
||||
*/
|
||||
PROFILER_API void setLowPriorityEventTracing(bool _isLowPriority);
|
||||
|
||||
#ifndef _WIN32
|
||||
/** Set temporary log-file path for Unix event tracing system.
|
||||
|
||||
\note Default value is "/tmp/cs_profiling_info.log".
|
||||
@ -529,7 +524,6 @@ namespace profiler {
|
||||
\ingroup profiler
|
||||
*/
|
||||
PROFILER_API const char* getContextSwitchLogFilename();
|
||||
#endif
|
||||
|
||||
PROFILER_API void startListenSignalToCapture();
|
||||
PROFILER_API void stopListenSignalToCapture();
|
||||
|
@ -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
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
@ -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)
|
||||
|
@ -25,6 +25,7 @@ set(SOURCES
|
||||
)
|
||||
add_definitions(
|
||||
-D_BUILD_PROFILER
|
||||
-DBUILD_WITH_EASY_PROFILER
|
||||
)
|
||||
|
||||
if(WIN32)
|
||||
|
@ -117,7 +117,6 @@ extern "C" {
|
||||
PROFILER_API void setLowPriorityEventTracing(bool) { }
|
||||
#endif
|
||||
|
||||
#ifndef _WIN32
|
||||
PROFILER_API void setContextSwitchLogFilename(const char* name)
|
||||
{
|
||||
return MANAGER.setContextSwitchLogFilename(name);
|
||||
@ -127,7 +126,6 @@ extern "C" {
|
||||
{
|
||||
return MANAGER.getContextSwitchLogFilename();
|
||||
}
|
||||
#endif
|
||||
|
||||
PROFILER_API void startListenSignalToCapture()
|
||||
{
|
||||
|
@ -345,9 +345,7 @@ class ProfileManager
|
||||
std::atomic_bool m_isEnabled;
|
||||
std::atomic_bool m_isEventTracingEnabled;
|
||||
|
||||
#ifndef _WIN32
|
||||
std::string m_csInfoFilename = "/tmp/cs_profiling_info.log";
|
||||
#endif
|
||||
|
||||
uint32_t dumpBlocksToStream(profiler::OStream& _outputStream);
|
||||
void setBlockStatus(profiler::block_id_t _id, profiler::EasyBlockStatus _status);
|
||||
@ -381,7 +379,6 @@ public:
|
||||
uint32_t dumpBlocksToFile(const char* filename);
|
||||
const char* registerThread(const char* name, profiler::ThreadGuard& threadGuard);
|
||||
|
||||
#ifndef _WIN32
|
||||
void setContextSwitchLogFilename(const char* name)
|
||||
{
|
||||
m_csInfoFilename = name;
|
||||
@ -391,7 +388,6 @@ public:
|
||||
{
|
||||
return m_csInfoFilename.c_str();
|
||||
}
|
||||
#endif
|
||||
|
||||
void beginContextSwitch(profiler::thread_id_t _thread_id, profiler::timestamp_t _time, profiler::thread_id_t _target_thread_id, const char* _target_process, bool _lockSpin = true);
|
||||
void storeContextSwitch(profiler::thread_id_t _thread_id, profiler::timestamp_t _time, profiler::thread_id_t _target_thread_id, bool _lockSpin = true);
|
||||
|
Loading…
x
Reference in New Issue
Block a user