hdr-histogram-percentiles-obj
A little lib for turning native-hdr-histograms to objects
Last updated 7 years ago by thekemkid .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ gnpm install hdr-histogram-percentiles-obj 
SYNC missed versions from official npm registry.

hdr-histogram-percentiles-obj

Install

npm install --save hdr-histogram-percentiles-obj

Usage

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))
histPercentileObj.percentiles.forEach((p) => {
  const key = `p${p}`.replace('.', '_')
  console.log(`${p}%`, resultWithPercentiles[key])
})

API

hdr-histogram-percentiles-obj has two utility functions to use

histAsObj(histogram, total)

  • histogram: A hdr-histogram-js object you want to get some values from in a js object
  • total: the total amount recorded by the histogram, optional

Returns a json object with the min, max, average (mean) and stddev

addPercentiles(histogram, histAsObjResult)

  • histogram: A hdr-histogram-js object you want to retrieve the percentiles from
  • histAsObjResult: the result returned when histAsObj is called on some hdr-histogram-js object

Returns the histAsObjResult with the percentiles properties added. Percentile properties are named pNN_DD, for the NN.DD% percentile. Eg., the 99th percentile is p99, while the 99.99th percentile is p99_99.

percentiles

An array listing the percentiles that hdr-histogram-percentiles-obj adds, as numbers.

Sponsor

Kindly sponsored by nearForm

License

MIT

Current Tags

  • 3.0.0                                ...           latest (4 years ago)

7 Versions

  • 3.0.0                                ...           4 years ago
  • 2.0.1                                ...           6 years ago
  • 2.0.0                                ...           6 years ago
  • 1.2.0                                ...           7 years ago
  • 1.1.0                                ...           8 years ago
  • 1.0.3                                ...           8 years ago
  • 1.0.0                                ...           8 years ago
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (1)
Dev Dependencies (4)
Dependents (1)

Copyright 2013 - present © cnpmjs.org | Home |