|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--edu.wpi.cs.dsrg.xmldb.xat.common.operator.XATPropertiesImp | +--edu.wpi.cs.dsrg.xmldb.xat.component.statisticsgatherer.StatisticsGatherer
StatisticsGatherer is a large statistics engine that supports arbitrary statistics and many different access methods. See below for a description on using this Gatherer, including how to add new properties, retrieve values, retrive objects, and update values
The Gatherer works by organizing statistics into categories. The statsTable will always have 2 categories called HISTORICAL and GENERIC(records are identified by a Object identifier right now). HISTORICAL keeps track of the statistics for the operators regardless of the scheduling algorithm or query plan. HISTORICAL also contains the aggregate stats for the whole system.
GENERIC contains basic statistics that do not depend on the category. These statistics, such as NUMBER_OF_TUPLES_IN_INPUT_QUEUES, should have the same values regardless of the category, otherwise, there are consistency issues.
Because the HISTORICAL name may (and has already) change, it is safest to refer to it using StatisticsGatherer.OVERALL
Additional categories can be added to the statsTable that will correspond to smaller views of the overall statistics. For example, categories could be added that correspond to a particular scheduling algorithm or a certain plan.
The individual categories are organized by property names. The property names are are gathered using XATQueryObject.getProperties(). Each property name has a ModifiedArrayList (extention of ArrayList with some different access methods) that sorts the XATOperators based on the property. Queries, such as what is the operator with the lowest (insert propery name), can be made against the Gatherer
The StatisticsGather should be used as follows:
This last method is probably the most useful and powerful in the StatisticsGatherer
The identifier is any of the static constants found in StatisticsReference. Some examples are FIRST, LAST, HIGHEST, LOWEST, and AVERAGE. Depending on the identifier, the method will return the XATQueryObject whose propertyValue matches the given identifier with respect to the other XATQueryObjects.
Field Summary | |
static java.lang.String |
GENERIC
|
static java.lang.String |
OVERALL
|
Method Summary | |
void |
addNewCategory(java.lang.Object identifier)
Adds a new category of statistics into the StatisticsGatherer A category is defined as a grouping of statistics. |
void |
addNewQueryObject(XATQueryObject newQueryObject)
Add an QueryObject to the statsTable. |
void |
addNewQueryObject(XATQueryObject[] newQueryObjects)
Adds an array of QueryObject to the statsTable. |
java.util.Iterator |
getAllKnownQueryObjects()
Returns an Iterator of all of the query objects that are known in this stats gatherer. |
java.util.Enumeration |
getCategories()
Returns the currentCategory |
java.lang.Object |
getCurrentCategory()
Returns the currentCategory |
XATQueryObject |
getQueryObject(java.lang.String propertyName,
int valueIdentifier)
Gets the XATQueryObject whose propertyValue corresponds to the propertyName and valueIdentifier in the currentCategory. |
XATQueryObject |
getQueryObject(java.lang.String propertyName,
int valueIdentifier,
boolean updateValue)
Gets the XATQueryObject whose propertyValue corresponds to the propertyName and valueIdentifier in the currentCategory. |
static StatisticsGatherer |
getStatisticsGather()
we want there to be only 1 statistics gatherer so a singleton design pattern is used. |
java.lang.String |
getValue(java.lang.String propertyName,
XATQueryObject queryObject)
Returns the value for given property of the queryObject in the current category Creation date: (1/15/2003 2:05:37 PM) |
java.lang.String |
getValue(java.lang.String propertyName,
XATQueryObject queryObject,
int description)
Returns the value for given property of the queryObject in the current category If this statistics object does not support this operation, an error will be thrown |
void |
initStatsTable(XATTree initTree)
Allows you to specify an initial XATTree that contains all of the operators. |
boolean |
isStatisticSupported(java.lang.String propertyName)
Checks if the propertyName is in the StatisticsGatherer |
void |
removeQueryObject(XATQueryObject object)
Removes a query object from the statistics gatherer. |
void |
reset()
This will reset the statistics gatherer to its pre-init state. |
void |
setCurrentCategory(java.lang.Object newCurrentCategory)
Set the current category. |
protected void |
setDefaultProperties()
called by the constructor. |
java.lang.String |
toString()
Insert the method's description here. |
void |
updateValue(java.lang.String propertyName,
XATQueryObject queryObject)
This will update the given propertyName for the currentCategory. |
void |
updateValue(java.lang.String propertyName,
XATQueryObject queryObject,
java.lang.String newPropertyValue)
This will update the given propertyName for the currentCategory. |
Methods inherited from class edu.wpi.cs.dsrg.xmldb.xat.common.operator.XATPropertiesImp |
addProperty,
getProperties,
getProperty,
isValidPropertyName,
setNewPropertyValue,
setProperty |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
Field Detail |
public static final java.lang.String OVERALL
public static final java.lang.String GENERIC
Method Detail |
public void addNewCategory(java.lang.Object identifier) throws java.lang.Exception
Before categories can be added, the statsgather must have been initialized.
One problem with this is that the new catgory will have its starting values set to thato of the OVERALL category. I am not sure how to get around this, nor do I know if it is a major problem. If all of the categories are initialized at the beginning, then it will not matter much, if at all.
identifier
- java.lang.Objectpublic void addNewQueryObject(XATQueryObject[] newQueryObjects)
newQueryObject
- public void addNewQueryObject(XATQueryObject newQueryObject)
newQueryObject
- public java.util.Iterator getAllKnownQueryObjects()
This does not traverse the GENERIC query objects b/c those generally are not useful except to calculate other statistics.
Note, this is an expensive operation. It runs on the order of n^2 where n is the number of query objects in the system.
public java.util.Enumeration getCategories()
public java.lang.Object getCurrentCategory()
public XATQueryObject getQueryObject(java.lang.String propertyName, int valueIdentifier)
For example, getQueryObject("SELECTIVITY", StatisticsReference.LOWEST) will return the XATQueryObject with the lowest selectivity within the currentCategory. getOperator("LAST_TIME_RUN", StatisticsReference.HIGHEST) will return the XATQueryObject ran most recently (lastTimeRun is highest).
See StatisticsReference for a list of supported identifiers
propertyName
- java.lang.Stringidentifier
- intpublic XATQueryObject getQueryObject(java.lang.String propertyName, int valueIdentifier, boolean updateValue)
For example, getQueryObject("SELECTIVITY", StatisticsReference.LOWEST) will return the XATQueryObject with the lowest selectivity within the currentCategory. getOperator("LAST_TIME_RUN", StatisticsReference.HIGHEST) will return the XATQueryObject ran most recently (lastTimeRun is highest).
See StatisticsReference for a list of supported identifiers
Added 5/26: You can now ask for any position in the list, not just highest, lowest, average, etc. Just pass in the position you want. To retrieve highest, lowest, etc, still make use of the constants in StatisticsReference
propertyName
- java.lang.Stringidentifier
- intupdateValue
- boolean true if the values should be updated first before the first, last, etc value is retrievedpublic static StatisticsGatherer getStatisticsGather()
public java.lang.String getValue(java.lang.String propertyName, XATQueryObject queryObject)
propertyName
- java.lang.StringqueryObject
- XATQueryObjectpublic java.lang.String getValue(java.lang.String propertyName, XATQueryObject queryObject, int description)
propertyName
- java.lang.StringqueryObject
- XATQueryObjectdescription
- the type of value to retrieve. Available constants are found in StatisticsReferencepublic void initStatsTable(XATTree initTree) throws XATStatisticsException
The properties of each operator will be stored inside of a hashtable along with a Comparator so they can be sorted later and organized later.
initialTree
- edu.wpi.cs.dsrg.xmldb.xat.common.treestructure.XATTreepublic boolean isStatisticSupported(java.lang.String propertyName)
propertyName
- java.lang.Stringpublic void removeQueryObject(XATQueryObject object)
object
- edu.wpi.cs.dsrg.xmldb.xat.common.operator.XATQueryObjectpublic void reset()
public void setCurrentCategory(java.lang.Object newCurrentCategory)
newCurrentCategory
- java.lang.Objectprotected void setDefaultProperties()
public java.lang.String toString()
public void updateValue(java.lang.String propertyName, XATQueryObject queryObject)
propertyName
- java.lang.StringqueryObject
- the XATQueryObject whose property is being updatedpublic void updateValue(java.lang.String propertyName, XATQueryObject queryObject, java.lang.String newPropertyValue)
propertyName
- java.lang.StringqueryObject
- the XATQueryObject whose property is being updatednewPropertyValue
- a string representing the new propertyvalue that will
assist the StatisticsObject in calculating its new value
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |