HPX - High Performance ParalleX

PrevUpHomeNext

Function install_counter_type

hpx::performance_counters::install_counter_type — Install a new generic performance counter type in a way, which will uninstall it automatically during shutdown.

Synopsis

// In header: <hpx/performance_counters/manage_counter_type.hpp>


counter_status 
install_counter_type(std::string const & name, 
                     std::function< boost::int64_t(bool)> const & counter_value, 
                     std::string const & helptext = "", 
                     std::string const & uom = "", error_code & ec = throws);

Description

The function install_counter_type will register a new generic counter type based on the provided function. The counter type will be automatically unregistered during system shutdown. Any consumer querying any instance of this this counter type will cause the provided function to be called and the returned value to be exposed as the counter value.

The counter type is registered such that there can be one counter instance per locality. The expected naming scheme for the counter instances is: '/objectname{locality#<*>/total}/countername' where '<*>' is a zero based integer identifying the locality the counter is created on.

[Note] Note

As long as ec is not pre-initialized to hpx::throws this function doesn't throw but returns the result code using the parameter ec. Otherwise it throws an instance of hpx::exception.

[Note] Note

The counter type registry is a locality based service. You will have to register each counter type on every locality where a corresponding performance counter will be created.

Parameters:

counter_value

[in] The function to call whenever the counter value is requested by a consumer.

ec

[in,out] this represents the error status on exit, if this is pre-initialized to hpx::throws the function will throw on error instead.

helptext

[in, optional] A longer descriptive text shown to the user to explain the nature of the counters created from this type.

name

[in] The global virtual name of the counter type. This name is expected to have the format /objectname/countername.

uom

[in] The unit of measure for the new performance counter type.

Returns:

If successful, this function returns status_valid_data, otherwise it will either throw an exception or return an error_code from the enum counter_status (also, see note related to parameter ec).


PrevUpHomeNext