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 -memprofile option to l-tm #55

Merged
merged 1 commit into from Dec 9, 2018
Merged

Add -memprofile option to l-tm #55

merged 1 commit into from Dec 9, 2018

Conversation

pwaller
Copy link
Member

@pwaller pwaller commented Dec 9, 2018

For profiling memory allocations used for producing reproducible
instructions for analysing allocations.

Usage:

This command collects a profile:

l-tm -memprofile=mem.pprof <input llvm>

This one loads pprof in a mode showing all allocations that occurred by
count (rather than by size, which is alloc_space).

go tool pprof -sample_index=alloc_objects mem.pprof

Useful commands thereafter: top10 or web.

@pwaller pwaller requested a review from mewmew December 9, 2018 15:18
For profiling memory allocations used for producing reproducible
instructions for analysing allocations.

Usage:

This command collects a profile:

```
l-tm -memprofile=mem.pprof <input llvm>
```

This one loads pprof in a mode showing all allocations that occurred by
count (rather than by size, which is alloc_space).

```
go tool pprof -sample_index=alloc_objects mem.pprof
```

Useful commands thereafter: `top10` or `web`.
@pwaller
Copy link
Member Author

pwaller commented Dec 9, 2018

For the record, here's what the output looks like at the moment on master:

~/.local/src/github.com/llir/testdata/sqlite/test$ l-tm -memprofile=shell.pprof shell.ll
=== [ shell.ll ] =======================

asm: parsing into AST took: 7.070239753s
asm: index AST top-level entities took: 470.742966ms
asm: type resolution took: 41.021963ms
asm: create IR top-level entities took: 364.503029ms
asm: translate AST to IR took: 29.626707477s
total time for file "shell.ll": 37.628816642s

~/.local/src/github.com/llir/testdata/sqlite/test$ go tool pprof -sample_index=alloc_objects shell.pprof

File: l-tm
Type: alloc_objects
Time: Dec 9, 2018 at 3:13pm (GMT)
Entering interactive mode (type "help" for commands, "o" for options)

(pprof) top10
Showing nodes accounting for 13835477, 85.07% of 16263763 total
Dropped 374 nodes (cum <= 81318)
Showing top 10 nodes out of 89
      flat  flat%   sum%        cum   cum%
   5987566 36.82% 36.82%    5987566 36.82%  github.com/llir/ll/ast.(*builder).addNode
   4045040 24.87% 61.69%    4045040 24.87%  github.com/llir/ll/ast.ToLlvmNode
   1211043  7.45% 69.13%    1211043  7.45%  github.com/llir/ll/ast.(*Node).Children
    682002  4.19% 73.33%     682002  4.19%  github.com/llir/ll/selector.OneOf
    443999  2.73% 76.06%     443999  2.73%  strconv.syntaxError (inline)
    404527  2.49% 78.54%     404527  2.49%  github.com/llir/llvm/asm.(*generator).astToIRIntType
    375321  2.31% 80.85%    1278388  7.86%  github.com/llir/llvm/asm.(*generator).astToIRPointerType
    231762  1.43% 82.28%     696437  4.28%  github.com/llir/llvm/asm.(*generator).irMetadataAttachment
    231762  1.43% 83.70%     928199  5.71%  github.com/llir/llvm/asm.(*generator).irMetadataAttachments
    222455  1.37% 85.07%     222455  1.37%  github.com/llir/llvm/asm.(*generator).createMetadataDefs

@pwaller
Copy link
Member Author

pwaller commented Dec 9, 2018

BTW, my assertion (offline) that it was 50% of allocations was erroneous, it looks like it is only 24% of allocations above - I must have been considering the cumulative number rather than the "individual method" number.

I still believe the ~10% wallclock speedup number, though.

@coveralls
Copy link

coveralls commented Dec 9, 2018

Coverage Status

Coverage remained the same at 62.884% when pulling 3022db4 on memprofile-l-tm into bc6a508 on master.

Copy link
Member

@mewmew mewmew left a comment

Choose a reason for hiding this comment

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

LGTM.

@mewmew mewmew merged commit 8e264d8 into master Dec 9, 2018
@mewmew mewmew deleted the memprofile-l-tm branch December 9, 2018 23:06
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.

None yet

3 participants