Skip to content

Use invokelatest(timeit_debug_enabled()) #181

Description

@theogf

I wanted to build a wrapper to use @timeit_debug quickly like

function with_timer(f::Function, modules::Vector{Module})
  reset_timer!(timer)
  try
    for mod in modules
      enable_debug_timings(mod)
    end
    f()
  finally
    print_timer(timer)
    for mod in modules
      disable_debug_timings(mod)
    end
  end
end

However I realized that doing so creates method version issues (this is printed just before calling f()):

invokelatest(Main.timeit_debug_enabled) = true
Main.timeit_debug_enabled() = false

Would that makes sense to use invokelatest here? Or is there a better solution to my problem?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions