object ExpHist extends Serializable
- Alphabetic
- By Inheritance
- ExpHist
- Serializable
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Type Members
- case class Bucket(size: Long, timestamp: Timestamp) extends Product with Serializable
- size
number of items tracked by this bucket.
- timestamp
timestamp of the most recent item tracked by this bucket.
- final case class CanonicalVector(rep: Vector[Int]) extends AnyVal with Product with Serializable
- case class Config(epsilon: Double, windowSize: Long) extends Product with Serializable
ExpHist guarantees that the returned guess will be within
epsilon
relative error of the true count across a sliding window of sizewindowSize
.ExpHist guarantees that the returned guess will be within
epsilon
relative error of the true count across a sliding window of sizewindowSize
.- epsilon
relative error, from [0, 0.5]
- windowSize
number of time ticks to track
- final case class Timestamp(toLong: Long) extends AnyVal with Product with Serializable
Value class wrapper around timestamps (>= 0) used by each bucket.
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- def empty(conf: Config): ExpHist
Returns an empty instance with the supplied Config.
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- def from(i: Long, ts: Timestamp, conf: Config): ExpHist
Returns an instance directly from a number
i
.Returns an instance directly from a number
i
. All buckets in the returned ExpHist will have the same timestamp, equal tots
. - final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- object Bucket extends Serializable
- object Canonical
The paper that introduces the exponential histogram proves that, given a positive number
l
, every integer s can be uniquely represented as the sum ofThe paper that introduces the exponential histogram proves that, given a positive number
l
, every integer s can be uniquely represented as the sum of(l or (l + 1)) * 2i + (# from 1 to (l + 1)) 2j
for i = (0 to j - 1), given some j.
The paper calls this the "l-canonical" representation of s.
It turns out that if you follow the exponential histogram bucket-merging algorithm, you end up with the invariant that the number of buckets with size 2^i exactly matches that power of 2's coefficient in s's l-canonical representation.
Put another way - only sequences of buckets with sizes matching the l-canonical representation of some number s are valid exponential histograms.
(We use this idea in
ExpHist.rebucket
to take a sequence of buckets of any size and rebucket them into a sequence where the above invariant holds.)This is huge. This means that you can implement
addAll(newBuckets)
by- calculating newS = s + delta contributed by newBuckets
- generating the l-canonical sequence of bucket sizes for newS
- rebucketing newBuckets ++ oldBuckets into those bucket sizes
The resulting sequence of buckets is a valid exponential histogram.
- object Timestamp extends Serializable