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

Add support for the Allocs profiles produced by Julia's Allocs Profiler #46

Merged
merged 13 commits into from
Jan 25, 2022

Conversation

NHDaly
Copy link
Member

@NHDaly NHDaly commented Jan 4, 2022

Add support for the Allocs profiles produced by Julia's Allocs Profiler

Support for visualizing the results from the allocations profiler in
draft PR:
JuliaLang/julia#42768.

This was basically copy/pasted from
https://github.com/vilterp/AllocProfileParser.jl.

Screen Shot 2022-01-03 at 9 50 41 PM

Screen Shot 2022-01-03 at 9 45 39 PM

@codecov-commenter
Copy link

codecov-commenter commented Jan 4, 2022

Codecov Report

Merging #46 (be54421) into master (eaadf51) will decrease coverage by 1.82%.
The diff coverage is 91.25%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #46      +/-   ##
==========================================
- Coverage   98.22%   96.39%   -1.83%     
==========================================
  Files           2        3       +1     
  Lines         225      305      +80     
==========================================
+ Hits          221      294      +73     
- Misses          4       11       +7     
Impacted Files Coverage Δ
src/PProf.jl 99.19% <ø> (ø)
src/Allocs.jl 91.25% <91.25%> (ø)

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 eaadf51...be54421. Read the comment docs.

@NHDaly NHDaly force-pushed the nhd-profile-allocs branch from f1505c4 to 8c67750 Compare January 4, 2022 02:51
Support for visualizing the results from the allocations profiler in
draft PR:
JuliaLang/julia#42768.

This was basically copy/pasted from
https://github.com/vilterp/AllocProfileParser.jl.
@NHDaly NHDaly force-pushed the nhd-profile-allocs branch from 8c67750 to a81fb68 Compare January 4, 2022 02:52
Copy link
Collaborator

@vilterp vilterp left a comment

Choose a reason for hiding this comment

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

nice, thanks!

using PProf.OrderedCollections

# input: e.g. "maybe_handle_const_call! at ./compiler/ssair/inlining.jl:1243"
function parse_location(loc_str::String)
Copy link
Collaborator

Choose a reason for hiding this comment

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

not used

@NHDaly NHDaly force-pushed the nhd-profile-allocs branch from 35bc257 to 8dc2019 Compare January 7, 2022 16:07
NHDaly added a commit to JuliaLang/julia that referenced this pull request Jan 19, 2022
## Overview

Record the type and stack of every allocation (or only at a given sample interval), and return as Julia objects.

Alternate approach to existing alloc profiler PR: #33467
Complementary to garbage profiler PR: #42658 (maybe there's some nice way to meld them)

This may be reinventing the wheel from #33467, but I'm not sure why that one needs stuff like LLVM passes. I mimicked some stuff from it, but this was my attempt to get something up and running. Could easily be missing stuff.

## Usage:

```julia
using Profile.Allocs
res = Allocs.@Profile sample_rate=0.001 my_func()
prof = Allocs.fetch()
# do something with `prof`
```

See also: JuliaPerf/PProf.jl#46 for support for visualizing these.

Co-authored-by: Nathan Daly <[email protected]>
@vchuravy
Copy link
Member

Now that this has landed in Base we should land this

@NHDaly
Copy link
Member Author

NHDaly commented Jan 21, 2022

Agreed. Just made some fixups to the API; this is ready to go now!

@NHDaly NHDaly marked this pull request as ready for review January 21, 2022 19:02
Copy link
Collaborator

@vilterp vilterp left a comment

Choose a reason for hiding this comment

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

re-approving 😛 API looks good.

outf = PProf.Allocs.pprof(out=out, web=false)

# Read the exported profile
prof = open(io->readproto(io, PProf.perftools.profiles.Profile()), outf, "r")
Copy link
Collaborator

Choose a reason for hiding this comment

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

😮 what is this -> syntax??

Copy link
Member

Choose a reason for hiding this comment

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

Lambda/Closure/Anonymous Function

Copy link
Collaborator

Choose a reason for hiding this comment

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

oh, of course 🤦‍♂️ just hadn't seen it without parens I guess

@NHDaly
Copy link
Member Author

NHDaly commented Jan 25, 2022

Cool! Thanks all - merging now

@NHDaly NHDaly merged commit 71dcc12 into master Jan 25, 2022
@NHDaly NHDaly deleted the nhd-profile-allocs branch January 25, 2022 17:56
@NHDaly NHDaly restored the nhd-profile-allocs branch January 25, 2022 17:56
@NHDaly
Copy link
Member Author

NHDaly commented Jan 25, 2022

(leaving the branch up for anyone who had pointed their PProf at it locally)

LilithHafner pushed a commit to LilithHafner/julia that referenced this pull request Feb 22, 2022
## Overview

Record the type and stack of every allocation (or only at a given sample interval), and return as Julia objects.

Alternate approach to existing alloc profiler PR: JuliaLang#33467
Complementary to garbage profiler PR: JuliaLang#42658 (maybe there's some nice way to meld them)

This may be reinventing the wheel from JuliaLang#33467, but I'm not sure why that one needs stuff like LLVM passes. I mimicked some stuff from it, but this was my attempt to get something up and running. Could easily be missing stuff.

## Usage:

```julia
using Profile.Allocs
res = Allocs.@Profile sample_rate=0.001 my_func()
prof = Allocs.fetch()
# do something with `prof`
```

See also: JuliaPerf/PProf.jl#46 for support for visualizing these.

Co-authored-by: Nathan Daly <[email protected]>
LilithHafner pushed a commit to LilithHafner/julia that referenced this pull request Mar 8, 2022
## Overview

Record the type and stack of every allocation (or only at a given sample interval), and return as Julia objects.

Alternate approach to existing alloc profiler PR: JuliaLang#33467
Complementary to garbage profiler PR: JuliaLang#42658 (maybe there's some nice way to meld them)

This may be reinventing the wheel from JuliaLang#33467, but I'm not sure why that one needs stuff like LLVM passes. I mimicked some stuff from it, but this was my attempt to get something up and running. Could easily be missing stuff.

## Usage:

```julia
using Profile.Allocs
res = Allocs.@Profile sample_rate=0.001 my_func()
prof = Allocs.fetch()
# do something with `prof`
```

See also: JuliaPerf/PProf.jl#46 for support for visualizing these.

Co-authored-by: Nathan Daly <[email protected]>
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.

4 participants