org.hd.d.pg2k.svrCore.stats
Class StatsLogger.StatsConfig

java.lang.Object
  extended by org.hd.d.pg2k.svrCore.stats.StatsLogger.StatsConfig
Enclosing class:
StatsLogger

public static final class StatsLogger.StatsConfig
extends java.lang.Object

Holds the configuration for one statistics set. As this object uses == for equals() [from Object], it is impossible to forge duplicates for any one stats source.

While immutable from outside the stats system, this does note when the last stats summary was done.


Field Summary
private  boolean adaptiveTime
          If true, we dump at shorter intervals to start with.
 long creationTime
          Time at which this stats set was created.
private  int dumpIntervalS
          Interval in seconds between dumps of stats info; non-negative.
private  long lastSummaryDumpTime
          Time at which last summary dump was done.
private  SimpleLoggerIF logger
          Logger to log to; null if none.
 java.lang.String name
          Name/token to identify this stats set; never null or zero length.
private  boolean printEveryEvent
          If true we log every event, else only summary status.
 
Constructor Summary
StatsLogger.StatsConfig(java.lang.String setName, java.io.PrintStream ps, boolean printEvery, int dumpS)
          Create a new stats sink description.
StatsLogger.StatsConfig(java.lang.String setName, java.io.PrintStream ps, boolean printEvery, int dumpS, boolean adaptive)
          Create a new stats sink description.
StatsLogger.StatsConfig(java.lang.String setName, SimpleLoggerIF logger, boolean printEvery, int dumpS, boolean adaptive)
          Create a new stats sink description.
 
Method Summary
private  boolean timeForSummary()
          If stats summary dump is overdue, returns true and updates time.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

creationTime

public final long creationTime
Time at which this stats set was created.


name

public final java.lang.String name
Name/token to identify this stats set; never null or zero length.


logger

private final SimpleLoggerIF logger
Logger to log to; null if none.


printEveryEvent

private final boolean printEveryEvent
If true we log every event, else only summary status.


dumpIntervalS

private final int dumpIntervalS
Interval in seconds between dumps of stats info; non-negative. If zero then periodic dumps are disabled.


adaptiveTime

private final boolean adaptiveTime
If true, we dump at shorter intervals to start with. This helps yield useful info when the system is starting up; until the first true dump interval has been reached we dump at exponentially-increasing intervals (driven by actual arrival of events).


lastSummaryDumpTime

private long lastSummaryDumpTime
Time at which last summary dump was done. Initially zero to indicate no previous dump.

Atomically read and/or updated by timeForSummary().

Constructor Detail

StatsLogger.StatsConfig

public StatsLogger.StatsConfig(java.lang.String setName,
                               java.io.PrintStream ps,
                               boolean printEvery,
                               int dumpS)
Create a new stats sink description. Uses an adaptive algorithm so as to dump stats more frequently when a new stat sink has been created.

Parameters:
setName - non-null token printed to identify this set
ps - if non-null, and while not closed, is a stream to print statistics information to
printEvery - if true, every event is printed, else only summary stats are recorded
dumpS - if positive, dump cumulative stats at intervals of this many seconds; if zero periodic dumps are disabled

StatsLogger.StatsConfig

public StatsLogger.StatsConfig(java.lang.String setName,
                               java.io.PrintStream ps,
                               boolean printEvery,
                               int dumpS,
                               boolean adaptive)
Create a new stats sink description.

Parameters:
setName - non-null token printed to identify this set
ps - if non-null, and while not closed, is a stream to print statistics information to
printEvery - if true, every event is printed, else only summary stats are recorded
dumpS - if positive, dump cumulative stats at intervals of this many seconds; if zero periodic dumps are disabled
adaptive - if true, print initial summaries at shorter delays so that even short runs of the system yield some interesting stats

StatsLogger.StatsConfig

public StatsLogger.StatsConfig(java.lang.String setName,
                               SimpleLoggerIF logger,
                               boolean printEvery,
                               int dumpS,
                               boolean adaptive)
Create a new stats sink description.

Parameters:
setName - non-null token printed to identify this set
logger - if non-null, is a logger to log statistics information to
printEvery - if true, every event is printed, else only summary stats are recorded
dumpS - if positive, dump cumulative stats at intervals of this many seconds; if zero periodic dumps are disabled
adaptive - if true, print initial summaries at shorter delays so that even short runs of the system yield some interesting stats
Method Detail

timeForSummary

private boolean timeForSummary()
If stats summary dump is overdue, returns true and updates time. This applies the adaptive algorithm if appropriate.


DHD Multimedia Gallery V1.60.69

Copyright (c) 1996-2012, Damon Hart-Davis. All rights reserved.