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

Add color for sample application

This commit is contained in:
Sergey Yagovtsev 2016-03-04 12:17:50 +03:00
parent 691c2953a4
commit b29509c8a9

View File

@ -5,40 +5,40 @@
#include <iostream> #include <iostream>
void loadingResources(){ void loadingResources(){
PROFILER_BEGIN_FUNCTION_BLOCK; PROFILER_BEGIN_FUNCTION_BLOCK_GROUPED(profiler::colors::Lightcyan);
std::this_thread::sleep_for(std::chrono::milliseconds(500)); std::this_thread::sleep_for(std::chrono::milliseconds(500));
} }
void prepareMath(){ void prepareMath(){
PROFILER_BEGIN_FUNCTION_BLOCK; PROFILER_BEGIN_FUNCTION_BLOCK_GROUPED(profiler::colors::Blue);
std::this_thread::sleep_for(std::chrono::milliseconds(2)); std::this_thread::sleep_for(std::chrono::milliseconds(2));
} }
void calculateBehavior(){ void calculateBehavior(){
PROFILER_BEGIN_FUNCTION_BLOCK; PROFILER_BEGIN_FUNCTION_BLOCK_GROUPED(profiler::colors::Lightblue);
std::this_thread::sleep_for(std::chrono::milliseconds(3)); std::this_thread::sleep_for(std::chrono::milliseconds(3));
} }
void modellingStep(){ void modellingStep(){
PROFILER_BEGIN_FUNCTION_BLOCK; PROFILER_BEGIN_FUNCTION_BLOCK_GROUPED(profiler::colors::Navy);
prepareMath(); prepareMath();
calculateBehavior(); calculateBehavior();
std::this_thread::sleep_for(std::chrono::milliseconds(5)); std::this_thread::sleep_for(std::chrono::milliseconds(5));
} }
void prepareRender(){ void prepareRender(){
PROFILER_BEGIN_FUNCTION_BLOCK; PROFILER_BEGIN_FUNCTION_BLOCK_GROUPED(profiler::colors::Lightred);
std::this_thread::sleep_for(std::chrono::milliseconds(5)); std::this_thread::sleep_for(std::chrono::milliseconds(5));
} }
void calculatePhysics(){ void calculatePhysics(){
PROFILER_BEGIN_FUNCTION_BLOCK; PROFILER_BEGIN_FUNCTION_BLOCK_GROUPED(profiler::colors::Red);
std::this_thread::sleep_for(std::chrono::milliseconds(7)); std::this_thread::sleep_for(std::chrono::milliseconds(7));
} }
void frame(){ void frame(){
PROFILER_BEGIN_FUNCTION_BLOCK; PROFILER_BEGIN_FUNCTION_BLOCK_GROUPED(profiler::colors::Magenta);
prepareRender(); prepareRender();
calculatePhysics(); calculatePhysics();
std::this_thread::sleep_for(std::chrono::milliseconds(4)); std::this_thread::sleep_for(std::chrono::milliseconds(4));
@ -47,7 +47,7 @@ void frame(){
void loadingResourcesThread(){ void loadingResourcesThread(){
for(int i = 0; i < 10; i++){ for(int i = 0; i < 10; i++){
loadingResources(); loadingResources();
PROFILER_ADD_EVENT("Resources Loading!"); PROFILER_ADD_EVENT_GROUPED("Resources Loading!",profiler::colors::Cyan);
std::this_thread::sleep_for(std::chrono::milliseconds(2)); std::this_thread::sleep_for(std::chrono::milliseconds(2));
} }
} }