add profiling for flush_all related functions