Skip to content

RFC: add a command line option to print out method invalidations to stderr or a file #35745

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

Closed
wants to merge 1 commit into from

Conversation

KristofferC
Copy link
Member

@KristofferC KristofferC commented May 5, 2020

This makes it work the same as --trace-compile.

./julia --trace-method-invalidations=stderr -e 'f() = 1; f(); f() = 2'
-- f()


❯ ./julia --trace-method-invalidations=invalidations.txt -e 'f() = 1; f(); f() = 2'
❯ cat invalidations.txt
-- f()

It is harder to toggle this in a running session now though so maybe this API isn't the best. Perhaps it is better to be able to scope a block of code to write the invalidations to a file.

cc @timholy, could potentially be used in timholy/SnoopCompile.jl#77.

Also, I don't know much about how things are structured in the code here so I just put stuff a bit randomly...

@KristofferC KristofferC added the needs tests Unit tests are required for this change label May 5, 2020
@KristofferC KristofferC force-pushed the kc/trace_method_invalid branch from 34dcdf1 to 9d05911 Compare May 5, 2020 14:05
@timholy
Copy link
Member

timholy commented May 5, 2020

I wonder if it would be even better to say @snoopinvalid using SomePkg and have it return a data structure that facilitates analysis. That might suggest that we should instead focus on passing an IO object in and have it log the results there instead of JL_STDOUT.

@maleadt
Copy link
Member

maleadt commented May 6, 2020

It is harder to toggle this in a running session now though so maybe this API isn't the best.

Maybe add an API like what we have for dump compiles:

julia/src/jitlayers.cpp

Lines 38 to 43 in b472f88

JL_STREAM *dump_compiles_stream = NULL;
extern "C" JL_DLLEXPORT
void jl_dump_compiles(void *s)
{
dump_compiles_stream = (JL_STREAM*)s;
}

@timholy
Copy link
Member

timholy commented May 6, 2020

xref #35768

@KristofferC
Copy link
Member Author

Superseded.

@KristofferC KristofferC closed this May 6, 2020
@DilumAluthge DilumAluthge deleted the kc/trace_method_invalid branch March 25, 2021 21:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs tests Unit tests are required for this change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants