| Mercury Monitor Reference Manual |
|---|
Asynchronous registry interfaceAsynchronous registry interface — |
#include <monitor/producer/prod_registry.h> int prod_metric_def_get (const char *name, mon_metric_def **def_ptr, mon_ctx *ctx); int prod_ctrl_def_get (const char *name, mon_metric_def **def_ptr, mon_ctx *ctx); prod_registry_module; #define PROD_REGISTRY_API #define PROD_SYMBOL_REGISTRY #define PROD_REGISTRY_MODULE (desc) int prod_registry_add (prod_registry_module *registry, prod_module_type type); void prod_registry_ref (prod_registry_module *registry); void prod_registry_done (prod_registry_module *registry); int prod_registry_register (mon_module *module); void prod_registry_unregister (mon_module *module);
int prod_metric_def_get (const char *name,
mon_metric_def **def_ptr,
mon_ctx *ctx);Retrieves a metric definition asynchronously.
| name : | the name of the metric. |
| def_ptr : | where to store the retrieved definition. |
| ctx : | the mon_ctx to use for execution. |
| Returns : | 0 if the metric was found, MON_CONTINUE if the execution was suspended or an error code. |
int prod_ctrl_def_get (const char *name,
mon_metric_def **def_ptr,
mon_ctx *ctx);Retrieves a control definition asynchronously.
| name : | the name of the control. |
| def_ptr : | where to store the retrieved definition. |
| ctx : | the mon_ctx to use for execution. |
| Returns : | 0 if the metric was found, MON_CONTINUE if the execution was suspended or an error code. |
typedef struct {
mon_module header;
const char *name_glob;
int (*lookup)(prod_registry_module *registry,
mon_metric_def_domain domain,
const char *name,
mon_metric_def **def_ptr,
mon_ctx *ctx);
} prod_registry_module;
Describes an asynchronous registry module.
| mon_module header; | the generic module headers. |
| const char *name_glob; | shell-like glob expression matching the metric/control names server by this module. |
| lookup () | the lookup function for retrieving metric/control definitions. |
#define PROD_REGISTRY_API 1
Defines the async. registry API version implemented by the library.
#define PROD_SYMBOL_REGISTRY MON_MODSYM(prod_module_registry)
Defines the symbol name of the async. registry module descriptor table in a loadable module.
#define PROD_REGISTRY_MODULE(desc)
Declares an async. registry module.
| desc : | the name of the prod_registry_module descriptor. |
int prod_registry_add (prod_registry_module *registry, prod_module_type type);
Registers a new async. registry module.
| registry : | a prod_registry_module to register. |
| type : | the type of the module. |
| Returns : | 0 if successful or an error code. |
void prod_registry_ref (prod_registry_module *registry);
Increments the reference count of a prod_registry_module.
| registry : | a prod_registry_module. |
void prod_registry_done (prod_registry_module *registry);
Decrements the reference count for a prod_registry_module. If the reference count reaches zero, the module is deallocated (or unloaded if it was a DSO).
| registry : | a prod_registry_module. |
int prod_registry_register (mon_module *module);
Wrapper around prod_registry_add() for registering dynamically loaded modules.
| module : | a prod_registry_module to register. |
| Returns : | 0 if successful or an error code. |
void prod_registry_unregister (mon_module *module);
Unregisters an async. registry module.
| module : | a prod_registry_module to unregister. |
| << Module Support | Common RPC Functions >> |