|
NAME | C SYNOPSIS | DESCRIPTION | RETURN VALUE | DIAGNOSTICS | SEE ALSO | COLOPHON |
|
|
|
PMWEBTIMERREGISTER(3) Library Functions Manual PMWEBTIMERREGISTER(3)
pmWebTimerRegister, pmWebTimerRelease, pmWebTimerSetMetricRegistry
- thread-safe timer list management
#include <pcp/pmwebapi.h>
typedef void (*pmWebTimerCallBack)(void *data);
int pmWebTimerRegister(pmWebTimerCallBack callback, void *data);
int pmWebTimerRelease(int seq);
int pmWebTimerSetMetricRegistry(struct mmv_registry *registry);
cc ... -lpcp_web
The pmWebTimerRegister and related API functions provide a conveā
nient thread-safe API for applications to manage a list of timer
driven callbacks. On the first call to pmWebTimerRegister or
pmWebTimerSetMetricRegistry, an internal timer is set up and iniā
tialized to fire every 1.0 seconds. Each time the timer fires,
all currently registered callback functions will be called serialā
ly with the opaque data pointer that was supplied when each funcā
tion was registered. The pmWebTimerCallBack typedef provides a
suitable callback function prototype.
All registered callback functions should be non-blocking and exeā
cute quickly and synchronously. Typical callback functions inā
clude refreshing instrumentation, calculating and updating perforā
mance metric values, periodic garbage collection and any other loā
cal function that requires regular execution.
The pmWebTimerSetMetricRegistry function provides a convenient way
for an application to pass in a pointer to an libpcp_mmv(3) regā
istry that has been suitably initialized by the calling applicaā
tion. This registry will be used to dynamically create six server
resource metrics named NAME.mem.datasz, NAME.mem.maxrss,
NAME.cpu.total, NAME.cpu.sys, NAME.cpu.user and NAME.pid, where
NAME is the root PCP PMNS(5) name set up by the calling applicaā
tion. These metrics should be reasonably self explanatory; they
provide resource usage metrics from the calling application /
server and use getrusage(2), times(2) and getpid(2).
The pmWebTimerRegister function returns a positive integer handle
that may be subsequently used in a call to pmWebTimerRelease to
remove a timer from the internal timer list. When a timer is reā
moved with a call to pmWebTimerRelease, the internal data strucā
tures are freed. The caller however, is responsible for freeing
the associated data (since it may or may not be dynamically alloā
cated).
On failure a negative PMAPI error code is returned in all cases.
pmproxy(1), mmv_stats_registry(3), PMAPI(3) and PMWEBAPI(3).
This page is part of the PCP (Performance Co-Pilot) project. Inā
formation about the project can be found at āØhttp://www.pcp.io/ā©.
If you have a bug report for this manual page, send it to
pcp@groups.io. This page was obtained from the project's upstream
Git repository āØhttps://github.com/performancecopilot/pcp.gitā© on
2026-08-04. (At that time, the date of the most recent commit
that was found in the repository was 2026-08-04.) If you discover
any rendering problems in this HTML version of the page, or you
believe there is a better or more up-to-date source for the page,
or you have corrections or improvements to the information in this
COLOPHON (which is not part of the original manual page), send a
mail to man-pages@man7.org
Performance Co-Pilot PCP PMWEBTIMERREGISTER(3)