A taxonomy of call tree transforms
There is nothing to do in this issue, I'm just filing this so that it's recorded somewhere.
I've been thinking about call tree transforms and noticed some patterns.
For each transform, you can visualize how they act on the call tree. But you can also visualize how they act on an individual stack. For example, say you have this stack:
(root)
XREMain::XRE_main
NS_ProcessNextEvent
mozilla::TaskController::RunTask
nsRefreshDriver::Tick
nsLayoutUtils::PaintFrame
Now you apply the transform "Merge function" on the nsRefreshDriver::Tick transform and get:
(root)
XREMain::XRE_main
NS_ProcessNextEvent
mozilla::TaskController::RunTask
nsLayoutUtils::PaintFrame
So, on a per-stack level, the "Merge function" transform means "Exclude stack frames with this function from each stack".
The other filters at the top of the call tree can also be regarded as transforms: The implementation filter (JS / C++ / Both) is very similar to a "merge function" transform. And the search filter acts as "drop non-matching samples" transform.
Most of our transforms act on stacks. But some act on samples, for example the "Drop samples with this function" transform.
We have both exclusive and inclusive transforms. For example "drop samples" excludes, and the search filter includes.
We have various ways to classify stack frames that the transforms act on: Based on function, category, resource, implementation, and whether the frame matches the search filter.
In summary, we support various primitives in very specific combinations.
But what if we supported all combinations? We'd end up with something like this:
Transforms
- Merge based on individual stack frames:
- Only include frames with function
nsLayoutUtils::PaintFrame - Exclude frames with function
nsLayoutUtils::PaintFrame- Today: "Merge function"
- Only include frames with resource
XUL - Exclude frames with resource
XUL- Today: "Collapse
XUL" + "Merge function"
- Today: "Collapse
- Only include frames with category
Graphics- Today: "Focus on category
Graphics"
- Today: "Focus on category
- Exclude frames with category
Graphics - Only include frames of type JS / C++ / label / unaccounted native
- Today (partial): Implementation filter
- Exclude frames of type JS / C++ / label / unaccounted native
- Today (partial): "Merge unaccounted native"
- Only include frames matching search
js:: - Exclude frames matching search
js::
- Only include frames with function
- Merge consecutive stack frames:
- Merge consecutive frames with function
nsLayoutUtils::PaintFrame- Today: "Collapse direct recursion only"
- Merge consecutive frames with resource
XUL- Today: "Collapse
XUL"
- Today: "Collapse
- Merge consecutive frames with category
Graphics - Merge consecutive frames of type JS / C++ / label / unaccounted native
- Merge consecutive frames matching search
js::
- Merge consecutive frames with function
- Slice stacks based on individual stack frame:
- Only include function
nsLayoutUtils::PaintFrameand callees, leave stacks without this function unchanged - Only include function
nsLayoutUtils::PaintFrameand callees, drop stacks without this function- Today: "Focus on function"
- Exclude function
nsLayoutUtils::PaintFrameand callees- Today: "Collapse function" + "Merge function"
- Only include function
nsLayoutUtils::PaintFrameand callers, leave stacks without this function unchanged- Today: "Collapse function"
- Only include function
nsLayoutUtils::PaintFrameand callers, drop stacks without this function - Exclude function
nsLayoutUtils::PaintFrameand callers
- Only include function
- Slice stacks based on prefix/postfix:
- Exclude stack prefix
(start), ...,nsLayoutUtils::PaintFrame(keep last), leave stacks without this prefix unchanged - Exclude stack prefix
(start), ...,nsLayoutUtils::PaintFrame(keep last), drop stacks without this prefix- Today: "Focus on subtree only" in non-inverted mode
- Exclude stack suffix
MaybeMutex::Unlock, ...,RtlLeaveCriticalSection(keep first), leave stacks without this suffix unchanged - Exclude stack suffix
MaybeMutex::Unlock, ...,RtlLeaveCriticalSection(keep first), drop stacks without this suffix- Today: "Focus on subtree only" in inverted mode
- Exclude stack prefix
- Slice out middle of stack based on recursion:
- Collapse recursion of function
nsLayoutUtils::PaintFrame- Today: "Collapse recursion"
- Collapse recursion of resource
XUL - Collapse recursion of category
Graphics - Collapse recursion of frame type JS / C++ / label / unaccounted native
- Collapse recursion of frames matching search
js::
- Collapse recursion of function
- Include/exclude samples containing stack frame anywhere in the stack:
- Only include samples containing function
nsLayoutUtils::PaintFrame - Exclude samples containing function
nsLayoutUtils::PaintFrame- Today: "Drop samples with this function"
- Only include samples containing resource
XUL - Exclude samples containing resource
XUL - Only include samples containing category
Graphics - Exclude samples containing category
Graphics - Only include samples containing type JS / C++ / label / unaccounted native
- Exclude samples containing type JS / C++ / label / unaccounted native
- Only include samples containing frames which match the search
js::- Today: Default behavior of call tree search field
- Exclude samples containing frames which match the search
js::
- Only include samples containing function
- Include/exclude samples based on the sample's self frame:
- Only include self samples of function
nsLayoutUtils::PaintFrame- Today: "Focus on subtree only" on root nodes in the inverted tree
- Exclude self samples of function
nsLayoutUtils::PaintFrame - Only include self samples of resource
XUL - Exclude self samples of resource
XUL - Only include self samples of category
Graphics - Exclude self samples of category
Graphics - Only include self samples of type JS / C++ / label / unaccounted native
- Exclude self samples of type JS / C++ / label / unaccounted native
- Only include self samples of frames matching search
js:: - Exclude self samples of frames matching search
js::
- Only include self samples of function
┆Issue is synchronized with this Jira Task