PMADDDERIVED - Online Linux Manual PageSection : 3
Updated :
Source : Performance Co-Pilot
NAMEpmAddDerived, pmAddDerivedMetric − register a per-context derived metric name and definition
C SYNOPSIS#include <pcp/pmapi.h> char *pmAddDerived(char *name, char *expr);
int pmAddDerivedMetric(char *name, char *expr, char **errmsg); cc ... −lpcp
DESCRIPTIONDerived metrics provide a way of extending the Performance Metrics Name Space (PMNS) with new metrics defined at the PCP client-side using expressions over the existing performance metrics. The pmAddDerived and pmAddDerivedMetric routines may be used to create per-context derived metrics, and can only be used after the current PMAPI context has been created with pmNewContext(3). Per-context derived metrics are similar in all aspects except scope to global derived metrics. The latter are defined across all PMAPI contexts and are created with the associated pmRegisterDerived(3), pmRegisterDerivedMetric(3) and pmRegisterLoadConfig(3) routines. The arguments to pmAddDerived are the name of the new derived metric and expr is an expression defining how the values of name should be computed. pmAddDerivedMetric is the exact functional equivalent to pmAddDerived except that it provides a simplified model of error handling, where a formatted message is returned via the errmsg parameter. Refer to the pmRegisterDerived(3) man page for a complete description of the syntactic rules for name, the syntactic and semantic rules for expr, return values and the associated error reporting mechanisms, and the expression evaluation rules. Note that for per-context derived metrics, all syntactic and semantic checks are performed at the time pmAddDerived or pmAddDerivedMetric is called. This is different to global derived metrics where the semantic checks are delayed until the metric is used in a specific PMAPI context. There is no ``unregister'' method, so once registered a per-context derived metric persists for the life of the PMAPI context, but it is destroyed as a side-effect of pmDestroyContext(3).
DIAGNOSTICSOn success, pmAddDerived returns NULL. If a syntactic error is found at the time of calling, the value returned by pmAddDerived is a pointer into expr indicating where the error was found. To identify what the error was, the application should call pmDerivedErrStr(3) to retrieve the corresponding parser error message. pmAddDerivedMetric returns 0 and errmsg is undefined if the parsing is successful. If the given expr does not conform to the required syntax pmAddDerivedMetric returns −1 and a dynamically allocated error message string in errmsg. The error message is terminated with a newline and includes both the input name and expr, along with an indicator of the position at which the error was detected. e.g.
Error: pmAddDerivedMetric("my.disk.rates", ...) syntax error
4rat(disk.dev.read)
^ The position indicator line may be followed by an additional diagnostic line describing the nature of the error, when available. In the case of an error, the caller is responsible for calling free(3) to release the space allocated for errmsg.
SEE ALSOPCPIntro(1), PMAPI(3), pmDerivedErrStr(3), pmDestroyContext(3), pmLoadDerivedConfig(3), pmNewContext(3), pmRegisterDerived(3), pmRegisterDerivedMetric(3) and PMNS(5). 0
Johanes Gumabo
Data Size : 10,276 byte
man-pmAddDerivedMetric.3Build : 2024-12-05, 20:55 :
Visitor Screen : x
Visitor Counter ( page / site ) : 2 / 237,272
Visitor ID : :
Visitor IP : 13.59.36.4 :
Visitor Provider : AMAZON-02 :
Provider Position ( lat x lon ) : 39.962500 x -83.006100 : x
Provider Accuracy Radius ( km ) : 1000 :
Provider City : Columbus :
Provider Province : Ohio , : ,
Provider Country : United States :
Provider Continent : North America :
Visitor Recorder : Version :
Visitor Recorder : Library :
Online Linux Manual Page : Version : Online Linux Manual Page - Fedora.40 - march=x86-64 - mtune=generic - 24.12.05
Online Linux Manual Page : Library : lib_c - 24.10.03 - march=x86-64 - mtune=generic - Fedora.40
Online Linux Manual Page : Library : lib_m - 24.10.03 - march=x86-64 - mtune=generic - Fedora.40
Data Base : Version : Online Linux Manual Page Database - 24.04.13 - march=x86-64 - mtune=generic - fedora-38
Data Base : Library : lib_c - 23.02.07 - march=x86-64 - mtune=generic - fedora.36
Very long time ago, I have the best tutor, Wenzel Svojanovsky . If someone knows the email address of Wenzel Svojanovsky , please send an email to johanes_gumabo@yahoo.co.id .
If error, please print screen and send to johanes_gumabo@yahoo.co.id
Under development. Support me via PayPal.