Skip to content

Commit

Permalink
Added coloring of incomplete callchains restricted by 'max-stack' opt…
Browse files Browse the repository at this point in the history
…ion.

And callchains full unwind by context menu item on Bottom Up symbols.
  • Loading branch information
dknysh committed Sep 17, 2020
1 parent 18467ce commit acdbde5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
11 changes: 10 additions & 1 deletion app/perfunwind.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,10 @@ void PerfUnwind::resolveCallchain()
// in the normal callchain. The branch stack contains the non-kernel IPs then.
const bool hasBranchStack = !m_currentUnwind.sample->branchStack().isEmpty();

if (m_currentUnwind.sample->callchain().size() > maxUnwindStack()) {
m_currentUnwind.isIncompleteCallchain = true;
}

for (int i = 0, c = qMin(maxUnwindStack(), m_currentUnwind.sample->callchain().size()); i < c; ++i) {
quint64 ip = m_currentUnwind.sample->callchain()[i];

Expand Down Expand Up @@ -506,6 +510,10 @@ void PerfUnwind::resolveCallchain()
if (isKernel)
return;

if (m_currentUnwind.sample->branchStack().size() > maxUnwindStack()) {
m_currentUnwind.isIncompleteCallchain = true;
}

// if available, also resolve the callchain stored in the branch stack:
// caller is stored in "from", callee is stored in "to"
// so the branch is made up of the first callee and all callers
Expand Down Expand Up @@ -602,6 +610,7 @@ void PerfUnwind::analyze(const PerfRecordSample &sample)
m_currentUnwind.sample = &sample;
m_currentUnwind.frames.clear();
m_currentUnwind.disasmFrames.clear();
m_currentUnwind.isIncompleteCallchain = false;

userSymbols->updatePerfMap();
if (!sample.callchain().isEmpty() || !sample.branchStack().isEmpty())
Expand Down Expand Up @@ -676,7 +685,7 @@ void PerfUnwind::analyze(const PerfRecordSample &sample)
QDataStream stream(&buffer, QIODevice::WriteOnly);
stream << static_cast<quint8>(type) << sample.pid()
<< sample.tid() << sample.time() << sample.cpu() << m_currentUnwind.frames << m_currentUnwind.disasmFrames
<< numGuessedFrames << values;
<< numGuessedFrames << values << m_currentUnwind.isIncompleteCallchain;

if (type == TracePointSample) {
QHash<qint32, QVariant> traceData;
Expand Down
3 changes: 2 additions & 1 deletion app/perfunwind.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ class PerfUnwind : public QObject

struct UnwindInfo {
UnwindInfo() : frames(0), disasmFrames(0), unwind(nullptr), sample(nullptr), maxFrames(64), maxStack(127),
branchTraverse(false), firstGuessedFrame(-1), isInterworking(false) {}
branchTraverse(false), firstGuessedFrame(-1), isInterworking(false), isIncompleteCallchain(false) {}

QHash<qint32, QHash<quint64, Dwarf_Word>> stackValues;
QVector<qint32> frames;
Expand All @@ -108,6 +108,7 @@ class PerfUnwind : public QObject
bool branchTraverse;
int firstGuessedFrame;
bool isInterworking;
bool isIncompleteCallchain;
};

struct Stats
Expand Down

0 comments on commit acdbde5

Please sign in to comment.