com.bigdata.counters.query
Class HistoryTable

java.lang.Object
  extended by com.bigdata.counters.query.HistoryTable

public class HistoryTable
extends Object

A class representing one or more performance counter histories where those histories have been aligned so that the individual timestamps for the performance counter values in each row are aligned.

Version:
$Id: HistoryTable.java 2265 2009-10-26 12:51:06Z thompsonbry $ FIXME provide aggregation either here or in how the counters are selected. The capturing groups should specify the dimensions of aggregation.
Author:
Bryan Thompson

Field Summary
 ICounter[] a
          The selected counters.
 PeriodEnum basePeriod
          Identifies the history to be written for each of the selected counters by its based reporting period.
 IHistoryEntry[][] data
          An array of the performance counter values.
 long firstTimestamp
          The earliest timestamp in the selected history units for any of the specified counters.
 long lastTimestamp
          The most recent timestamp in the selected history units for any of the specified counters.
protected static org.apache.log4j.Logger log
           
 int ncols
          The #of columns in the table.
 int nrows
          The #of rows in the table.
 long period
          The #of milliseconds in each unit for units.
 String units
          The label for the units of the history.
 
Constructor Summary
HistoryTable(ICounter[] a, PeriodEnum basePeriod)
           
 
Method Summary
 int getFirstRowIndex(int counterIndex)
          The index of the row into which the first sample for a counter falls is given by
 long getTimestamp(int row)
          Return the timestamp for the row, which is the timestamp of first sample which would be allowed into the logical slot for that row.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected static final org.apache.log4j.Logger log

a

public final ICounter[] a
The selected counters.


basePeriod

public final PeriodEnum basePeriod
Identifies the history to be written for each of the selected counters by its based reporting period.


firstTimestamp

public final long firstTimestamp
The earliest timestamp in the selected history units for any of the specified counters.


lastTimestamp

public final long lastTimestamp
The most recent timestamp in the selected history units for any of the specified counters.


nrows

public final int nrows
The #of rows in the table. This can be more than the #of samples. It is in fact the max( sampleCount + rowOffset) for each counters.


ncols

public final int ncols
The #of columns in the table. This is the same as the #of counters specified to the ctor.


units

public final String units
The label for the units of the history.


period

public final long period
The #of milliseconds in each unit for units.


data

public final IHistoryEntry[][] data
An array of the performance counter values. The first index is the row. The second index is the column and is correlated with the array specified to the ctor. The rows of the performance counters in the caller's array are aligned by first deciding which counter has the earliest timestamp to be reported (firstSampleTimeIndex) and then examining the other counters and deciding if they have a value for the same reporting period. If a counter has a value for the same reporting period then the value is incorporated into that row and the row index for that counter is advanced. Otherwise the row index for that counter IS NOT advanced. If there is no data for a given counter in a given row then that cell will be null. It is necessary to align the samples in this manner as counters are created and destroyed over the life of the system and thus some counters may not have data for some reporting periods.

Constructor Detail

HistoryTable

public HistoryTable(ICounter[] a,
                    PeriodEnum basePeriod)
Parameters:
a - The selected counters.
basePeriod - Identifies the history to be written for each of the selected counters by its based reporting period.
Method Detail

getFirstRowIndex

public int getFirstRowIndex(int counterIndex)
The index of the row into which the first sample for a counter falls is given by
 (int) (firstLogicalSlot[counterIndex] - logicalSlotOffset)
 

Parameters:
counterIndex - The index of the counter in the array specified to the ctor.

getTimestamp

public long getTimestamp(int row)
Return the timestamp for the row, which is the timestamp of first sample which would be allowed into the logical slot for that row.

Parameters:
row - The row.
Returns:
The timestamp of the first sample which would be allowed into that row.


Copyright © 2006-2011 SYSTAP, LLC. All Rights Reserved.