-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[Stats] Track NumASTBytesAllocated continuously #19609
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
[Stats] Track NumASTBytesAllocated continuously #19609
Conversation
@swift-ci Please smoke test |
Here's a flamegraph of generating the standard library module: AST.NumASTBytesAllocated.events.svg.zip. I really want to do this based on |
@@ -300,7 +300,9 @@ class ASTContext final { | |||
|
|||
if (LangOpts.UseMalloc) | |||
return AlignedAlloc(bytes, alignment); | |||
|
|||
|
|||
if (arena == AllocationArena::Permanent && Stats) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, this && Stats
doesn't seem to be being respected. I wonder why.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's crashing in the ASTContext constructor, presumably before Stats is itself initialized.
Nice change otherwise!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
…I feel silly. Thanks for catching that!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Assuming you can figure out the right initialization dance to not crash, looks good!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Er, actually, now that I think about this I'm not sure it's quite right: NumASTBytesAllocated tracks the set of bytes allocated at the end of allocating, but I'm not 100% sure we don't reset that arena from time to time (though I suspect we don't). The framework for stats-counting in general and profiling in particular assumes monotonic growth in counters.
(Still approved if this is not a problem, but I'm just not .. sure)
We don't reset the arena, but the hole I noticed is that any allocations done before the stats reporter is set up won't be counted. I can add that to |
...so it can be used with flamegraphs.
42d73f0
to
9e56a8e
Compare
@swift-ci Please smoke test |
@swift-ci Please smoke test compiler performance |
1 similar comment
@swift-ci Please smoke test compiler performance |
Very cool! (so to speak)
… On Sep 28, 2018, at 11:13 AM, Jordan Rose ***@***.***> wrote:
Here's a flamegraph of generating the standard library module: AST.NumASTBytesAllocated.events.svg.zip <https://github.com/apple/swift/files/2429242/AST.NumASTBytesAllocated.events.svg.zip>. I really want to do this based on -profile-stats-entities, but that takes over 20GB of memory on my machine with only 16GB of physical RAM, so I guess I'll have to try it somewhere else.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub <#19609 (comment)>, or mute the thread <https://github.com/notifications/unsubscribe-auth/AAcJ0B6GZGH98YbCkfpiF0sLjFeReK_Gks5ufmbTgaJpZM4W_NfE>.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great!
…so it can be used with
-profile-stats-events
and-profile-stats-entities
to produce flamegraphs.