GC: enable logging to stderr when GC runs#43511
Conversation
and wasn't the most useful thing anyway
|
6 decimals for milliseconds is perhaps a bit excessive? |
|
Haha true. Truncated to 2 decimal points. |
|
It appears that |
|
Should be to stderr? |
|
Ah, I think my docstring was wrong and it already does print to stderr, since it uses Line 624 in dc74954 Updated the docstring. |
|
Can you also edit the PR title to reflect whether this prints to stdout or stderr? |
|
Whoops, done. |
NHDaly
left a comment
There was a problem hiding this comment.
LGTM :)
Can you plz add a very simple test that just enables the printing and then triggers a GC and then disables the printing? Thanks!
🎄 Merry christmas! 🎄
|
Also we should add docs for this. |
|
@vchuravy Do you think docs and news? Or just docs? |
|
Instead (or in addition to) logging to STDERR, what about a way to register a callback that receives the same information? |
|
@sefffal that would be cool, but I'm a little unsure how to do it… Since no Julia code can run during a GC pause (where the println is now) I guess we'd have to somehow queue up the callback to run after GC unpauses? Not quite sure how to do that at the moment; my knowledge of this codebase is pretty limited… @NHDaly @vchuravy Julia contributor n00b question: where do I add docs and news? (besides the little docstring I put on the function?) |
|
I think just docs suffice, I tend to find a place in the manual that makes sense, maybe https://docs.julialang.org/en/v1/manual/profile/#Memory-allocation-analysis or in the devdocs, but we sadly don't have a devdocs section for the GC, and then find the right section in https://github.com/JuliaLang/julia/tree/master/doc/src News go here https://github.com/JuliaLang/julia/blob/master/NEWS.md |
|
Ok, added a bit of docs on this (and some headings) under the memory section of the profiling doc. (hopefully we'll be able to add another heading for #42768 soon…) |
|
For the News, i'd probably add it to one of these sections, at your discretion:
It can just be a one-line blurb that links to this PR, following the structure of the others. Thanks @vilterp! |
|
@vilterp This looks good to go, except for moving the function into the |
|
done, and added a test. |
|
Thanks Valentin! |
Co-authored-by: Nathan Daly <NHDaly@gmail.com>
Co-authored-by: Nathan Daly <NHDaly@gmail.com>
Useful to get a feel for how often GC is running and how much it's collecting.
was split off from #42768