const qreal y_margin = 2.;
const qreal y = pos.y() - h - y_margin;
qreal x = pos.x();
- // TODO: check this algorithm for differential flamegraphs
foreach (auto child, parent->childItems()) {
auto frameChild = static_cast<FrameGraphicsItem*>(child);
- const qreal w = std::abs(maxWidth * double(frameChild->cost()) / parent->cost());
+ const qreal w = maxWidth * double(frameChild->cost()) / parent->cost();
frameChild->setVisible(w > 1);
if (frameChild->isVisible()) {
frameChild->setRect(QRectF(x, y, w, h));
} else {
item->setCost(item->cost() + row.cost.*member);
}
- if (std::abs(item->cost()) > costThreshold) {
+ if (item->cost() > costThreshold) {
toGraphicsItems(row.children, item, member, costThreshold);
}
}
auto rootItem = new FrameGraphicsItem(totalCost, type, label);
rootItem->setBrush(scheme.background());
rootItem->setPen(pen);
- toGraphicsItems(topDownData, rootItem, member, std::abs(totalCost) * costThreshold / 100.);
+ toGraphicsItems(topDownData, rootItem, member, totalCost * costThreshold / 100.);
return rootItem;
}
connect(m_parser, &Parser::bottomUpDataAvailable,
this, [=] (const TreeData& data) {
bottomUpModel->resetData(data);
- m_ui->flameGraphTab->setBottomUpData(data);
+ if (!m_diffMode) {
+ m_ui->flameGraphTab->setBottomUpData(data);
+ }
m_ui->progressLabel->setAlignment(Qt::AlignVCenter | Qt::AlignRight);
statusBar()->addWidget(m_ui->progressLabel, 1);
statusBar()->addWidget(m_ui->loadingProgress);
connect(m_parser, &Parser::topDownDataAvailable,
this, [=] (const TreeData& data) {
topDownModel->resetData(data);
- m_ui->flameGraphTab->setTopDownData(data);
m_ui->tabWidget->setTabEnabled(m_ui->tabWidget->indexOf(m_ui->topDownTab), true);
- m_ui->tabWidget->setTabEnabled(m_ui->tabWidget->indexOf(m_ui->flameGraphTab), true);
+ if (!m_diffMode) {
+ m_ui->flameGraphTab->setTopDownData(data);
+ }
+ m_ui->tabWidget->setTabEnabled(m_ui->tabWidget->indexOf(m_ui->flameGraphTab), !m_diffMode);
});
connect(m_parser, &Parser::consumedChartDataAvailable,
this, [=] (const ChartData& data) {
if (diffBase.isEmpty()) {
setWindowTitle(i18nc("%1: file name that is open", "Heaptrack - %1",
QFileInfo(file).fileName()));
+ m_diffMode = false;
} else {
setWindowTitle(i18nc("%1, %2: file names that are open", "Heaptrack - %1 compared to %2",
QFileInfo(file).fileName(), QFileInfo(diffBase).fileName()));
+ m_diffMode = true;
}
m_ui->pages->setCurrentWidget(m_ui->loadingPage);
m_parser->parse(file, diffBase);