Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
hdr-histogram-percentiles-obj
Advanced tools
A little lib for turning hdr-histogram-js to objects
npm install --save hdr-histogram-percentiles-obj
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])
})
hdr-histogram-percentiles-obj has two utility functions to use
histogram
: A hdr-histogram-js object you want to get some values from in a js objecttotal
: the total amount recorded by the histogram, optionalReturns a json object with the min
, max
, average
(mean) and stddev
histogram
: A hdr-histogram-js object you want to retrieve the percentiles fromhistAsObjResult
: the result returned when histAsObj
is called on some hdr-histogram-js objectReturns 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
.
An array listing the percentiles that hdr-histogram-percentiles-obj adds, as numbers.
Kindly sponsored by nearForm
FAQs
A little lib for turning hdr-histogram-js to objects
We found that hdr-histogram-percentiles-obj demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.