|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.hd.d.pg2k.svrCore.stats.StatsLogger
public final class StatsLogger
Stats-gathering interface. This is not designed for especially sensitive information.
The StatsLogger class is not instantiated.
The simplest interface requires the caller to hand a config object in on every call to specify how to handle the stats.
On each stats-event call, the current event may be dumped immediately and/or, if a stats summary is (over)due then it may be done now.
| Nested Class Summary | |
|---|---|
static class |
StatsLogger.StatsConfig
Holds the configuration for one statistics set. |
| Field Summary | |
|---|---|
private static java.util.Map<StatsLogger.StatsConfig,java.util.concurrent.ConcurrentMap<java.lang.String,java.util.concurrent.atomic.AtomicLong>> |
dataStore
Map from StatsConfig item to collected stats. |
| Constructor Summary | |
|---|---|
private |
StatsLogger()
No one may instantiate this class. |
| Method Summary | |
|---|---|
static void |
captureDataPoint(StatsLogger.StatsConfig statsSet,
java.lang.String ev)
Capture a data point. |
static void |
dumpSummary(StatsLogger.StatsConfig statsSet)
Dump summary of specified stats to configured log. |
private static void |
printStats(boolean summary,
StatsLogger.StatsConfig config,
java.lang.String event,
java.lang.Number item,
long delta)
Print stats item to its output sink. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private static final java.util.Map<StatsLogger.StatsConfig,java.util.concurrent.ConcurrentMap<java.lang.String,java.util.concurrent.atomic.AtomicLong>> dataStore
This is held statically and all access to it should be performed within a lock on the map object if multiple accesses must be performed atomically.
This table is a synchronized WeakHashMap from StatsConfig to a thread-safe map from some Object key to a thread-safe counter.
We don't perform non-essential operations on the per-set Map inside the dataStore lock so as to maximise concurrency.
Note that entries in a WeakHashMap can disappear even while a lock is held on the map.
| Constructor Detail |
|---|
private StatsLogger()
| Method Detail |
|---|
public static void captureDataPoint(StatsLogger.StatsConfig statsSet,
java.lang.String ev)
Neither statsSet nor ev may be null.
Essentially, instances of ev are counted (in a long counter).
This tries to be moderately efficient and quick, at least on average, but may trigger/drive processing such as printing of the event.
public static void dumpSummary(StatsLogger.StatsConfig statsSet)
private static void printStats(boolean summary,
StatsLogger.StatsConfig config,
java.lang.String event,
java.lang.Number item,
long delta)
This includes a delta time in milliseconds from collection creation.
|
DHD Multimedia Gallery V1.60.69 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||