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

Add profiling blocks for reader

This commit is contained in:
Sergey Yagovtsev 2016-07-04 22:53:48 +03:00
parent 82e9920e15
commit 23a94d94e2

View File

@ -148,6 +148,7 @@ extern "C"{
unsigned int blocks_counter = 0;
while (!inFile.eof()){
PROFILER_BEGIN_BLOCK("Read block from file")
uint16_t sz = 0;
inFile.read((char*)&sz, sizeof(sz));
if (sz == 0)
@ -176,6 +177,7 @@ extern "C"{
{
//auto lower = std::lower_bound(root.children.begin(), root.children.end(), tree);
/**/
PROFILER_BEGIN_BLOCK("Find children")
auto rlower1 = ++root.children.rbegin();
for(; rlower1 != root.children.rend(); ++rlower1){
if(mt0 > rlower1->node->block()->getBegin())
@ -190,6 +192,7 @@ extern "C"{
if (gather_statistics)
{
PROFILER_BEGIN_BLOCK("Gather statistic for frame")
frame_statistics.clear();
//frame_statistics.reserve(tree.children.size()); // this gives slow-down on Windows
@ -216,12 +219,13 @@ extern "C"{
if (gather_statistics)
{
PROFILER_BEGIN_BLOCK("Gather statistic")
BlocksTree& current = root.children.back();
update_statistics(overall_statistics, current.node, current.total_statistics);
}
}
PROFILER_BEGIN_BLOCK("Gather statistic for roots")
if (gather_statistics)
{
for (auto& root : threaded_trees)
@ -246,7 +250,7 @@ extern "C"{
root.second.total_children_number += static_cast<unsigned int>(root.second.children.size());
}
}
PROFILER_END_BLOCK
// No need to delete BlockStatistics instances - they will be deleted on BlocksTree destructors
return blocks_counter;