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

Added empty profiler macros. Enabled if defined FULL_DISABLE_PROFILER definition

This commit is contained in:
Sergey Yagovtsev 2016-02-18 23:50:06 +03:00
parent dbe5af1125
commit 2bba307998
2 changed files with 13 additions and 2 deletions

View File

@ -26,6 +26,7 @@ along with this program.If not, see <http://www.gnu.org/licenses/>.
#define __func__ __FUNCTION__ #define __func__ __FUNCTION__
#endif #endif
#ifndef FULL_DISABLE_PROFILER
#define PROFILER_ADD_MARK(name) profiler::Mark TOKEN_CONCATENATE(unique_profiler_mark_name_,__LINE__)(name);\ #define PROFILER_ADD_MARK(name) profiler::Mark TOKEN_CONCATENATE(unique_profiler_mark_name_,__LINE__)(name);\
profiler::registerMark(&TOKEN_CONCATENATE(unique_profiler_mark_name_,__LINE__)); profiler::registerMark(&TOKEN_CONCATENATE(unique_profiler_mark_name_,__LINE__));
@ -48,6 +49,18 @@ along with this program.If not, see <http://www.gnu.org/licenses/>.
#define PROFILER_DISABLE profiler::setEnabled(false); #define PROFILER_DISABLE profiler::setEnabled(false);
#else
#define PROFILER_ADD_MARK(name)
#define PROFILER_ADD_MARK_GROUPED(name,block_group)
#define PROFILER_BEGIN_BLOCK(name)
#define PROFILER_BEGIN_BLOCK_GROUPED(name,block_group)
#define PROFILER_BEGIN_FUNCTION_BLOCK PROFILER_BEGIN_BLOCK(__func__)
#define PROFILER_BEGIN_FUNCTION_BLOCK_GROUPED(block_group) PROFILER_BEGIN_BLOCK_GROUPED(__func__,block_group)
#define PROFILER_END_BLOCK profiler::endBlock();
#define PROFILER_ENABLE profiler::setEnabled(true);
#define PROFILER_DISABLE profiler::setEnabled(false);
#endif
#include <stdint.h> #include <stdint.h>
#include <cstddef> #include <cstddef>

View File

@ -1,5 +1,4 @@
#include "profile_manager.h" #include "profile_manager.h"
#include "profiler/profiler.h"
#include <thread> #include <thread>
@ -74,7 +73,6 @@ void ProfileManager::endBlock()
if (lastBlock && !lastBlock->isFinished()){ if (lastBlock && !lastBlock->isFinished()){
lastBlock->finish(); lastBlock->finish();
} }
stackOfOpenedBlocks.pop(); stackOfOpenedBlocks.pop();
} }