зарегистрировать глобальное производное имя и определение метрики (register a global derived metric name and definition)
Диагностика (Diagnostic)
On success, pmRegisterDerived
returns NULL.
If a syntactic error is found at the time of registration, the
value returned by pmRegisterDerived
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.
pmRegisterDerivedMetric
returns 0 and errmsg is undefined if the
parsing is successful.
If the given expr does not conform to the required syntax
pmRegisterDerivedMetric
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: pmRegisterDerivedMetric("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.