Make copies of everything, assign to global shortcuts so functions work
    on them, extract the times, then restore the running stacks.

def collapse_times():
    """Make copies of everything, assign to global shortcuts so functions work
    on them, extract the times, then restore the running stacks.
    """
    orig_ts = f.timer_stack
    orig_ls = f.loop_stack
    copy_ts = _copy_timer_stack()
    copy_ls = copy.deepcopy(f.loop_stack)
    f.timer_stack = copy_ts
    f.loop_stack = copy_ls
    f.refresh_shortcuts()
    while (len(f.timer_stack) > 1) or f.t.in_loop:
        _collapse_subdivision()
    timer_pub.stop()
    collapsed_times = f.r
    f.timer_stack = orig_ts  # (loops throw error if not same object!)
    f.loop_stack = orig_ls
    f.refresh_shortcuts()
    return collapsed_times