How to check `-O` optimization flag setting inside script?

I’m writing a script to run a performance benchmark. I’d like to add a check that Julia is running with full optimization (i.e. -O3) to ensure the results are representative. Is there a way to get the -O optimization flag setting from within a script?

Base.JLOptions().opt_level but I’m really sure what “to ensure the results are representative” means.

2 Likes

Thanks @giordano!

Sorry, by “to ensure the results are representative” I just meant that I want to always run with -O3, because I’ll save the results from many runs, so they should all have used -O3 to be comparable.