mirror of
https://github.com/yse/easy_profiler.git
synced 2024-12-28 01:04:41 +08:00
long loops instead of sleep for test.prof
This commit is contained in:
parent
36ec598697
commit
9d9cbc4413
@ -16,25 +16,31 @@ void loadingResources(){
|
|||||||
std::this_thread::sleep_for(std::chrono::milliseconds(50));
|
std::this_thread::sleep_for(std::chrono::milliseconds(50));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void prepareMath(){
|
void prepareMath(){
|
||||||
PROFILER_BEGIN_FUNCTION_BLOCK_GROUPED(profiler::colors::Blue);
|
PROFILER_BEGIN_FUNCTION_BLOCK_GROUPED(profiler::colors::Blue);
|
||||||
|
volatile int i = 0;
|
||||||
|
for (; i < 100000; ++i);
|
||||||
//std::this_thread::sleep_for(std::chrono::milliseconds(3));
|
//std::this_thread::sleep_for(std::chrono::milliseconds(3));
|
||||||
}
|
}
|
||||||
|
|
||||||
void calcIntersect(){
|
void calcIntersect(){
|
||||||
PROFILER_BEGIN_FUNCTION_BLOCK_GROUPED(profiler::colors::Blue);
|
PROFILER_BEGIN_FUNCTION_BLOCK_GROUPED(profiler::colors::Blue);
|
||||||
|
volatile int i = 0;
|
||||||
|
for (; i < 500000; ++i);
|
||||||
//std::this_thread::sleep_for(std::chrono::milliseconds(4));
|
//std::this_thread::sleep_for(std::chrono::milliseconds(4));
|
||||||
}
|
}
|
||||||
|
|
||||||
void calcPhys(){
|
void calcPhys(){
|
||||||
PROFILER_BEGIN_FUNCTION_BLOCK_GROUPED(profiler::colors::Blue);
|
PROFILER_BEGIN_FUNCTION_BLOCK_GROUPED(profiler::colors::Blue);
|
||||||
|
volatile int i = 0;
|
||||||
|
for (; i < 400000; ++i);
|
||||||
calcIntersect();
|
calcIntersect();
|
||||||
}
|
}
|
||||||
|
|
||||||
void calcBrain(){
|
void calcBrain(){
|
||||||
PROFILER_BEGIN_FUNCTION_BLOCK_GROUPED(profiler::colors::Blue);
|
PROFILER_BEGIN_FUNCTION_BLOCK_GROUPED(profiler::colors::Blue);
|
||||||
|
volatile int i = 0;
|
||||||
|
for (; i < 300000; ++i);
|
||||||
//std::this_thread::sleep_for(std::chrono::milliseconds(3));
|
//std::this_thread::sleep_for(std::chrono::milliseconds(3));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -42,22 +48,30 @@ void calculateBehavior(){
|
|||||||
PROFILER_BEGIN_FUNCTION_BLOCK_GROUPED(profiler::colors::Lightblue);
|
PROFILER_BEGIN_FUNCTION_BLOCK_GROUPED(profiler::colors::Lightblue);
|
||||||
calcPhys();
|
calcPhys();
|
||||||
calcBrain();
|
calcBrain();
|
||||||
|
volatile int i = 0;
|
||||||
|
for (; i < 150000; ++i);
|
||||||
}
|
}
|
||||||
|
|
||||||
void modellingStep(){
|
void modellingStep(){
|
||||||
PROFILER_BEGIN_FUNCTION_BLOCK_GROUPED(profiler::colors::Navy);
|
PROFILER_BEGIN_FUNCTION_BLOCK_GROUPED(profiler::colors::Navy);
|
||||||
prepareMath();
|
prepareMath();
|
||||||
calculateBehavior();
|
calculateBehavior();
|
||||||
|
volatile int i = 0;
|
||||||
|
for (; i < 100000; ++i);
|
||||||
}
|
}
|
||||||
|
|
||||||
void prepareRender(){
|
void prepareRender(){
|
||||||
PROFILER_BEGIN_FUNCTION_BLOCK_GROUPED(profiler::colors::Lightred);
|
PROFILER_BEGIN_FUNCTION_BLOCK_GROUPED(profiler::colors::Lightred);
|
||||||
|
volatile int i = 0;
|
||||||
|
for (; i < 350000; ++i);
|
||||||
//std::this_thread::sleep_for(std::chrono::milliseconds(8));
|
//std::this_thread::sleep_for(std::chrono::milliseconds(8));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void calculatePhysics(){
|
void calculatePhysics(){
|
||||||
PROFILER_BEGIN_FUNCTION_BLOCK_GROUPED(profiler::colors::Red);
|
PROFILER_BEGIN_FUNCTION_BLOCK_GROUPED(profiler::colors::Red);
|
||||||
|
volatile int i = 0;
|
||||||
|
for (; i < 400000; ++i);
|
||||||
//std::this_thread::sleep_for(std::chrono::milliseconds(8));
|
//std::this_thread::sleep_for(std::chrono::milliseconds(8));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -65,6 +79,8 @@ void frame(){
|
|||||||
PROFILER_BEGIN_FUNCTION_BLOCK_GROUPED(profiler::colors::Magenta);
|
PROFILER_BEGIN_FUNCTION_BLOCK_GROUPED(profiler::colors::Magenta);
|
||||||
prepareRender();
|
prepareRender();
|
||||||
calculatePhysics();
|
calculatePhysics();
|
||||||
|
volatile int i = 0;
|
||||||
|
for (; i < 30000; ++i);
|
||||||
}
|
}
|
||||||
|
|
||||||
void loadingResourcesThread(){
|
void loadingResourcesThread(){
|
||||||
|
Loading…
x
Reference in New Issue
Block a user