From f71c967e2c580079a82941350a96f55012728cd9 Mon Sep 17 00:00:00 2001 From: Nikolai Tillmann Date: Thu, 12 Oct 2023 17:19:20 -0700 Subject: [PATCH] add timer for `move_to_container` Reviewed By: agampe Differential Revision: D49626863 fbshipit-source-id: 586fed9c18288985517dda9ca54b055555609697 --- libredex/ConcurrentContainers.h | 3 +++ libredex/PassManager.cpp | 1 + 2 files changed, 4 insertions(+) diff --git a/libredex/ConcurrentContainers.h b/libredex/ConcurrentContainers.h index ce3fb6d69f3..493ebe57fa2 100644 --- a/libredex/ConcurrentContainers.h +++ b/libredex/ConcurrentContainers.h @@ -25,8 +25,10 @@ template class ConcurrentContainerIterator; inline AccumulatingTimer s_destructor{}; +inline AccumulatingTimer s_move{}; inline double get_destructor_seconds() { return s_destructor.get_seconds(); } +inline double get_move_seconds() { return s_move.get_seconds(); } inline size_t s_concurrent_destruction_threshold{ std::numeric_limits::max()}; @@ -211,6 +213,7 @@ class ConcurrentContainer { * This operation is not thread-safe. */ Container move_to_container() { + auto timer_scope = cc_impl::s_move.scope(); Container res; res.reserve(size()); for (size_t slot = 0; slot < n_slots; ++slot) { diff --git a/libredex/PassManager.cpp b/libredex/PassManager.cpp index 68caf59e099..b4063c69fb2 100644 --- a/libredex/PassManager.cpp +++ b/libredex/PassManager.cpp @@ -1459,6 +1459,7 @@ void PassManager::run_passes(DexStoresVector& stores, ConfigFiles& conf) { get_compute_locations_closure_wto_seconds()); Timer::add_timer("cc_impl::destructor_second", cc_impl::get_destructor_seconds()); + Timer::add_timer("cc_impl::move_second", cc_impl::get_move_seconds()); } PassManager::ActivatedPasses PassManager::compute_activated_passes(