return i18n("Memory Allocated");
case Allocations:
return i18n("Memory Allocations");
- case Leaked:
- return i18n("Memory Leaked");
+ case Consumed:
+ return i18n("Memory Consumed");
}
}
}
if ( role == KChart::LineAttributesRole ) {
KChart::LineAttributes attributes;
attributes.setDisplayArea(true);
-// if (index == m_selection) {
-// attributes.setTransparency(255);
-// } else {
+ if (index.column() > 1) {
+ attributes.setTransparency(127);
+ } else {
attributes.setTransparency(50);
-// }
+ }
return QVariant::fromValue(attributes);
}
Q_OBJECT
public:
enum Type {
- Leaked,
+ Consumed,
Allocations,
Allocated,
};
#include "chartproxy.h"
#include "chartmodel.h"
-#include <KLocalizedString>
-
-#include <QDebug>
-
ChartProxy::ChartProxy(bool showTotal, QObject* parent)
: QSortFilterProxyModel(parent)
, m_showTotal(showTotal)
ChartProxy::~ChartProxy() = default;
-/*
-QVariant ChartProxy::data(const QModelIndex& proxyIndex, int role) const
-{
- static_assert(ChartModel::TimeStampColumn == 0, "The code below assumes the time stamp column comes with value 0.");
- if (role == Qt::ToolTipRole) {
- // KChart queries the tooltip for the timestamp column, which is not useful for us
- // instead, we want to use the m_column, or in proxy column value that is 1
- return QSortFilterProxyModel::data(index(proxyIndex.row(), proxyIndex.column() + 1, proxyIndex.parent()), role);
- } else {
- return QSortFilterProxyModel::data(proxyIndex, role);
- }
-}*/
-
bool ChartProxy::filterAcceptsColumn(int sourceColumn, const QModelIndex& /*sourceParent*/) const
{
if (m_showTotal && sourceColumn >= 2)
explicit ChartProxy(bool showTotal, QObject* parent = nullptr);
virtual ~ChartProxy();
-// QVariant data(const QModelIndex & proxyIndex, int role = Qt::DisplayRole) const override;
-
protected:
bool filterAcceptsColumn(int sourceColumn, const QModelIndex& sourceParent) const override;
m_ui->loadingProgress->setMinimum(0);
m_ui->loadingProgress->setMaximum(0);
- auto leakedModel = new ChartModel(ChartModel::Leaked, this);
- m_ui->leakedTab->setModel(leakedModel);
+ auto consumedModel = new ChartModel(ChartModel::Consumed, this);
+ m_ui->consumedTab->setModel(consumedModel);
auto allocationsModel = new ChartModel(ChartModel::Allocations, this);
m_ui->allocationsTab->setModel(allocationsModel);
auto allocatedModel = new ChartModel(ChartModel::Allocated, this);
m_bottomUpModel, &TreeModel::resetData);
connect(m_parser, &Parser::topDownDataAvailable,
m_topDownModel, &TreeModel::resetData);
- connect(m_parser, &Parser::leakedChartDataAvailable,
- leakedModel, &ChartModel::resetData);
+ connect(m_parser, &Parser::consumedChartDataAvailable,
+ consumedModel, &ChartModel::resetData);
connect(m_parser, &Parser::allocatedChartDataAvailable,
allocatedModel, &ChartModel::resetData);
connect(m_parser, &Parser::allocationsChartDataAvailable,
</item>
</layout>
</widget>
- <widget class="ChartWidget" name="leakedTab">
+ <widget class="ChartWidget" name="consumedTab">
<attribute name="title">
- <string>Leaked</string>
+ <string>Consumed</string>
</attribute>
</widget>
<widget class="ChartWidget" name="allocationsTab">
struct ChartMergeData
{
QString function;
- quint64 leaked;
+ quint64 consumed;
quint64 allocations;
quint64 allocated;
bool operator<(const QString& rhs) const
ParserData()
{
// start off with null data at the origin
- leakedChartData.data.rows.push_back({});
+ consumedChartData.data.rows.push_back({});
allocatedChartData.data.rows.push_back({});
allocationsChartData.data.rows.push_back({});
// index 0 indicates the total row
- leakedChartData.labelIds.insert(i18n("total"), 0);
+ consumedChartData.labelIds.insert(i18n("total"), 0);
allocatedChartData.labelIds.insert(i18n("total"), 0);
allocationsChartData.labelIds.insert(i18n("total"), 0);
}
void handleTimeStamp(uint64_t /*oldStamp*/, uint64_t newStamp)
{
stringCache.update(strings);
- maxLeakedSinceLastTimeStamp = max(maxLeakedSinceLastTimeStamp, leaked);
- ChartRows leakedData;
- leakedData.timeStamp = newStamp;
- leakedData.cost.insert(0, maxLeakedSinceLastTimeStamp);
- ChartRows allocationsData;
- allocationsData.timeStamp = newStamp;
- allocationsData.cost.insert(0, totalAllocations);
+ maxConsumedSinceLastTimeStamp = max(maxConsumedSinceLastTimeStamp, leaked);
// merge data for top 10 functions in this timestamp
vector<ChartMergeData> mergedData;
if (it != mergedData.end() && it->function == function) {
it->allocated += allocation.allocated;
it->allocations += allocation.allocations;
- it->leaked += allocation.leaked;
+ it->consumed += allocation.leaked;
} else {
it = mergedData.insert(it, {function, allocation.leaked, allocation.allocations, allocation.allocated});
}
}
}
};
- addChartData(&ChartMergeData::leaked, &leakedChartData, maxLeakedSinceLastTimeStamp);
+ addChartData(&ChartMergeData::consumed, &consumedChartData, maxConsumedSinceLastTimeStamp);
addChartData(&ChartMergeData::allocated, &allocatedChartData, totalAllocated);
addChartData(&ChartMergeData::allocations, &allocationsChartData, totalAllocations);
- maxLeakedSinceLastTimeStamp = 0;
+ maxConsumedSinceLastTimeStamp = 0;
}
void handleAllocation()
{
- maxLeakedSinceLastTimeStamp = max(maxLeakedSinceLastTimeStamp, leaked);
+ maxConsumedSinceLastTimeStamp = max(maxConsumedSinceLastTimeStamp, leaked);
}
void handleDebuggee(const char* command)
ChartData data;
QHash<QString, int> labelIds;
};
- ChartDataWithLabels leakedChartData;
+ ChartDataWithLabels consumedChartData;
ChartDataWithLabels allocationsChartData;
ChartDataWithLabels allocatedChartData;
- uint64_t maxLeakedSinceLastTimeStamp = 0;
+ uint64_t maxConsumedSinceLastTimeStamp = 0;
StringCache stringCache;
};
emit summaryAvailable(generateSummary(data));
const auto mergedAllocations = mergeAllocations(data);
emit bottomUpDataAvailable(mergedAllocations);
- emit leakedChartDataAvailable(data.leakedChartData.data);
+ emit consumedChartDataAvailable(data.consumedChartData.data);
emit allocationsChartDataAvailable(data.allocationsChartData.data);
emit allocatedChartDataAvailable(data.allocatedChartData.data);
const auto topDownData = toTopDownData(mergedAllocations);
void summaryAvailable(const QString& summary);
void bottomUpDataAvailable(const TreeData& data);
void topDownDataAvailable(const TreeData& data);
- void leakedChartDataAvailable(const ChartData& data);
+ void consumedChartDataAvailable(const ChartData& data);
void allocationsChartDataAvailable(const ChartData& data);
void allocatedChartDataAvailable(const ChartData& data);
void flameGraphDataAvailable(FrameGraphicsItem* rootItem);