for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* Histogram buckets
* User: moyo
* Date: 2018/5/18
* Time: 11:49 AM
*/
namespace Carno\Monitor\Chips\Metrical;
trait HBuckets
{
* @var array
private $bounds = [];
* @param float ...$bounds
* @return static
public function fixed(float ...$bounds) : self
return $this->bucketing($bounds);
}
* @param float $start
* @param float $width
* @param int $count
public function linear(float $start, float $width, int $count) : self
$bounds = [];
for ($i = 0; $i < $count; $i ++) {
$bounds[] = $start;
$start += $width;
* @param float $factor
public function exponential(float $start, float $factor, int $count) : self
$start *= $factor;
* @param array $bounds
private function bucketing(array $bounds) : self
$this->bounds = $bounds;
foreach ($bounds as $idx => $bound) {
$this->buckets[$idx] = 0;
buckets
return $this;