0
0
mirror of https://github.com/yse/easy_profiler.git synced 2024-12-27 08:41:02 +08:00

Merge branch 'develop' of https://github.com/yse/easy_profiler into develop

This commit is contained in:
Victor Zarubkin 2016-09-29 23:20:48 +03:00
commit 817083d3ff
7 changed files with 13 additions and 24 deletions

View File

@ -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.

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
@ -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();

View File

@ -58,8 +58,6 @@ namespace profiler {
//////////////////////////////////////////////////////////////////////////
#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)

View File

@ -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()
{

View File

@ -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);