Skip to content

Commit

Permalink
(GUI) Fixed wrong hierarchy tree building in "Plain mode" (not all bl…
Browse files Browse the repository at this point in the history
…ocks were added)
  • Loading branch information
cas4ey committed Dec 27, 2016
1 parent bf7bf10 commit 365d160
Showing 1 changed file with 20 additions and 8 deletions.
28 changes: 20 additions & 8 deletions profiler_gui/tree_widget_loader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -777,20 +777,32 @@ size_t EasyTreeWidgetLoader::setTreeInternalPlain(const ::profiler::BlocksTreeRo
{
++total_items;

size_t children_items_number = 0;
::profiler::timestamp_t children_duration = 0;
if (!child.children.empty())
{
children_items_number = setTreeInternalPlain(_threadRoot, _firstCswitch, _beginTime, child.children, _frame, _frame, _left, _right, _strict, children_duration, _colorizeRows, _addZeroBlocks, _units);
if (interrupted())
break;
}

if (it->second != nullptr && child.per_frame_stats != nullptr)
{
auto item = it->second;

auto children_duration = calculateChildrenDurationRecursive(child.children, it->first);
auto self_duration = item->data(COL_SELF_DURATION, Qt::UserRole).toULongLong() - children_duration;
//auto children_duration = calculateChildrenDurationRecursive(child.children, it->first);
if (children_duration != 0)
{
auto self_duration = item->data(COL_SELF_DURATION, Qt::UserRole).toULongLong() - children_duration;

int percentage = 100;
if (child.per_frame_stats->total_duration > 0)
percentage = ::profiler_gui::percent(self_duration, child.per_frame_stats->total_duration);
int percentage = 100;
if (child.per_frame_stats->total_duration > 0)
percentage = ::profiler_gui::percent(self_duration, child.per_frame_stats->total_duration);

item->setTimeSmart(COL_SELF_DURATION, _units, self_duration);
item->setData(COL_SELF_DURATION_PERCENT, Qt::UserRole, percentage);
item->setText(COL_SELF_DURATION_PERCENT, QString::number(percentage));
item->setTimeSmart(COL_SELF_DURATION, _units, self_duration);
item->setData(COL_SELF_DURATION_PERCENT, Qt::UserRole, percentage);
item->setText(COL_SELF_DURATION_PERCENT, QString::number(percentage));
}

bool hasContextSwitch = false;
::profiler::timestamp_t idleTime = 0;
Expand Down

0 comments on commit 365d160

Please sign in to comment.