From 65ffb6c2f42bfb37c25bbde78a95655987d9ed73 Mon Sep 17 00:00:00 2001 From: Hartmut Kaiser Date: Fri, 1 Mar 2013 10:13:24 -0600 Subject: [PATCH] More work on #731 --- hpx/hpx_fwd.hpp | 8 +++++--- .../server/base_performance_counter.hpp | 6 ++++-- src/util/query_counters.cpp | 3 ++- tests/regressions/util/function_serialization.cpp | 4 +--- 4 files changed, 12 insertions(+), 9 deletions(-) diff --git a/hpx/hpx_fwd.hpp b/hpx/hpx_fwd.hpp index d0af3261eb51..89518e9fee00 100644 --- a/hpx/hpx_fwd.hpp +++ b/hpx/hpx_fwd.hpp @@ -1099,7 +1099,9 @@ namespace hpx /// \brief Query all active performance counters, optionally naming the /// point in code marked by this function, /// - /// \param description [in] this is a optional value naming the point in + /// \param reset [in] this is an optional falg allowing to reset + /// the counter value after it has been evaluated. + /// \param description [in] this is an optional value naming the point in /// the code marked by the call to this function. /// \param ec [in,out] this represents the error status on exit, if this /// is pre-initialized to \a hpx#throws the function will throw @@ -1117,8 +1119,8 @@ namespace hpx /// \note The active counters are those which have been specified on /// the command line while executing the application (see command /// line option --hpx:print-counter) - HPX_API_EXPORT void evaluate_active_counters(char const* description = 0, - error_code& ec = throws); + HPX_API_EXPORT void evaluate_active_counters(bool reset = false, + char const* description = 0, error_code& ec = throws); } #include diff --git a/hpx/performance_counters/server/base_performance_counter.hpp b/hpx/performance_counters/server/base_performance_counter.hpp index f6fb1bc68bac..1c85c4a1c5d0 100644 --- a/hpx/performance_counters/server/base_performance_counter.hpp +++ b/hpx/performance_counters/server/base_performance_counter.hpp @@ -118,8 +118,10 @@ namespace hpx { namespace performance_counters { namespace server /// The \a get_counter_value_action queries the value of a performance /// counter. - HPX_DEFINE_COMPONENT_ACTION(base_performance_counter, - get_counter_value_nonvirt, get_counter_value_action); + typedef hpx::actions::result_action1< + base_performance_counter, counter_value, bool, + &base_performance_counter::get_counter_value_nonvirt + > get_counter_value_action; /// The \a set_counter_value_action HPX_DEFINE_COMPONENT_ACTION(base_performance_counter, diff --git a/src/util/query_counters.cpp b/src/util/query_counters.cpp index ab8a21e45f0f..1fe207f5b268 100644 --- a/src/util/query_counters.cpp +++ b/src/util/query_counters.cpp @@ -236,7 +236,8 @@ namespace hpx { namespace util wait_all(reset, ec); } - bool query_counters::evaluate_counters(char const* description, error_code& ec) + bool query_counters::evaluate_counters(bool reset, + char const* description, error_code& ec) { if (timer_.is_terminated()) { diff --git a/tests/regressions/util/function_serialization.cpp b/tests/regressions/util/function_serialization.cpp index 08d2cd8a9c5b..c17103075809 100644 --- a/tests/regressions/util/function_serialization.cpp +++ b/tests/regressions/util/function_serialization.cpp @@ -39,8 +39,6 @@ void worker(hpx::util::function const& f) std::vector targets = hpx::find_remote_localities(); - hpx::reset_active_counters(); - for (std::size_t j = 0; j < 100; ++j) { for (std::size_t i = 0; i < targets.size(); ++i) @@ -49,7 +47,7 @@ void worker(hpx::util::function const& f) } } - hpx::evaluate_active_counters("---"); + hpx::evaluate_active_counters(true, "---"); } ///////////////////////////////////////////////////////////////////////////////