Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A taxonomy of call tree transforms #5340

Open
mstange opened this issue Jan 21, 2025 · 0 comments
Open

A taxonomy of call tree transforms #5340

mstange opened this issue Jan 21, 2025 · 0 comments

Comments

@mstange
Copy link
Contributor

mstange commented Jan 21, 2025

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"
    • Only include frames with category Graphics
      • Today: "Focus on category Graphics"
    • 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::
  • 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"
    • Merge consecutive frames with category Graphics
    • Merge consecutive frames of type JS / C++ / label / unaccounted native
    • Merge consecutive frames matching search js::
  • Slice stacks based on individual stack frame:
    • Only include function nsLayoutUtils::PaintFrame and callees, leave stacks without this function unchanged
    • Only include function nsLayoutUtils::PaintFrame and callees, drop stacks without this function
      • Today: "Focus on function"
    • Exclude function nsLayoutUtils::PaintFrame and callees
      • Today: "Collapse function" + "Merge function"
    • Only include function nsLayoutUtils::PaintFrame and callers, leave stacks without this function unchanged
      • Today: "Collapse function"
    • Only include function nsLayoutUtils::PaintFrame and callers, drop stacks without this function
    • Exclude function nsLayoutUtils::PaintFrame and callers
  • 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
  • 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::
  • 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::
  • 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::

┆Issue is synchronized with this Jira Task

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant