|
Holger's Java API |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.antelmann.db.DBStoreProfiler
public class DBStoreProfiler
allows to easily profile a store. Note that for fetch-calls, only the fetch-command itself is profiled, not the time it takes to enumerate through the elements! Note also that database errors are currently not profiled.
| Nested Class Summary | |
|---|---|
static class |
DBStoreProfiler.ProfileModel
the profile model is a read-only snapshot of the given profile. |
| Nested classes/interfaces inherited from interface com.antelmann.db.DBStoreListener |
|---|
DBStoreListener.Adapter, DBStoreListener.StoreUpdateAdapter |
| Method Summary | |
|---|---|
static DBStoreProfiler |
addNewProfiler(Database<?> db)
|
void |
clear()
|
DBStoreProfiler.ProfileModel |
createTableModel()
provides a read-only snapshot of the current profile |
void |
databaseAccessed(DBClassStore<?> dbstore,
DBClassStore.DBMethod method,
Object parameter,
long timeTaken)
called upon successfully reading from the database (guaranteed to be called from within the transaction). |
void |
databaseError(DBClassStore<?> dbstore,
Throwable t,
DBClassStore.DBMethod method,
Object parameter)
called when an error occurred while accessing the database (not guaranteed to be called from within the transaction) |
void |
databaseUpdated(DBUpdateEvent event,
long timeTaken)
called upon successful insert, delete or update; note that the update becomes permanent ONLY if the current transaction successfully commits. |
void |
fetchCall(DBClassStore<?> store,
DBEnumeration<?> e,
String method,
long timeTaken)
called when a method is called on a DBEnumeration that is returned by the store |
Class<?>[] |
getAvailableProfileClasses()
|
DataMap<String> |
getProfile(Class<?> type)
the returned profile contains DataPoints that represent the duration of each store call in milliseconds |
static DBStoreProfiler |
getProfiler(Database<?> db)
|
long |
getTotalTime(Class<?> type,
String method)
Note that - if the type is null - the returned time may be overestimating the time spent in database calls if one store calls another (nested call), since the time spent on the nested store is additionally counted for the outer store as well. |
static DBStoreProfiler |
obtainProfiler(Database<?> db)
|
void |
prepareDatabaseCall(DBClassStore<?> dbstore,
DBClassStore.DBMethod method,
Object parameter)
called before the given method is delegated to the embedded store |
protected void |
profileCall(long timeTaken,
DBClassStore<?> store,
String method,
Object parameter)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public void clear()
public Class<?>[] getAvailableProfileClasses()
public DataMap<String> getProfile(Class<?> type)
protected void profileCall(long timeTaken,
DBClassStore<?> store,
String method,
Object parameter)
public void databaseUpdated(DBUpdateEvent event,
long timeTaken)
throws DBVetoException
DBStoreListener
databaseUpdated in interface DBStoreListenerDBVetoException - if the listener explicitly wants to prevent the update from occurring;
this exception is then propagatedTransactionListener,
DatabaseChangeMonitor,
DBVersionedUpdateEvent,
Database.setVersioningEnabled(Class, boolean)
public void databaseAccessed(DBClassStore<?> dbstore,
DBClassStore.DBMethod method,
Object parameter,
long timeTaken)
DBStoreListenerDBStoreListener.databaseUpdated(DBUpdateEvent, long)
is called.
databaseAccessed in interface DBStoreListener
public void prepareDatabaseCall(DBClassStore<?> dbstore,
DBClassStore.DBMethod method,
Object parameter)
throws DBVetoException
DBStoreListener
prepareDatabaseCall in interface DBStoreListenerDBVetoException - if a listener seeks to prevent the call to the embedded store
public void databaseError(DBClassStore<?> dbstore,
Throwable t,
DBClassStore.DBMethod method,
Object parameter)
DBStoreListener
databaseError in interface DBStoreListener
public void fetchCall(DBClassStore<?> store,
DBEnumeration<?> e,
String method,
long timeTaken)
DBStoreListener
fetchCall in interface DBStoreListenerDBClassStore.fetch(com.antelmann.util.Filter),
DBClassStore.fetchStubs(com.antelmann.util.Filter),
DBEnumeration
public long getTotalTime(Class<?> type,
String method)
type - if non-null, only calls of this type are consideredmethod - if non-null, only calls of the given method type are considered
public DBStoreProfiler.ProfileModel createTableModel()
public static DBStoreProfiler addNewProfiler(Database<?> db)
public static DBStoreProfiler getProfiler(Database<?> db)
public static DBStoreProfiler obtainProfiler(Database<?> db)
|
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||