From a57218e194c670c8ebacd2e3ccd00a0716585dbd Mon Sep 17 00:00:00 2001 From: Lieven Hey Date: Thu, 7 Dec 2023 11:50:07 +0100 Subject: [PATCH] add inline color scheme for flamegraph this colorscheme colors inlined functions in a violet shade while normal functions are colored green --- src/flamegraph.cpp | 11 +++++++++++ src/settings.h | 1 + 2 files changed, 12 insertions(+) diff --git a/src/flamegraph.cpp b/src/flamegraph.cpp index 3360d491..23eb6593 100644 --- a/src/flamegraph.cpp +++ b/src/flamegraph.cpp @@ -356,6 +356,14 @@ QBrush brushKernel(const Data::Symbol& symbol) return user; } +QBrush brushInline(const Data::Symbol& symbol) +{ + static auto inlineBrush = QBrush(QColor(88, 53, 94, 125)); + static auto normalBrush = QBrush(QColor(214, 244, 183, 125)); + + return symbol.isInline ? inlineBrush : normalBrush; +} + bool isInPathList(const QStringList& paths, const QString& subPath) { auto containsSubPath = [subPath](const auto& path) { return subPath.startsWith(path); }; @@ -406,6 +414,8 @@ QBrush brush(const Data::Symbol& entry, Settings::ColorScheme scheme, quint32 co return brushKernel(entry); case Settings::ColorScheme::System: return brushSystem(entry); + case Settings::ColorScheme::Inline: + return brushInline(entry); case Settings::ColorScheme::Default: return brushImpl(qHash(entry), BrushType::Hot); case Settings::ColorScheme::CostRatio: @@ -734,6 +744,7 @@ FlameGraph::FlameGraph(QWidget* parent, Qt::WindowFlags flags) comboBox->addItem(tr("Binary"), QVariant::fromValue(Settings::ColorScheme::Binary)); comboBox->addItem(tr("Kernel"), QVariant::fromValue(Settings::ColorScheme::Kernel)); comboBox->addItem(tr("System"), QVariant::fromValue(Settings::ColorScheme::System)); + comboBox->addItem(tr("Inline"), QVariant::fromValue(Settings::ColorScheme::Inline)); comboBox->addItem(tr("Cost Ratio"), QVariant::fromValue(Settings::ColorScheme::CostRatio)); auto setColorScheme = [this](Settings::ColorScheme scheme) { diff --git a/src/settings.h b/src/settings.h index d892ce97..b09c8664 100644 --- a/src/settings.h +++ b/src/settings.h @@ -23,6 +23,7 @@ class Settings : public QObject Binary, Kernel, System, + Inline, CostRatio, NumColorSchemes };