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

Added function beginBlock

This commit is contained in:
Sergey Yagovtsev 2016-02-18 00:45:13 +03:00
parent a5730169cc
commit d643242885
3 changed files with 14 additions and 2 deletions

View File

@ -33,10 +33,10 @@ along with this program.If not, see <http://www.gnu.org/licenses/>.
profiler::registerMark(&TOKEN_CONCATENATE(unique_profiler_mark_name_,__LINE__)); profiler::registerMark(&TOKEN_CONCATENATE(unique_profiler_mark_name_,__LINE__));
#define PROFILER_BEGIN_BLOCK(name) profiler::Block TOKEN_CONCATENATE(unique_profiler_mark_name_,__LINE__)(name);\ #define PROFILER_BEGIN_BLOCK(name) profiler::Block TOKEN_CONCATENATE(unique_profiler_mark_name_,__LINE__)(name);\
profiler::registerMark(&TOKEN_CONCATENATE(unique_profiler_mark_name_,__LINE__)); profiler::beginBlock(&TOKEN_CONCATENATE(unique_profiler_mark_name_,__LINE__));
#define PROFILER_BEGIN_BLOCK_GROUPED(name,block_group) profiler::Block TOKEN_CONCATENATE(unique_profiler_mark_name_,__LINE__)(name,block_group);\ #define PROFILER_BEGIN_BLOCK_GROUPED(name,block_group) profiler::Block TOKEN_CONCATENATE(unique_profiler_mark_name_,__LINE__)(name,block_group);\
profiler::registerMark(&TOKEN_CONCATENATE(unique_profiler_mark_name_,__LINE__)); profiler::beginBlock(&TOKEN_CONCATENATE(unique_profiler_mark_name_,__LINE__));
#define PROFILER_BEGIN_FUNCTION_BLOCK PROFILER_BEGIN_BLOCK(__func__) #define PROFILER_BEGIN_FUNCTION_BLOCK PROFILER_BEGIN_BLOCK(__func__)
@ -68,6 +68,7 @@ namespace profiler
extern "C"{ extern "C"{
void PROFILER_API registerMark(Mark* _mark); void PROFILER_API registerMark(Mark* _mark);
void PROFILER_API beginBlock(Block* _block);
void PROFILER_API endBlock(); void PROFILER_API endBlock();
void PROFILER_API setEnabled(bool isEnable); void PROFILER_API setEnabled(bool isEnable);

View File

@ -21,6 +21,11 @@ extern "C"{
{ {
ProfileManager::instance()->setEnabled(isEnable); ProfileManager::instance()->setEnabled(isEnable);
} }
void PROFILER_API beginBlock(Block* _block)
{
ProfileManager::instance()->beginBlock(_block);
}
} }
@ -45,6 +50,11 @@ void ProfileManager::registerMark(profiler::Mark* _mark)
} }
void ProfileManager::beginBlock(profiler::Block* _block)
{
}
void ProfileManager::endBlock() void ProfileManager::endBlock()
{ {

View File

@ -33,6 +33,7 @@ public:
static ProfileManager* instance(); static ProfileManager* instance();
void registerMark(profiler::Mark* _mark); void registerMark(profiler::Mark* _mark);
void beginBlock(profiler::Block* _block);
void endBlock(); void endBlock();
void setEnabled(bool isEnable); void setEnabled(bool isEnable);
}; };