Page Speed Optimization Libraries
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Protected Member Functions | List of all members
net_instaweb::Histogram Class Referenceabstract
Inheritance diagram for net_instaweb::Histogram:
net_instaweb::CountHistogram net_instaweb::SharedMemHistogram net_instaweb::SplitHistogram

Public Member Functions

virtual void Add (double value)=0
 Record a value in its bucket.
virtual void Clear ()=0
 Throw away all data.
bool Empty ()
 True if the histogram is empty.
virtual void Render (int index, Writer *writer, MessageHandler *handler)
virtual int NumBuckets ()=0
 Returns number of buckets the histogram actually has.
virtual void EnableNegativeBuckets ()=0
 Allow histogram have negative values.
virtual void SetMinValue (double value)=0
 Set the minimum value allowed in histogram.
virtual void SetMaxValue (double value)=0
virtual void SetSuggestedNumBuckets (int i)=0
double Average ()
 Returns average of the values added.
double Percentile (const double perc)
double StandardDeviation ()
double Count ()
double Maximum ()
double Minimum ()
double Median ()
GoogleString HtmlTableRow (const GoogleString &title, int index)
virtual double BucketStart (int index)=0
virtual double BucketLimit (int index)
 Upper bound of a bucket.
virtual double BucketCount (int index)=0
 Value of a bucket.

Protected Member Functions

virtual double AverageInternal ()=0
 Note that these *Internal interfaces require the mutex to be held.
virtual double PercentileInternal (const double perc)=0
virtual double StandardDeviationInternal ()=0
virtual double CountInternal ()=0
virtual double MaximumInternal ()=0
virtual double MinimumInternal ()=0
virtual AbstractMutexlock ()=0
void WriteRawHistogramData (Writer *writer, MessageHandler *handler)

Member Function Documentation

virtual double net_instaweb::Histogram::BucketStart ( int  index)
pure virtual

Lower bound of a bucket. If index == NumBuckets() + 1, returns the upper bound of the histogram. DCHECK if index is in the range of [0, NumBuckets()+1].

Implemented in net_instaweb::CountHistogram, net_instaweb::SharedMemHistogram, and net_instaweb::SplitHistogram.

GoogleString net_instaweb::Histogram::HtmlTableRow ( const GoogleString title,
int  index 

Formats the histogram statistics as an HTML table row. This is intended for use in Statistics::RenderHistograms.


element id is given id=hist_row_d where d is from the index. Included in the row an input radio button which is initiated in state 'selected' for index==0.

double net_instaweb::Histogram::Percentile ( const double  perc)

Return estimated value that is greater than perc% of all data. e.g. Percentile(20) returns the value which is greater than 20% of data.

virtual void net_instaweb::Histogram::Render ( int  index,
Writer writer,
MessageHandler handler 

Write Histogram Data to the writer. Default implementation does not include histogram graph, but only raw histogram data table. It looks like:

| TITLE String | | Avg: StdDev: Median: 90%: 95%: 99% | | Raw Histogram Data: | | [0,1] 1 25% 25% ||||| | | [2,3] 1 25% 50% ||||| | | [4,5] 2 50% 100% |||||||||| | |_______________________________________|

Reimplemented in net_instaweb::SplitHistogram.

virtual void net_instaweb::Histogram::SetMaxValue ( double  value)
pure virtual

Set the value upper-bound of a histogram, the value range in histogram is [MinValue, MaxValue) or [-MaxValue, MaxValue) if enabled negative buckets.

Implemented in net_instaweb::CountHistogram, net_instaweb::SharedMemHistogram, and net_instaweb::SplitHistogram.

virtual void net_instaweb::Histogram::SetSuggestedNumBuckets ( int  i)
pure virtual

Set the suggested number of buckets for the histogram. The implementation may chose to use a somewhat different number.

Implemented in net_instaweb::CountHistogram, net_instaweb::SharedMemHistogram, and net_instaweb::SplitHistogram.

void net_instaweb::Histogram::WriteRawHistogramData ( Writer writer,
MessageHandler handler 

Helper function of Render(), write entries of histogram raw data table. Each entry includes bucket range, bucket count, percentage, cumulative percentage, bar. It looks like: [0,1] 1 5% 5% |||| [2,3] 2 10% 15% |||||||| Precondition: mutex held.

The documentation for this class was generated from the following file: