anon.infoservice
Class PerformanceEntry.PerformanceAttributeFloatingTimeEntry

java.lang.Object
  extended by anon.infoservice.PerformanceEntry.PerformanceAttributeFloatingTimeEntry
All Implemented Interfaces:
IXMLEncodable
Enclosing class:
PerformanceEntry

private static class PerformanceEntry.PerformanceAttributeFloatingTimeEntry
extends java.lang.Object
implements IXMLEncodable

The floating time entry. This structure holds all attribute entries that are not older than a given time (usually 1 hour).

Author:
Christian Banse

Field Summary
static long DEFAULT_TIMEFRAME
          The time frame of this floating time entry.
 int m_attribute
          The performance attribute.
private  boolean m_bInfoService
          True, if the object is created by the info service or the JAP client.
private  int m_iErrors
           
private  long m_iLastTimestamp
           
private  int m_iLastValue
          The last value that has been added.
private  int m_iResets
           
private  int m_iUnknown
           
 long m_lastUpdate
          The time of the last update.
private  int m_lBestBoundValue
          The best bound value.
private  PerformanceEntry.Bound m_lBoundValue
          The bound value.
private  java.util.Hashtable m_Values
          The values.
static java.lang.String XML_ATTR_BEST
          The best bound value XML attribute name.
static java.lang.String XML_ATTR_BOUND
          The bound value XML attribute name.
static java.lang.String XML_ATTR_NOT_RECOVERED_BOUND
           
static java.lang.String XML_ELEMENT_VALUE
          The XML element name.
static java.lang.String XML_ELEMENT_VALUES
          The containers XML element name.
 
Fields inherited from interface anon.util.IXMLEncodable
FIELD_XML_ELEMENT_CONTAINER_NAME, FIELD_XML_ELEMENT_NAME, XML_ATTR_ID, XML_ATTR_LANGUAGE, XML_ATTR_VERSION
 
Constructor Summary
PerformanceEntry.PerformanceAttributeFloatingTimeEntry(int a_attribute, boolean a_bInfoService)
          Constructs a new PerformanceAttributeFloatingTimeEntry.
PerformanceEntry.PerformanceAttributeFloatingTimeEntry(int a_attribute, org.w3c.dom.Node a_node)
          Constructs a new PerformanceAttributeFloatingTimeEntry from XML data.
 
Method Summary
 void addValue(long a_lTimeStamp, int a_lValue)
          Adds a value to the floating time entry.
private  int calculateBound(java.util.Hashtable a_hashValues, java.util.Vector a_timestamps)
          Returns the bound value.
 int getAverage()
          Calculates and return the average value.
 int getBestBound()
          Returns the best bound value.
 PerformanceEntry.Bound getBound()
          Returns the bound value.
private  int getBoundFromValue(int value)
           
 double getStdDeviation()
          Calculates and returns the standard deviation.
 void setBestBound(int a_lValue)
          Sets the best bound value.
 void setBound(PerformanceEntry.Bound a_bound)
          Sets the bound value.
 org.w3c.dom.Element toXmlElement(org.w3c.dom.Document a_doc)
          Return an element that can be appended to the document.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_TIMEFRAME

public static final long DEFAULT_TIMEFRAME
The time frame of this floating time entry.

See Also:
Constant Field Values

XML_ELEMENT_VALUES

public static final java.lang.String XML_ELEMENT_VALUES
The containers XML element name.

See Also:
Constant Field Values

XML_ELEMENT_VALUE

public static final java.lang.String XML_ELEMENT_VALUE
The XML element name.

See Also:
Constant Field Values

XML_ATTR_BEST

public static final java.lang.String XML_ATTR_BEST
The best bound value XML attribute name.

See Also:
Constant Field Values

XML_ATTR_BOUND

public static final java.lang.String XML_ATTR_BOUND
The bound value XML attribute name.

See Also:
Constant Field Values

XML_ATTR_NOT_RECOVERED_BOUND

public static final java.lang.String XML_ATTR_NOT_RECOVERED_BOUND
See Also:
Constant Field Values

m_iLastValue

private int m_iLastValue
The last value that has been added. This is only useful for PACKETS.


m_iLastTimestamp

private long m_iLastTimestamp

m_attribute

public int m_attribute
The performance attribute.


m_lastUpdate

public long m_lastUpdate
The time of the last update.


m_Values

