Skip to content

Commit

Permalink
measure "reserving" time
Browse files Browse the repository at this point in the history
Summary:
This is what now dominates the time spent in the concurrent collection (even though it's now pretty "just fine" in the grand scheme of things).
And drop now unused "move" time.

Reviewed By: thezhangwei

Differential Revision: D50582401

fbshipit-source-id: 14dc30504b4ff274049e7ca3882529153ee67b32
  • Loading branch information
Nikolai Tillmann authored and facebook-github-bot committed Nov 3, 2023
1 parent 399dccc commit 2c1b03a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions libredex/ConcurrentContainers.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ template <typename Container, size_t n_slots>
class ConcurrentContainerIterator;

inline AccumulatingTimer s_destructor{};
inline AccumulatingTimer s_move{};
inline AccumulatingTimer s_reserving{};

inline double get_destructor_seconds() { return s_destructor.get_seconds(); }
inline double get_move_seconds() { return s_move.get_seconds(); }
inline double get_reserving_seconds() { return s_reserving.get_seconds(); }

inline size_t s_concurrent_destruction_threshold{
std::numeric_limits<size_t>::max()};
Expand Down Expand Up @@ -498,6 +498,7 @@ class ConcurrentHashtable final {
if (storage->size >= capacity) {
return true;
}
auto timer_scope = s_reserving.scope();
auto new_capacity = get_prime_number_greater_or_equal_to(capacity);
auto* ptrs = storage->ptrs;
auto* new_storage = Storage::create(new_capacity, storage);
Expand Down
5 changes: 3 additions & 2 deletions libredex/PassManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1462,9 +1462,10 @@ void PassManager::run_passes(DexStoresVector& stores, ConfigFiles& conf) {
method_profiles::MethodProfiles::get_process_unresolved_lines_seconds());
Timer::add_timer("compute_locations_closure_wto",
get_compute_locations_closure_wto_seconds());
Timer::add_timer("cc_impl::destructor_second",
Timer::add_timer("cc_impl::destructor_seconds",
cc_impl::get_destructor_seconds());
Timer::add_timer("cc_impl::move_second", cc_impl::get_move_seconds());
Timer::add_timer("cc_impl::reserving_seconds",
cc_impl::get_reserving_seconds());
}

PassManager::ActivatedPasses PassManager::compute_activated_passes(
Expand Down

0 comments on commit 2c1b03a

Please sign in to comment.