| Newsgroups |
gmane.comp.sysutils.pcp |
| Message-ID |
<[email protected]> |
[pcp:master] New Comment on Issue #270 boolean / quantified operations for derived-metrics ( https://github.com/performancecopilot/pcp/issues/270 )
By wcohen ( https://github.com/wcohen ) :
Yes, boolean operators (with short-circuiting) would be useful. A common idiom in analyzing performance is computing a ratio between two values and would want make sure that divide by zero does not occur. For example trying to compute the equivalent to "sar -B" %vmeff. The %vmeff is sum(mem.vmstat.pgsteal *)/sum(mem.vmstat.pgscan ). if mem.vmstat.pgscan_ are all zero because there is plenty of memory and no page reclaimation has been attempted that divide is not going to work.
Maybe a special bounded divide operator where 1/0 is considered infinity and the function takes an argument for the max value it will return.
bounded_divide(numerator, denominator, bound)
bounded_divide(1, 0, 2) == 2 bounded_divide(1, 2, 2) == 0.5