to.etc.dbpool.info
Class PerformanceStore
java.lang.Object
to.etc.dbpool.info.PerformanceStore
- Direct Known Subclasses:
- PerformanceCollector
public class PerformanceStore
- extends java.lang.Object
Generic metrics storage class; base class both the per-thread metrics
storage plus the per-session and per-startup stores. This class allows
storage of multiple "top xxx" lists, where every list stores a descending
or ascending set of metrics - by some numeric value. This creates a top-nnn of
things, like:
- The top-10 slowest SQL statements
- The top-10 most-executed statements
- The top-10 requests with the slowest response time
Every specific top-xxx list has it's own max size, ascending/descending indication
and is identified by some string key value.
In every toplist, each "item" contains the following data:
- The numeric (long) value of the metric
- An unique key representing 'the same source' object. For SQL statements this key is the
SQL statement; for requests this is the screen name without parameters. This key is used
to prevent multiple entries of the same SQL statement to obscure the list; only the "best scoring"
one is shown.
- A displayer handler which should be able to show title, overview and detail data for the item when shown on screen.
None of the methods of this base class are threadsafe; code using this must take care of that itself.
- Author:
- Frits Jalvingh
Created on Nov 8, 2010
Method Summary |
void |
addItem(java.lang.String listKey,
PerfItem pi)
|
void |
addItem(java.lang.String listKey,
java.lang.String itemKey,
long value,
java.lang.String request,
java.lang.Object data)
Add an item to the specified list if it is is within that lists's bounds. |
void |
clear()
|
void |
define(java.lang.String key,
java.lang.String desc,
boolean descending,
int maxsize)
|
java.util.List<PerfItem> |
getItems(java.lang.String listKey)
|
PerfList |
getList(java.lang.String key)
|
java.util.List<PerfList> |
getLists()
|
void |
merge(PerformanceStore other)
This merges-in the performance data from another store. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
PerformanceStore
public PerformanceStore()
define
public void define(java.lang.String key,
java.lang.String desc,
boolean descending,
int maxsize)
getList
@Nonnull
public final PerfList getList(java.lang.String key)
getLists
public final java.util.List<PerfList> getLists()
getItems
public final java.util.List<PerfItem> getItems(java.lang.String listKey)
addItem
public void addItem(@Nonnull
java.lang.String listKey,
@Nonnull
java.lang.String itemKey,
long value,
@Nullable
java.lang.String request,
@Nullable
java.lang.Object data)
- Add an item to the specified list if it is is within that lists's bounds.
- Parameters:
listKey
- itemKey
- value
- data
-
addItem
public void addItem(@Nonnull
java.lang.String listKey,
@Nonnull
PerfItem pi)
merge
public void merge(PerformanceStore other)
- This merges-in the performance data from another store. For every list it merges the items of the
other list inside this one. If a list in the other type is unknown here it's definition is copied,
else the existing definition in here takes precedence. The developer should take care that merged
lists should have the same data definition.
- Parameters:
other
-
clear
public void clear()