|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.jme.util.stat.StatCollector
public class StatCollector
This class acts as a centralized data store for statistics. As data is added to the collector, a sum total is kept as well as the total number of data samples given for the particular stat.
Field Summary | |
---|---|
protected static java.util.HashMap<StatType,StatValue> |
current
Our map of current stat values. |
protected static java.util.List<MultiStatSample> |
historical
|
protected static boolean |
ignoreStats
|
protected static double |
lastSampleTime
|
protected static double |
lastTimeCheckMS
|
protected static java.util.ArrayList<java.lang.ref.WeakReference<StatListener>> |
listeners
|
protected static int |
maxSamples
How many distinct past aggregate samples are kept before the oldest one is dropped on add. |
protected static double |
sampleRateMS
How long to gather stats as a single unit before pushing them onto the historical stack. |
protected static double |
startOffset
|
protected static java.util.HashSet<StatType> |
timedStats
|
protected static NanoTimer |
timer
|
protected static java.util.Stack<StatType> |
timeStatStack
|
Constructor Summary | |
---|---|
protected |
StatCollector()
|
Method Summary | |
---|---|
static void |
addStat(StatType type,
double statValue)
|
static void |
addStatListener(StatListener listener)
Add a listener to the pool of listeners that are notified when a new stats aggregate is created (at the end of each time sample). |
static void |
addTimedStat(StatType type)
Add a type to the set of stat types that are paid attention to when doing timed stat checking. |
static void |
endStat(StatType type)
|
static void |
fireActionEvent()
Notifies all registered listeners that a new stats aggregate was created. |
static java.util.List<MultiStatSample> |
getHistorical()
|
static int |
getMaxSamples()
|
static double |
getSampleRate()
|
static double |
getStartOffset()
|
static boolean |
hasHistoricalStat(StatType type)
|
static void |
init(long sampleRateMS,
int maxHistorical)
Construct a new StatCollector. |
static boolean |
isIgnoreStats()
|
static void |
pause()
TODO: consider a way to pause just a set of stats? |
static void |
removeAllListeners()
Cleans the listener pool of all listeners. |
static void |
removeAllTimedStats()
Cleans the set of stat types we paid attention to when doing timed stat checking. |
static boolean |
removeStatListener(StatListener listener)
Removes a listener from the pool of listeners that are notified when a new stats aggregate is created (at the end of each time sample). |
static boolean |
removeTimedStat(StatType type)
Removes a type from the set of stat types that are paid attention to when doing timed stat checking. |
static void |
resetTimedStack()
Call this if you've caught an error, etc and you need to reset timed stats collecting. |
static void |
resume()
|
static void |
setIgnoreStats(boolean ignoreStats)
|
static void |
setMaxSamples(int samples)
|
static void |
setSampleRate(long sampleRateMS)
|
static void |
startStat(StatType type)
|
static void |
update()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static int maxSamples
protected static java.util.HashMap<StatType,StatValue> current
protected static java.util.List<MultiStatSample> historical
protected static double sampleRateMS
protected static double lastSampleTime
protected static double lastTimeCheckMS
protected static java.util.ArrayList<java.lang.ref.WeakReference<StatListener>> listeners
protected static double startOffset
protected static boolean ignoreStats
protected static java.util.Stack<StatType> timeStatStack
protected static java.util.HashSet<StatType> timedStats
protected static NanoTimer timer
Constructor Detail |
---|
protected StatCollector()
Method Detail |
---|
public static void init(long sampleRateMS, int maxHistorical)
sampleRateMS
- The amount of time between aggregated samples in milliseconds.public static void addStat(StatType type, double statValue)
public static void startStat(StatType type)
public static void endStat(StatType type)
public static void update()
public static void addStatListener(StatListener listener)
listener
- the listener to addpublic static boolean removeStatListener(StatListener listener)
listener
- the listener to removepublic static void removeAllListeners()
public static void addTimedStat(StatType type)
type
- the listener to addpublic static boolean removeTimedStat(StatType type)
type
- the listener to removepublic static void removeAllTimedStats()
public static void fireActionEvent()
public static double getStartOffset()
public static double getSampleRate()
public static void setSampleRate(long sampleRateMS)
public static void setMaxSamples(int samples)
public static int getMaxSamples()
public static java.util.List<MultiStatSample> getHistorical()
public static boolean isIgnoreStats()
public static void setIgnoreStats(boolean ignoreStats)
public static boolean hasHistoricalStat(StatType type)
public static void resetTimedStack()
public static void pause()
public static void resume()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |