{
qRegisterMetaType<FrameGraphicsItem*>();
- m_costSource->addItem(i18n("Allocations"), QVariant::fromValue(Allocations));
- m_costSource->setItemData(0, i18n("Show a flame graph over the number of allocations triggered by "
- "functions in your code."),
- Qt::ToolTipRole);
- m_costSource->addItem(i18n("Temporary Allocations"), QVariant::fromValue(Temporary));
- m_costSource->setItemData(1, i18n("Show a flame graph over the number of temporary allocations "
- "triggered by functions in your code. "
- "Allocations are marked as temporary when they are immediately "
- "followed by their deallocation."),
- Qt::ToolTipRole);
m_costSource->addItem(i18n("Memory Peak"), QVariant::fromValue(Peak));
- m_costSource->setItemData(2, i18n("Show a flame graph over the contributions to the peak heap "
+ m_costSource->setItemData(0, i18n("Show a flame graph over the contributions to the peak heap "
"memory consumption of your application."),
Qt::ToolTipRole);
m_costSource->addItem(i18n("Leaked"), QVariant::fromValue(Leaked));
- m_costSource->setItemData(3, i18n("Show a flame graph over the leaked heap memory of your application. "
+ m_costSource->setItemData(1, i18n("Show a flame graph over the leaked heap memory of your application. "
"Memory is considered to be leaked when it never got deallocated. "),
Qt::ToolTipRole);
- m_costSource->addItem(i18n("Allocated"), QVariant::fromValue(Allocated));
- m_costSource->setItemData(4, i18n("Show a flame graph over the total memory allocated by functions in "
- "your code. "
- "This aggregates all memory allocations and ignores deallocations."),
- Qt::ToolTipRole);
+ if(AllocationData::display == AllocationData::DisplayId::malloc)
+ {
+ m_costSource->addItem(i18n("Allocations"), QVariant::fromValue(Allocations));
+ m_costSource->setItemData(2, i18n("Show a flame graph over the number of allocations triggered by "
+ "functions in your code."),
+ Qt::ToolTipRole);
+ m_costSource->addItem(i18n("Temporary Allocations"), QVariant::fromValue(Temporary));
+ m_costSource->setItemData(3, i18n("Show a flame graph over the number of temporary allocations "
+ "triggered by functions in your code. "
+ "Allocations are marked as temporary when they are immediately "
+ "followed by their deallocation."),
+ Qt::ToolTipRole);
+ m_costSource->addItem(i18n("Allocated"), QVariant::fromValue(Allocated));
+ m_costSource->setItemData(4, i18n("Show a flame graph over the total memory allocated by functions in "
+ "your code. "
+ "This aggregates all memory allocations and ignores deallocations."),
+ Qt::ToolTipRole);
+ }
connect(m_costSource, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
&FlameGraph::showData);
m_costSource->setToolTip(i18n("Select the data source that should be visualized in the flame graph."));
format.formatByteSize(data.totalSystemMemory, 1, KFormat::MetricBinaryDialect))
<< "</dl></qt>";
}
+
+ if(AllocationData::display == AllocationData::DisplayId::malloc)
{
QTextStream stream(&textCenter);
stream << "<qt><dl>" << i18n("<dt><b>calls to allocation functions</b>:</dt><dd>%1 "
#if KChart_FOUND
addChartTab(m_ui->tabWidget, i18n("Consumed"), ChartModel::Consumed, m_parser, &Parser::consumedChartDataAvailable,
this);
- addChartTab(m_ui->tabWidget, i18n("Allocations"), ChartModel::Allocations, m_parser,
- &Parser::allocationsChartDataAvailable, this);
- addChartTab(m_ui->tabWidget, i18n("Temporary Allocations"), ChartModel::Temporary, m_parser,
- &Parser::temporaryChartDataAvailable, this);
- addChartTab(m_ui->tabWidget, i18n("Allocated"), ChartModel::Allocated, m_parser, &Parser::allocatedChartDataAvailable,
- this);
- auto sizesTab = new HistogramWidget(this);
- m_ui->tabWidget->addTab(sizesTab, i18n("Sizes"));
- m_ui->tabWidget->setTabEnabled(m_ui->tabWidget->indexOf(sizesTab), false);
- auto sizeHistogramModel = new HistogramModel(this);
- sizesTab->setModel(sizeHistogramModel);
- connect(this, &MainWindow::clearData, sizeHistogramModel, &HistogramModel::clearData);
-
- connect(m_parser, &Parser::sizeHistogramDataAvailable, this, [=](const HistogramData& data) {
- sizeHistogramModel->resetData(data);
- m_ui->tabWidget->setTabEnabled(m_ui->tabWidget->indexOf(sizesTab), true);
- });
+ if(AllocationData::display == AllocationData::DisplayId::malloc)
+ {
+ addChartTab(m_ui->tabWidget, i18n("Allocations"), ChartModel::Allocations, m_parser,
+ &Parser::allocationsChartDataAvailable, this);
+ addChartTab(m_ui->tabWidget, i18n("Temporary Allocations"), ChartModel::Temporary, m_parser,
+ &Parser::temporaryChartDataAvailable, this);
+ addChartTab(m_ui->tabWidget, i18n("Allocated"), ChartModel::Allocated, m_parser, &Parser::allocatedChartDataAvailable,
+ this);
+
+ auto sizesTab = new HistogramWidget(this);
+ m_ui->tabWidget->addTab(sizesTab, i18n("Sizes"));
+ m_ui->tabWidget->setTabEnabled(m_ui->tabWidget->indexOf(sizesTab), false);
+ auto sizeHistogramModel = new HistogramModel(this);
+ sizesTab->setModel(sizeHistogramModel);
+ connect(this, &MainWindow::clearData, sizeHistogramModel, &HistogramModel::clearData);
+
+ connect(m_parser, &Parser::sizeHistogramDataAvailable, this, [=](const HistogramData& data) {
+ sizeHistogramModel->resetData(data);
+ m_ui->tabWidget->setTabEnabled(m_ui->tabWidget->indexOf(sizesTab), true);
+ });
+ }
#endif
auto costDelegate = new CostDelegate(this);
m_ui->topPeak->setItemDelegate(costDelegate);
setupTopView(bottomUpModel, m_ui->topLeaked, TopProxy::Leaked);
m_ui->topLeaked->setItemDelegate(costDelegate);
- setupTopView(bottomUpModel, m_ui->topAllocations, TopProxy::Allocations);
- m_ui->topAllocations->setItemDelegate(costDelegate);
- setupTopView(bottomUpModel, m_ui->topTemporary, TopProxy::Temporary);
- m_ui->topTemporary->setItemDelegate(costDelegate);
- setupTopView(bottomUpModel, m_ui->topAllocated, TopProxy::Allocated);
- m_ui->topAllocated->setItemDelegate(costDelegate);
+
+ if(AllocationData::display == AllocationData::DisplayId::malloc)
+ {
+ setupTopView(bottomUpModel, m_ui->topAllocations, TopProxy::Allocations);
+ m_ui->topAllocations->setItemDelegate(costDelegate);
+ setupTopView(bottomUpModel, m_ui->topTemporary, TopProxy::Temporary);
+ m_ui->topTemporary->setItemDelegate(costDelegate);
+ setupTopView(bottomUpModel, m_ui->topAllocated, TopProxy::Allocated);
+ m_ui->topAllocated->setItemDelegate(costDelegate);
+ }
+ else
+ {
+ m_ui->widget_7->hide();
+ m_ui->widget_8->hide();
+ m_ui->widget_9->hide();
+ }
setWindowTitle(i18n("Heaptrack"));
// closing the current file shows the stack page to open a new one