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

Flamegraph cleanup #312

Merged
merged 8 commits into from
Feb 4, 2023
Merged

Conversation

godlygeek
Copy link
Contributor

Fix several flame graph bugs, and make some improvements to pave the way for us to introduce new types of flame graphs.

Signed-off-by: Matt Wozniski <mwozniski@bloomberg.net>
Previously the old chart elements were just being hidden, not removed,
which used extra memory and led to extra unnecessary white space being
added at the bottom of the flame graph.

We need to not only destroy the flame graph itself, but also any tool
tips that have been created for it. The `destroy` method doesn't destroy
these, and if we don't remove them ourselves then they can cause
a horizontal scroll bar to appear if the window is resized so that the
place where the tool tip was is now beyond the screen width.

Since we're destroying the old chart and creating a new one, we don't
need to adjust the width of the old one.

Signed-off-by: Matt Wozniski <mwozniski@bloomberg.net>
Because resizing internally creates a new chart, we need to select the
correct element on that chart.

Signed-off-by: Matt Wozniski <mwozniski@bloomberg.net>
This lays the ground work for us to reuse our flame graph generation
tools across multiple different types of flame graphs.

Every function and class deleted from `flamegraph.js` is added without
any changes (other than maybe an `export`) to `flamegraph_common.js`.

Signed-off-by: Matt Wozniski <mwozniski@bloomberg.net>
Rather than basing the width of the flame graph on the width of the
browser window, base it on the width of the div that we're drawing into.
The width of the div that we're drawing into may change by the time
we're done (because we may have added a scroll bar, shrinking the
available width), so we also need to poke the flame graph to update its
width after it has been drawn.

Signed-off-by: Matt Wozniski <mwozniski@bloomberg.net>
Also, add a `.gitattributes` file to tell `git` to stop displaying diffs
for these files, since they're not human readable.

Signed-off-by: Matt Wozniski <mwozniski@bloomberg.net>
This lays the ground work for us to create a new type of HTML report
that doesn't include these static elements.

Signed-off-by: Matt Wozniski <mwozniski@bloomberg.net>
This function is hit extremely heavily when generating flame graphs, so
restructuring it to be a bit more efficient and adding a cache is enough
to speed up flame graph generation by up to 30% in some cases.

Signed-off-by: Matt Wozniski <mwozniski@bloomberg.net>
Copy link
Member

@pablogsal pablogsal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@pablogsal pablogsal merged commit 14c30dc into bloomberg:main Feb 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants