Skip to content

Commit

Permalink
Show whether a frame was inlined in tooltips too
Browse files Browse the repository at this point in the history
  • Loading branch information
milianw committed Jan 2, 2024
1 parent 45c7664 commit b430e0d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/flamegraph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ QString FrameGraphicsItem::description() const
root = static_cast<const FrameGraphicsRootItem*>(item);
}

auto symbol = Util::formatSymbol(m_symbol);
auto symbol = Util::formatSymbolExtended(m_symbol);
if (root == this) {
return symbol;
}
Expand Down
11 changes: 10 additions & 1 deletion src/util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ std::pair<QString, QString> elideArguments(const QString& symbolText)
QString formatForTooltip(const Data::Symbol& symbol)
{
return QCoreApplication::translate("Util", "symbol: <tt>%1</tt><br/>binary: <tt>%2</tt>")
.arg(Util::formatSymbol(symbol).toHtmlEscaped(), Util::formatString(symbol.binary));
.arg(Util::formatSymbolExtended(symbol).toHtmlEscaped(), Util::formatString(symbol.binary));
}

QString formatTooltipImpl(int id, const QString& text, const Data::Costs* selfCosts, const Data::Costs* inclusiveCosts)
Expand Down Expand Up @@ -266,6 +266,15 @@ QString Util::formatSymbol(const Data::Symbol& symbol, bool replaceEmptyString)
return formatString(symbolString, replaceEmptyString);
}

QString Util::formatSymbolExtended(const Data::Symbol& symbol)
{
auto ret = formatSymbol(symbol);
if (symbol.isInline) {
ret = QCoreApplication::translate("Util", "%1 (inlined)").arg(ret);
}
return ret;
}

QString Util::formatCost(quint64 cost)
{
// resulting format: 1.234E56
Expand Down
1 change: 1 addition & 0 deletions src/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ struct HashCombine

QString formatString(const QString& input, bool replaceEmptyString = true);
QString formatSymbol(const Data::Symbol& symbol, bool replaceEmptyString = true);
QString formatSymbolExtended(const Data::Symbol& symbol);
QString formatCost(quint64 cost);
QString formatCostRelative(quint64 selfCost, quint64 totalCost, bool addPercentSign = false);
QString formatTimeString(quint64 nanoseconds, bool shortForm = false);
Expand Down

0 comments on commit b430e0d

Please sign in to comment.