histobins - histogram bins utility for scripts/hal-histogram
Usage: 
Read availablebins pin for the number of bins available.
Set the minvalue, binsize, and nbins pins. 
Ensure nbins <= availablebins 
For nbins = N, the bins are numbered: 0 ... N-1 
Iterate: 
Set index pin to a bin number: 0 <= index < nbins.
Read check pin and verify that check pin == index pin. 
Read outputs: binvalue, pextra, nextra pins. 
(binvalue is count for the indexed bin) 
(pextra is count for all inputs > maxvalue) 
(nextra is count for all bins < minvalue)
If index is out
of range (index < 0 or index > maxbinnumber) 
then binvalue == -1. 
The input-error pin is set when input rules are violated
and updates cease. 
The reset pin may be used to restart. 
The input used is selected based on pintype: 
pintype inputpin 
------- ----------- 
0 input 
1 input-s32 
2 input-u32 
3 input-bit 
Additional output statistics pins: 
input-min 
input-max 
nsamples 
variance 
mean 
The method input pin selects an alternate variance
calculation.
Maintainers note: hardcoded for MAXBINNUMBER==200
histobins.N (requires a floating-point thread)
histobins.N.pintype
u32 in 
histobins.N.input float in 
histobins.N.input-s32 s32 in 
histobins.N.input-u32 u32 in 
histobins.N.input-bit bit in 
histobins.N.nbins u32 in (default:
20) 
histobins.N.binsize float in (default:
1) 
histobins.N.minvalue float in (default:
0) 
histobins.N.index s32 in 
histobins.N.check s32 out 
histobins.N.reset bit in 
histobins.N.method bit in 
histobins.N.input-error bit out 
histobins.N.binvalue float out 
histobins.N.pextra float out 
histobins.N.nextra float out 
histobins.N.input-min float out 
histobins.N.input-max float out 
histobins.N.nsamples u32 out 
histobins.N.variance float out 
histobins.N.mean float out 
histobins.N.availablebins s32 out
(default: 200)
GPL