fulmine.util.log
Class Statistics

java.lang.Object
  extended by java.util.TimerTask
      extended by fulmine.util.log.Statistics
All Implemented Interfaces:
IStatistics, Runnable

public final class Statistics
extends TimerTask
implements IStatistics, Runnable

A standard implementation. This logs statistics at the INFO level and updates an information container. The information container (or 'info record') is created lazily to get around some startup lifecycle sequence clashes between the IEventManager and IModelManager that compose the context.

The statistics are grouped into 'interval' and 'total' groups. The interval group is for statistics in the last sampling interval whilst the total group maintains statistics for all sampling intervals since sampling began.

Author:
Ramon Servadei

Field Summary
static String DEFAUL_TIME_PERIOD
          The default log time period
static long TIME_PERIOD
          The time period in milliseconds for logging statistics
static String TIME_PERIOD_PROPERTY
          System property to define the time period (in milliseconds) for logging.
 
Constructor Summary
Statistics(String infoRecordIdentity, IModelManager context)
          Standard constructor
 
Method Summary
 void intervalFinished(int queueSize, int popped)
          Signals the end of a sampling interval.
 void processEvent(long elapsedTimeMicroSecs)
          Process a new event in the current interval.
 void run()
          Handles updating the info record with the statistics.
 String toString()
           
 
Methods inherited from class java.util.TimerTask
cancel, scheduledExecutionTime
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

TIME_PERIOD_PROPERTY

public static final String TIME_PERIOD_PROPERTY
System property to define the time period (in milliseconds) for logging.

See Also:
DEFAUL_TIME_PERIOD

DEFAUL_TIME_PERIOD

public static final String DEFAUL_TIME_PERIOD
The default log time period

See Also:
Constant Field Values

TIME_PERIOD

public static final long TIME_PERIOD
The time period in milliseconds for logging statistics

Constructor Detail

Statistics

public Statistics(String infoRecordIdentity,
                  IModelManager context)
Standard constructor

Parameters:
infoRecordIdentity - the identity for the information container record
context - the context, used to lazily create the info record
Method Detail

processEvent

public void processEvent(long elapsedTimeMicroSecs)
Description copied from interface: IStatistics
Process a new event in the current interval.

Specified by:
processEvent in interface IStatistics
Parameters:
elapsedTimeMicroSecs - the elapsed time of this event on its queue (its latency)

intervalFinished

public void intervalFinished(int queueSize,
                             int popped)
Description copied from interface: IStatistics
Signals the end of a sampling interval. This will execute some form of statistics logging, dependent on the implementation.

Specified by:
intervalFinished in interface IStatistics
Parameters:
queueSize - the queue size at the end of this interval
popped - the number of items popped in this interval

toString

public final String toString()
Overrides:
toString in class Object
Returns:
a string with max, queueSize, popped, totalPopped

run

public void run()
Handles updating the info record with the statistics.

Specified by:
run in interface Runnable
Specified by:
run in class TimerTask


Copyright © 2007-2009. All Rights Reserved.