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

Import dhat profiles #3128

Merged
merged 10 commits into from
Aug 5, 2021
Merged

Import dhat profiles #3128

merged 10 commits into from
Aug 5, 2021

Conversation

gregtatum
Copy link
Member

@gregtatum gregtatum commented Jan 12, 2021

Edit: This is now ready to review. Please ignore the first commit, as it's from #3222. Also note the code diff size is from snapshot churn. I flagged both of you for review since I don't know your workload, but I only need one person to do the review.

It adds support for importing dhat memory profiles, specifically from dhat-rs. The file format is part of the valgrind tools. We're using this tool as part of our memory benchmarks for ICU4X, and I would like to be able to link to profiles if possible. I couldn't really figure out how to read the built in viewer, which is a bit awkward.

Here is a profile to test with:
dhat-heap.json.zip

Here is a deploy preview

@codecov
Copy link

codecov bot commented Mar 23, 2021

Codecov Report

Merging #3128 (12dec49) into main (5707f11) will increase coverage by 0.04%.
The diff coverage is 96.72%.

❗ Current head 12dec49 differs from pull request most recent head 8406440. Consider uploading reports for the commit 8406440 to get more accurate results
Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3128      +/-   ##
==========================================
+ Coverage   88.76%   88.81%   +0.04%     
==========================================
  Files         255      256       +1     
  Lines       20808    20930     +122     
  Branches     5331     5346      +15     
==========================================
+ Hits        18470    18588     +118     
- Misses       2162     2166       +4     
  Partials      176      176              
Impacted Files Coverage Δ
src/profile-logic/import/art-trace.js 91.26% <ø> (ø)
src/selectors/per-thread/thread.js 94.65% <60.00%> (-1.38%) ⬇️
src/profile-logic/import/dhat.js 98.21% <98.21%> (ø)
src/actions/profile-view.js 85.20% <100.00%> (ø)
src/profile-logic/import/chrome.js 94.72% <100.00%> (+0.01%) ⬆️
src/profile-logic/process-profile.js 91.13% <100.00%> (+0.05%) ⬆️
src/components/tooltip/CallNode.js 87.05% <0.00%> (ø)
src/components/timeline/TrackNetwork.js 94.79% <0.00%> (ø)
src/components/tooltip/Marker.js 97.32% <0.00%> (+0.02%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5707f11...8406440. Read the comment docs.

@gregtatum gregtatum marked this pull request as ready for review March 23, 2021 16:07
@gregtatum gregtatum requested review from julienw and canova March 23, 2021 16:07
@gregtatum gregtatum changed the title [wip] Import dhat profiles Import dhat profiles Mar 26, 2021
@gregtatum
Copy link
Member Author

I forgot to remove the [wip] tag here, and I rebased over #3222.

Copy link
Contributor

@julienw julienw left a comment

Choose a reason for hiding this comment

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

Thanks for this addition, this looks very useful!

When I try the deploy preview, I get a hang quite easily, by clicking here and there in the tracks, here is a profile I got from my local dev: https://share.firefox.dev/2O2mN1c

Also I don't see anything in the tracks, is that expected?

Otherwise this looks reasonable, I left a few comments with mostly questions and comments. I'm not approving mainly because of the 2 above problems, but the code looks fine otherwise.

Thanks!

.gitattributes Show resolved Hide resolved
src/types/profile.js Show resolved Hide resolved
src/profile-logic/import/dhat.js Outdated Show resolved Hide resolved
src/profile-logic/import/dhat.js Outdated Show resolved Hide resolved
src/profile-logic/import/dhat.js Outdated Show resolved Hide resolved
src/profile-logic/import/dhat.js Outdated Show resolved Hide resolved
src/profile-logic/import/dhat.js Outdated Show resolved Hide resolved
src/profile-logic/import/dhat.js Show resolved Hide resolved
src/profile-logic/import/dhat.js Outdated Show resolved Hide resolved
src/selectors/per-thread/stack-sample.js Outdated Show resolved Hide resolved
Copy link
Contributor

@julienw julienw left a comment

Choose a reason for hiding this comment

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

marking as "request changes" just for the sake of having the correct status in the list of PR.

@gregtatum
Copy link
Member Author

Thanks. I still need to look at the feedback, but I've been busy with the 0.2 release on ICU4X. I still plan on looking at this when I get a bit of time.

@canova canova removed their request for review May 3, 2021 08:20
@gregtatum gregtatum requested a review from julienw July 23, 2021 14:50
@gregtatum
Copy link
Member Author

I accidentally clobbered a Gecko build, so I took the time to finally get back to addressing the review on this 😅

@julienw
Copy link
Contributor

julienw commented Jul 28, 2021

@gregtatum have you seen this comment when you handled the review comments?

When I try the deploy preview, I get a hang quite easily, by clicking here and there in the tracks, here is a profile I got from my local dev: https://share.firefox.dev/2O2mN1c

Also I don't see anything in the tracks, is that expected?

This still seems to happen.

Thanks!

@gregtatum
Copy link
Member Author

I think I missed your hang comment.

I'm not reproducing, and I'm a bit unclear on the STR. I'm clicking around but things seem fine:

https://deploy-preview-3128--perf-html.netlify.app/public/cag9r7d4qj8chjadcw63ctv73cdq7rhdc0p6v1g/flame-graph/?globalTrackOrder=7w91w506&hiddenGlobalTracks=1w5&hiddenLocalTracksByPid=28213-02w4&localTrackOrderByPid=28213-602w415~28275-0~28424-0~28373-0~28316-0~28982-0~28449-0&range=3461m16148&thread=0&timelineType=cpu-category&v=6

Also I don't see anything in the tracks, is that expected?

This is expected, as there is no timeline data. It's only the summary.

@julienw
Copy link
Contributor

julienw commented Aug 4, 2021

Thanks a lot for addressing the issue of reusing the thread object!

Regarding the hang, this is happening when I click around in the timeline, mostly when I click on the tracks to select them, but I got it also when I clicked always in the same track. The console says: Uncaught out of memory.
I made you another profile in development mode so that you have the function names:
https://share.firefox.dev/3yoOQtR
This is on my newer much faster computer, and here the hang stops after a few seconds (still 19 seconds!). I think that in my previous computer this wouldn't stop, probably the OOM wouldn't come so fast.

I'd be happy merging this and you can handle this issue in a separate PR, especially that you'll be one of the only users of the feautre ;-) Up to you.

const newSelectedCallNode =
newSelectedStack === null
newSelectedStack === null || newSelectedStack === undefined
Copy link
Contributor

Choose a reason for hiding this comment

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

thanks for the fix !!
curious that it wasn't deterministic and only happened sometimes...

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, I think the real fix would be to check how the sample index is being generated, as it should be a null if there are no samples.

Copy link
Member Author

Choose a reason for hiding this comment

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

However, that was a lot more work with more call sites, this fix was expedient.

@julienw julienw merged commit a3cfe26 into firefox-devtools:main Aug 5, 2021
@julienw julienw mentioned this pull request Aug 9, 2021
julienw added a commit that referenced this pull request Aug 9, 2021
* Support dhat imports (see #3128 for more information)
* Remove mentions of the old add-on
* A few fixes in the tooltips dimensioning
* Prepare support for network requests cancellations
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

Successfully merging this pull request may close these issues.

2 participants