npm install --save hdr-histogram-percentiles-obj
const histPercentileObj = require('hdr-histogram-percentiles-obj')
const Histogram = require('native-hdr-histogram')
const histogram = new Histogram(1, 100)
const total = 0
// record some histogram data...
// total++...
const result = histPercentileObj.histAsObj(histogram, total)
const resultWithPercentiles = histPercentileObj.addPercentiles(histogram, histPercentileObj.histAsObj(histogram, total))
const histPercentileObj = require('hdr-histogram-percentiles-obj')
const Histogram = require('hdr-histogram-js')
const histogram = hdr.build({
lowestDiscernibleValue: 1,
highestTrackableValue: 100
})
const total = 0
// record some histogram data...
// total++...
const result = histPercentileObj.histAsObj(histogram, total)
const resultWithPercentiles = histPercentileObj.addPercentiles(histogram, histPercentileObj.histAsObj(histogram, total))
hdr-histogram-percentiles-obj has two utility functions to use
histogram
: A native-hdr-histogram object you want to get some values from in a js objecttotal
: the total amount recorded by the histogram, optional
Returns a json object with the min
, max
, average
(mean) and stddev
histogram
: A native-hdr-histogram object you want to retrieve the percentiles fromhistAsObjResult
: the result returned whenhistAsObj
is called on some native-hdr-histogram object
Returns the histAsObjResult with the percentiles properties added
Kindly sponsored by nearForm