diff --git a/libs/full/performance_counters/src/parcelhandler_counter_types.cpp b/libs/full/performance_counters/src/parcelhandler_counter_types.cpp index a550d4a1034..d74eb6740d6 100644 --- a/libs/full/performance_counters/src/parcelhandler_counter_types.cpp +++ b/libs/full/performance_counters/src/parcelhandler_counter_types.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2021-2023 Hartmut Kaiser +// Copyright (c) 2021-2024 Hartmut Kaiser // // SPDX-License-Identifier: BSL-1.0 // Distributed under the Boost Software License, Version 1.0. (See accompanying @@ -20,22 +20,16 @@ namespace hpx::performance_counters { +#if defined(HPX_HAVE_PARCELPORT_COUNTERS) /////////////////////////////////////////////////////////////////////////// - void register_parcelhandler_counter_types( + static void register_parcelhandler_counter_types( parcelset::parcelhandler& ph, std::string const& pp_type) { -#if defined(HPX_HAVE_PARCELPORT_COUNTERS) - if (!ph.is_networking_enabled()) - { - return; - } - using placeholders::_1; using placeholders::_2; using parcelset::parcelhandler; -#if defined(HPX_HAVE_PARCELPORT_COUNTERS) && \ - defined(HPX_HAVE_PARCELPORT_ACTION_COUNTERS) +#if defined(HPX_HAVE_PARCELPORT_ACTION_COUNTERS) hpx::function num_parcel_sends( hpx::bind_front( &parcelhandler::get_action_parcel_send_count, &ph, pp_type)); @@ -59,8 +53,7 @@ namespace hpx::performance_counters { hpx::function receiving_time( hpx::bind_front(&parcelhandler::get_receiving_time, &ph, pp_type)); -#if defined(HPX_HAVE_PARCELPORT_COUNTERS) && \ - defined(HPX_HAVE_PARCELPORT_ACTION_COUNTERS) +#if defined(HPX_HAVE_PARCELPORT_ACTION_COUNTERS) hpx::function sending_serialization_time(hpx::bind_front( &parcelhandler::get_action_sending_serialization_time, &ph, @@ -78,8 +71,7 @@ namespace hpx::performance_counters { &ph, pp_type)); #endif -#if defined(HPX_HAVE_PARCELPORT_COUNTERS) && \ - defined(HPX_HAVE_PARCELPORT_ACTION_COUNTERS) +#if defined(HPX_HAVE_PARCELPORT_ACTION_COUNTERS) hpx::function data_sent( hpx::bind_front( &parcelhandler::get_action_data_sent, &ph, pp_type)); @@ -139,8 +131,7 @@ namespace hpx::performance_counters { "connection type for the referenced locality", pp_type), HPX_PERFORMANCE_COUNTER_V1, -#if defined(HPX_HAVE_PARCELPORT_COUNTERS) && \ - defined(HPX_HAVE_PARCELPORT_ACTION_COUNTERS) +#if defined(HPX_HAVE_PARCELPORT_ACTION_COUNTERS) hpx::bind( &performance_counters::per_action_data_counter_creator, _1, HPX_MOVE(num_parcel_sends), _2), @@ -160,8 +151,7 @@ namespace hpx::performance_counters { "connection type for the referenced locality", pp_type), HPX_PERFORMANCE_COUNTER_V1, -#if defined(HPX_HAVE_PARCELPORT_COUNTERS) && \ - defined(HPX_HAVE_PARCELPORT_ACTION_COUNTERS) +#if defined(HPX_HAVE_PARCELPORT_ACTION_COUNTERS) hpx::bind( &performance_counters::per_action_data_counter_creator, _1, HPX_MOVE(num_parcel_receives), _2), @@ -232,8 +222,7 @@ namespace hpx::performance_counters { "referenced locality", pp_type), HPX_PERFORMANCE_COUNTER_V1, -#if defined(HPX_HAVE_PARCELPORT_COUNTERS) && \ - defined(HPX_HAVE_PARCELPORT_ACTION_COUNTERS) +#if defined(HPX_HAVE_PARCELPORT_ACTION_COUNTERS) hpx::bind( &performance_counters::per_action_data_counter_creator, _1, HPX_MOVE(sending_serialization_time), _2), @@ -253,8 +242,7 @@ namespace hpx::performance_counters { "referenced locality", pp_type), HPX_PERFORMANCE_COUNTER_V1, -#if defined(HPX_HAVE_PARCELPORT_COUNTERS) && \ - defined(HPX_HAVE_PARCELPORT_ACTION_COUNTERS) +#if defined(HPX_HAVE_PARCELPORT_ACTION_COUNTERS) hpx::bind( &performance_counters::per_action_data_counter_creator, _1, HPX_MOVE(receiving_serialization_time), _2), @@ -304,8 +292,7 @@ namespace hpx::performance_counters { "type by the referenced locality", pp_type), HPX_PERFORMANCE_COUNTER_V1, -#if defined(HPX_HAVE_PARCELPORT_COUNTERS) && \ - defined(HPX_HAVE_PARCELPORT_ACTION_COUNTERS) +#if defined(HPX_HAVE_PARCELPORT_ACTION_COUNTERS) hpx::bind( &performance_counters::per_action_data_counter_creator, _1, HPX_MOVE(data_sent), _2), @@ -326,8 +313,7 @@ namespace hpx::performance_counters { "type by the referenced locality", pp_type), HPX_PERFORMANCE_COUNTER_V1, -#if defined(HPX_HAVE_PARCELPORT_COUNTERS) && \ - defined(HPX_HAVE_PARCELPORT_ACTION_COUNTERS) +#if defined(HPX_HAVE_PARCELPORT_ACTION_COUNTERS) hpx::bind( &performance_counters::per_action_data_counter_creator, _1, HPX_MOVE(data_received), _2), @@ -480,23 +466,14 @@ namespace hpx::performance_counters { performance_counters::install_counter_types( counter_types, std::size(counter_types)); -#else - HPX_UNUSED(ph); - HPX_UNUSED(pp_type); -#endif } /////////////////////////////////////////////////////////////////////////// // register connection specific performance counters related to connection // caches - void register_connection_cache_counter_types( + static void register_connection_cache_counter_types( parcelset::parcelhandler& ph, std::string const& pp_type) { - if (!ph.is_networking_enabled()) - { - return; - } - using hpx::placeholders::_1; using hpx::placeholders::_2; @@ -589,10 +566,18 @@ namespace hpx::performance_counters { performance_counters::install_counter_types( connection_cache_types, std::size(connection_cache_types)); } +#endif /////////////////////////////////////////////////////////////////////////// - void register_parcelhandler_counter_types(parcelset::parcelhandler& ph) + void register_parcelhandler_counter_types( + [[maybe_unused]] parcelset::parcelhandler& ph) { +#if defined(HPX_HAVE_PARCELPORT_COUNTERS) + if (!ph.is_networking_enabled()) + { + return; + } + // register connection specific counters ph.enum_parcelports([&](std::string const& type) -> bool { register_parcelhandler_counter_types(ph, type); @@ -644,6 +629,7 @@ namespace hpx::performance_counters { performance_counters::install_counter_types( counter_types, std::size(counter_types)); +#endif } } // namespace hpx::performance_counters