hpx/runtime_local/thread_pool_helpers.hpp#

Defined in header hpx/runtime_local/thread_pool_helpers.hpp.

See Public API for a list of names and headers that are part of the public HPX API.

namespace hpx
namespace resource#

Functions

std::size_t get_num_thread_pools()#

Return the number of thread pools currently managed by the resource_partitioner

std::size_t get_num_threads()#

Return the number of threads in all thread pools currently managed by the resource_partitioner

std::size_t get_num_threads(std::string const &pool_name)#

Return the number of threads in the given thread pool currently managed by the resource_partitioner

std::size_t get_num_threads(std::size_t pool_index)#

Return the number of threads in the given thread pool currently managed by the resource_partitioner

std::size_t get_pool_index(std::string const &pool_name)#

Return the internal index of the pool given its name.

std::string const &get_pool_name(std::size_t pool_index)#

Return the name of the pool given its internal index.

threads::thread_pool_base &get_thread_pool(std::string const &pool_name)#

Return the name of the pool given its name.

threads::thread_pool_base &get_thread_pool(std::size_t pool_index)#

Return the thread pool given its internal index.

bool pool_exists(std::string const &pool_name)#

Return true if the pool with the given name exists.

bool pool_exists(std::size_t pool_index)#

Return true if the pool with the given index exists.

namespace threads

Functions

std::int64_t get_thread_count(thread_schedule_state state = thread_schedule_state::unknown)#

The function get_thread_count returns the number of currently known threads.

Note

If state == unknown this function will not only return the number of currently existing threads, but will add the number of registered task descriptions (which have not been converted into threads yet).

Parameters

state – [in] This specifies the thread-state for which the number of threads should be retrieved.

std::int64_t get_thread_count(thread_priority priority, thread_schedule_state state = thread_schedule_state::unknown)#

The function get_thread_count returns the number of currently known threads.

Note

If state == unknown this function will not only return the number of currently existing threads, but will add the number of registered task descriptions (which have not been converted into threads yet).

Parameters
  • priority – [in] This specifies the thread-priority for which the number of threads should be retrieved.

  • state – [in] This specifies the thread-state for which the number of threads should be retrieved.

std::int64_t get_idle_core_count()#

The function get_idle_core_count returns the number of currently idling threads (cores).

mask_type get_idle_core_mask()#

The function get_idle_core_mask returns a bit-mask representing the currently idling threads (cores).

bool enumerate_threads(hpx::function<bool(thread_id_type)> const &f, thread_schedule_state state = thread_schedule_state::unknown)#

The function enumerate_threads will invoke the given function f for each thread with a matching thread state.

Parameters
  • f – [in] The function which should be called for each matching thread. Returning ‘false’ from this function will stop the enumeration process.

  • state – [in] This specifies the thread-state for which the threads should be enumerated.