Package org.hibernate.stat
Interface Statistics
- All Known Subinterfaces:
StatisticsServiceMBean
- All Known Implementing Classes:
ConcurrentStatisticsImpl,StatisticsImpl,StatisticsService
public interface Statistics
Statistics for a particular SessionFactory.
Beware of milliseconds metrics, they are depdendent of the JVM precision:
you may then encounter a 10 ms approximation dending on you OS platform.
Please refer to the JVM documentation for more information.
-
Method Summary
Modifier and TypeMethodDescriptionvoidclear()reset all statisticslongThe number of prepared statements that were releasedlongGlobal number of collections fetchedlongGlobal number of collections loadedlongGlobal number of collections recreatedlongGlobal number of collections removedString[]Get the names of all collection rolesGet collection statistics per rolelongGlobal number of collections updatedlongGet the global number of connections asked by the sessions (the actual number of connections used may be much smaller depending whether you use a connection pool or not)longGet global number of entity deleteslongGet global number of entity fetchslongGet global number of entity insertslongGet global number of entity loadsString[]Get the names of all entitiesgetEntityStatistics(String entityName) find entity statistics per namelongGet global number of entity updateslongGet the global number of flush executed by sessions (either implicit or explicit)longThe number of StaleObjectStateExceptions that occurredlongThe number of prepared statements that were acquiredString[]Get all executed query stringslongGet the global number of cached queries successfully retrieved from cachelongGet the global number of cached queries *not* found in cachelongGet the global number of cacheable queries put in cachelongGet global number of executed querieslongGet the time in milliseconds of the slowest query.Get the query string for the slowest query.getQueryStatistics(String queryString) Query statistics from query string (HQL or SQL)longGlobal number of cacheable entities/collections successfully retrieved from the cachelongGlobal number of cacheable entities/collections not found in the cache and loaded from the database.longGlobal number of cacheable entities/collections put in the cacheString[]Get all second-level cache region namesgetSecondLevelCacheStatistics(String regionName) Second level cache statistics per regionlongGlobal number of sessions closedlongGlobal number of sessions openedlonglongThe number of transactions we know to have been successfullongThe number of transactions we know to have completedbooleanAre statistics loggedvoidlog in info level the main statisticsvoidsetStatisticsEnabled(boolean b) Enable statistics logs (this is a dynamic parameter)
-
Method Details
-
clear
void clear()reset all statistics -
getEntityStatistics
find entity statistics per name- Parameters:
entityName- entity name- Returns:
- EntityStatistics object
-
getCollectionStatistics
Get collection statistics per role- Parameters:
role- collection role- Returns:
- CollectionStatistics
-
getSecondLevelCacheStatistics
Second level cache statistics per region- Parameters:
regionName- region name- Returns:
- SecondLevelCacheStatistics
-
getQueryStatistics
Query statistics from query string (HQL or SQL)- Parameters:
queryString- query string- Returns:
- QueryStatistics
-
getEntityDeleteCount
long getEntityDeleteCount()Get global number of entity deletes- Returns:
- entity deletion count
-
getEntityInsertCount
long getEntityInsertCount()Get global number of entity inserts- Returns:
- entity insertion count
-
getEntityLoadCount
long getEntityLoadCount()Get global number of entity loads- Returns:
- entity load (from DB)
-
getEntityFetchCount
long getEntityFetchCount()Get global number of entity fetchs- Returns:
- entity fetch (from DB)
-
getEntityUpdateCount
long getEntityUpdateCount()Get global number of entity updates- Returns:
- entity update
-
getQueryExecutionCount
long getQueryExecutionCount()Get global number of executed queries- Returns:
- query execution count
-
getQueryExecutionMaxTime
long getQueryExecutionMaxTime()Get the time in milliseconds of the slowest query. -
getQueryExecutionMaxTimeQueryString
String getQueryExecutionMaxTimeQueryString()Get the query string for the slowest query. -
getQueryCacheHitCount
long getQueryCacheHitCount()Get the global number of cached queries successfully retrieved from cache -
getQueryCacheMissCount
long getQueryCacheMissCount()Get the global number of cached queries *not* found in cache -
getQueryCachePutCount
long getQueryCachePutCount()Get the global number of cacheable queries put in cache -
getFlushCount
long getFlushCount()Get the global number of flush executed by sessions (either implicit or explicit) -
getConnectCount
long getConnectCount()Get the global number of connections asked by the sessions (the actual number of connections used may be much smaller depending whether you use a connection pool or not) -
getSecondLevelCacheHitCount
long getSecondLevelCacheHitCount()Global number of cacheable entities/collections successfully retrieved from the cache -
getSecondLevelCacheMissCount
long getSecondLevelCacheMissCount()Global number of cacheable entities/collections not found in the cache and loaded from the database. -
getSecondLevelCachePutCount
long getSecondLevelCachePutCount()Global number of cacheable entities/collections put in the cache -
getSessionCloseCount
long getSessionCloseCount()Global number of sessions closed -
getSessionOpenCount
long getSessionOpenCount()Global number of sessions opened -
getCollectionLoadCount
long getCollectionLoadCount()Global number of collections loaded -
getCollectionFetchCount
long getCollectionFetchCount()Global number of collections fetched -
getCollectionUpdateCount
long getCollectionUpdateCount()Global number of collections updated -
getCollectionRemoveCount
long getCollectionRemoveCount()Global number of collections removed -
getCollectionRecreateCount
long getCollectionRecreateCount()Global number of collections recreated -
getStartTime
long getStartTime()- Returns:
- start time in ms (JVM standards
System.currentTimeMillis())
-
logSummary
void logSummary()log in info level the main statistics -
isStatisticsEnabled
boolean isStatisticsEnabled()Are statistics logged -
setStatisticsEnabled
void setStatisticsEnabled(boolean b) Enable statistics logs (this is a dynamic parameter) -
getQueries
String[] getQueries()Get all executed query strings -
getEntityNames
String[] getEntityNames()Get the names of all entities -
getCollectionRoleNames
String[] getCollectionRoleNames()Get the names of all collection roles -
getSecondLevelCacheRegionNames
String[] getSecondLevelCacheRegionNames()Get all second-level cache region names -
getSuccessfulTransactionCount
long getSuccessfulTransactionCount()The number of transactions we know to have been successful -
getTransactionCount
long getTransactionCount()The number of transactions we know to have completed -
getPrepareStatementCount
long getPrepareStatementCount()The number of prepared statements that were acquired -
getCloseStatementCount
long getCloseStatementCount()The number of prepared statements that were released -
getOptimisticFailureCount
long getOptimisticFailureCount()The number of StaleObjectStateExceptions that occurred
-