private java.util.Hashtable m_Values
The values.


m_lBoundValue

private PerformanceEntry.Bound m_lBoundValue
The bound value. This will only be set if this object is constructed from XML (only in the JAP client). The info service calculates the bound value on the fly using #getBound(boolean)


m_lBestBoundValue

private int m_lBestBoundValue
The best bound value. This will only be set if this object is constructed from XML (only in the JAP client). The info service calculates the best bound value on the fly using #getBound(boolean)


m_iResets

private int m_iResets

m_iErrors

private int m_iErrors

m_iUnknown

private int m_iUnknown

m_bInfoService

private boolean m_bInfoService
True, if the object is created by the info service or the JAP client. Determines whether the bound value is retrieved from the stored value or calculated on the fly.

Constructor Detail

PerformanceEntry.PerformanceAttributeFloatingTimeEntry

public PerformanceEntry.PerformanceAttributeFloatingTimeEntry(int a_attribute,
                                                              boolean a_bInfoService)
Constructs a new PerformanceAttributeFloatingTimeEntry.

Parameters:
a_attribute - The performance attribute.
a_bInfoService - Specifies if the caller of this method is an InfoService or the JAP client.

PerformanceEntry.PerformanceAttributeFloatingTimeEntry

public PerformanceEntry.PerformanceAttributeFloatingTimeEntry(int a_attribute,
                                                              org.w3c.dom.Node a_node)
Constructs a new PerformanceAttributeFloatingTimeEntry from XML data.

Parameters:
a_attribute - The performance attribute.
a_node - The XML node.
Method Detail

addValue

public void addValue(long a_lTimeStamp,
                     int a_lValue)
Adds a value to the floating time entry.

Parameters:
a_lTimeStamp - The timestamp of the value.
a_lValue - The value.

setBound

public void setBound(PerformanceEntry.Bound a_bound)
Sets the bound value. Only allowed by the client.

Parameters:
a_lValue - The value.

setBestBound

public void setBestBound(int a_lValue)
Sets the best bound value. Only allowed by the client.

Parameters:
a_lValue - The value.

getBound

public PerformanceEntry.Bound getBound()
Returns the bound value. If it is invoked by the client the stored m_lBoundValue is returned otherwise the bound value is calculated from the values in the entry. When invoked by an active InfoService, the bound is calculated be removing the BOUND_ROUNDING per cent (%) worst results. The remaining worst result is then compared to BOUNDARIES. The best value from BOUNDARIES, that is equal to or worse than the real worst value after removing the others is the bound. In this form, the bound reacts quite fast on bad values, but recovers very slow if the problems are gone and good values show up again. It is therefore 'tuned' as follows: Look for the time of the last value that was equal to or worse than the next best bound compared to the bound calculated as above. If there are at least BOUND_ROUNDING per cent (%) valid values (errors and tries are not counted) left afterwards, calculate the bound again but remove all later values from the calculation. This should honor the fact that some services quickly recover from bad performance.

Returns:
The bound value.

calculateBound

private int calculateBound(java.util.Hashtable a_hashValues,
                           java.util.Vector a_timestamps)
Returns the bound value. If it is invoked by the client the stored m_lBoundValue is returned otherwise the bound value is calculated from the values in the entry. When invoked by an active InfoService, the bound is calculated be removing the BOUND_ROUNDING per cent (%) worst results. The remaining worst result is then compared to BOUNDARIES. The best value from BOUNDARIES, that is equal to or worse than the real worst value after removing the others is the bound.

Parameters:
a_bLow - Low or high bound.
Returns:
The bound value.

getBestBound

public int getBestBound()
Returns the best bound value. If it is invoked by the client the stored m_lBoundValue is returned otherwise the bound value is calculated from the values in the entry.

Returns:
The best bound value.

getBoundFromValue

private int getBoundFromValue(int value)

getAverage

public int getAverage()
Calculates and return the average value.

Returns:
The average value.

getStdDeviation

public double getStdDeviation()
Calculates and returns the standard deviation.

Returns:
The standard deviation.

toXmlElement

public org.w3c.dom.Element toXmlElement(org.w3c.dom.Document a_doc)
Description copied from interface: IXMLEncodable
Return an element that can be appended to the document. This Method must not change the document in any way!

Specified by:
toXmlElement in interface IXMLEncodable
Parameters:
a_doc - a document
Returns:
the interface as xml element