diff --git a/src/models/costdelegate.cpp b/src/models/costdelegate.cpp index 69af56f5..96f6e082 100644 --- a/src/models/costdelegate.cpp +++ b/src/models/costdelegate.cpp @@ -44,13 +44,13 @@ CostDelegate::~CostDelegate() = default; void CostDelegate::paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const { // TODO: handle negative values - const auto cost = index.data(m_sortRole).toULongLong(); + const auto cost = index.data(m_sortRole).toLongLong(); if (cost == 0) { QStyledItemDelegate::paint(painter, option, index); return; } - const auto totalCost = index.data(m_totalCostRole).toULongLong(); + const auto totalCost = index.data(m_totalCostRole).toLongLong(); const auto fraction = std::abs(float(cost) / totalCost); auto rect = option.rect; diff --git a/src/models/data.h b/src/models/data.h index 4dc63523..7487e6c2 100644 --- a/src/models/data.h +++ b/src/models/data.h @@ -278,12 +278,12 @@ class Costs m_totalCosts = rhs.m_totalCosts; } - QString formatCost(int type, quint64 cost) const + QString formatCost(int type, qint64 cost) const { return formatCost(m_units[type], cost); } - static QString formatCost(Unit unit, quint64 cost) + static QString formatCost(Unit unit, qint64 cost) { switch (unit) { case Unit::Time: @@ -408,7 +408,7 @@ struct BottomUpResults // callback return type is ignored, all frames will be iterated over template - const BottomUp* addEvent(int type, quint64 cost, const QVector& frames, FrameCallback frameCallback) + const BottomUp* addEvent(int type, qint64 cost, const QVector& frames, FrameCallback frameCallback) { costs.addTotalCost(type, cost); auto parent = &root; diff --git a/src/models/topproxy.cpp b/src/models/topproxy.cpp index 107b5e8e..52291fd5 100644 --- a/src/models/topproxy.cpp +++ b/src/models/topproxy.cpp @@ -66,7 +66,7 @@ bool TopProxy::filterAcceptsRow(int source_row, const QModelIndex& source_parent if (source_parent.isValid()) { return false; } - if (!sourceModel()->index(source_row, m_costColumn, source_parent).data(sortRole()).value()) { + if (!sourceModel()->index(source_row, m_costColumn, source_parent).data(sortRole()).value()) { return false; } return true; diff --git a/src/parsers/perf/perfparser.cpp b/src/parsers/perf/perfparser.cpp index 1f154f9d..cff64793 100644 --- a/src/parsers/perf/perfparser.cpp +++ b/src/parsers/perf/perfparser.cpp @@ -1543,7 +1543,7 @@ void PerfParser::startParseFile(const QString& path, const QString& diffFile) this->m_callerCalleeResults = {}; const auto diffResults = - Data::BottomUpResults::mergeBottomUpResults(m_bottomUpResults, otherResults); + Data::BottomUpResults::diffBottomUpResults(m_bottomUpResults, otherResults); m_bottomUpResults = diffResults; const auto topDown = Data::TopDownResults::fromBottomUp(diffResults); Data::CallerCalleeResults callerCalleeResults; @@ -1558,7 +1558,7 @@ void PerfParser::startParseFile(const QString& path, const QString& diffFile) this->m_callerCalleeResults = {}; const auto diffResults = - Data::BottomUpResults::mergeBottomUpResults(results, otherResults); + Data::BottomUpResults::diffBottomUpResults(results, otherResults); const auto topDown = Data::TopDownResults::fromBottomUp(diffResults); Data::CallerCalleeResults callerCalleeResults; Data::callerCalleesFromBottomUpData(diffResults, &callerCalleeResults); diff --git a/src/util.cpp b/src/util.cpp index 489f2783..fd132a28 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -136,13 +136,13 @@ QString Util::formatSymbol(const Data::Symbol& symbol, bool replaceEmptyString) return formatString(symbolString, replaceEmptyString); } -QString Util::formatCost(quint64 cost) +QString Util::formatCost(qint64 cost) { // resulting format: 1.234E56 return QString::number(static_cast(cost), 'G', 4); } -QString Util::formatCostRelative(quint64 selfCost, quint64 totalCost, bool addPercentSign) +QString Util::formatCostRelative(qint64 selfCost, qint64 totalCost, bool addPercentSign) { if (!totalCost) { return QString(); diff --git a/src/util.h b/src/util.h index 3f50e58a..d6400d4c 100644 --- a/src/util.h +++ b/src/util.h @@ -67,8 +67,8 @@ struct HashCombine QString formatString(const QString& input, bool replaceEmptyString = true); QString formatSymbol(const Data::Symbol& symbol, bool replaceEmptyString = true); -QString formatCost(quint64 cost); -QString formatCostRelative(quint64 selfCost, quint64 totalCost, bool addPercentSign = false); +QString formatCost(qint64 cost); +QString formatCostRelative(qint64 selfCost, qint64 totalCost, bool addPercentSign = false); QString formatTimeString(quint64 nanoseconds, bool shortForm = false); QString formatFrequency(quint64 occurrences, quint64 nanoseconds); QString formatTooltip(int id, const Data::Symbol& symbol, const Data::Costs& costs);