Package org.hibernate.stat
Interface Statistics
-
- All Known Subinterfaces:
StatisticsImplementor
public interface Statistics
Exposes statistics for a particularSessionFactory
. Beware of milliseconds metrics, they are dependent of the JVM precision: you may then encounter a 10 ms approximation depending on you OS platform. Please refer to the JVM documentation for more information.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description void
clear()
reset all statisticsCacheRegionStatistics
getCacheRegionStatistics(String regionName)
Get statistics for either a domain-data or query-result region - this method checks both, preferring domain data region if one.long
getCloseStatementCount()
The number of prepared statements that were releasedlong
getCollectionFetchCount()
Global number of collections fetchedlong
getCollectionLoadCount()
Global number of collections loadedlong
getCollectionRecreateCount()
Global number of collections recreatedlong
getCollectionRemoveCount()
Global number of collections removedString[]
getCollectionRoleNames()
Get the names of all collection rolesCollectionStatistics
getCollectionStatistics(String role)
Get collection statistics per rolelong
getCollectionUpdateCount()
Global number of collections updatedlong
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)CacheRegionStatistics
getDomainDataRegionStatistics(String regionName)
Second-level cache statistics per domain data (entity, collection, natural-id) regionlong
getEntityDeleteCount()
Get global number of entity deleteslong
getEntityFetchCount()
Get global number of entity fetcheslong
getEntityInsertCount()
Get global number of entity insertslong
getEntityLoadCount()
Get global number of entity loadsString[]
getEntityNames()
Get the names of all entitiesEntityStatistics
getEntityStatistics(String entityName)
find entity statistics per namelong
getEntityUpdateCount()
Get global number of entity updateslong
getFlushCount()
Get the global number of flush executed by sessions (either implicit or explicit)long
getNaturalIdCacheHitCount()
Get the global number of cached natural id lookups successfully retrieved from cachelong
getNaturalIdCacheMissCount()
Get the global number of cached natural id lookups *not* found in cachelong
getNaturalIdCachePutCount()
Get the global number of cacheable natural id lookups put in cacheNaturalIdCacheStatistics
getNaturalIdCacheStatistics(String regionName)
Deprecated.(since 5.3) UsegetNaturalIdStatistics(java.lang.String)
orgetDomainDataRegionStatistics(java.lang.String)
instead depending on needlong
getNaturalIdQueryExecutionCount()
Get the global number of natural id queries executed against the databaselong
getNaturalIdQueryExecutionMaxTime()
Get the global maximum query time for natural id queries executed against the databaseString
getNaturalIdQueryExecutionMaxTimeEntity()
String
getNaturalIdQueryExecutionMaxTimeRegion()
Get the region for the maximum natural id query timeNaturalIdStatistics
getNaturalIdStatistics(String entityName)
Natural id resolution query statistics for an entity typelong
getOptimisticFailureCount()
The number of StaleObjectStateExceptions that occurredlong
getPrepareStatementCount()
The number of prepared statements that were acquiredString[]
getQueries()
Get all executed query stringslong
getQueryCacheHitCount()
Get the global number of cached queries successfully retrieved from cachelong
getQueryCacheMissCount()
Get the global number of cached queries *not* found in cachelong
getQueryCachePutCount()
Get the global number of cacheable queries put in cachelong
getQueryExecutionCount()
Get global number of executed querieslong
getQueryExecutionMaxTime()
Get the time in milliseconds of the slowest query.String
getQueryExecutionMaxTimeQueryString()
Get the query string for the slowest query.CacheRegionStatistics
getQueryRegionStatistics(String regionName)
Second-level cache statistics per query regionQueryStatistics
getQueryStatistics(String queryString)
Query statistics from query string (HQL or SQL)long
getSecondLevelCacheHitCount()
Global number of cacheable entities/collections successfully retrieved from the cachelong
getSecondLevelCacheMissCount()
Global number of cacheable entities/collections not found in the cache and loaded from the database.long
getSecondLevelCachePutCount()
Global number of cacheable entities/collections put in the cacheString[]
getSecondLevelCacheRegionNames()
Get all second-level cache region names.SecondLevelCacheStatistics
getSecondLevelCacheStatistics(String regionName)
Deprecated.(since 5.3) UsegetDomainDataRegionStatistics(java.lang.String)
insteadlong
getSessionCloseCount()
Global number of sessions closedlong
getSessionOpenCount()
Global number of sessions openedlong
getStartTime()
The milliseconds (JVM standardSystem.currentTimeMillis()
) since the initial creation of this Statistics instance or the last timeclear()
was called.long
getSuccessfulTransactionCount()
The number of transactions we know to have been successfullong
getTransactionCount()
The number of transactions we know to have completedlong
getUpdateTimestampsCacheHitCount()
Get the global number of timestamps successfully retrieved from cachelong
getUpdateTimestampsCacheMissCount()
Get the global number of timestamp requests that were not found in the cachelong
getUpdateTimestampsCachePutCount()
Get the global number of timestamps put in cacheboolean
isStatisticsEnabled()
Are statistics enabledvoid
logSummary()
log in info level the main statisticsvoid
setStatisticsEnabled(boolean b)
Enable statistics logs (this is a dynamic parameter)
-
-
-
Method Detail
-
isStatisticsEnabled
boolean isStatisticsEnabled()
Are statistics enabled
-
setStatisticsEnabled
void setStatisticsEnabled(boolean b)
Enable statistics logs (this is a dynamic parameter)
-
clear
void clear()
reset all statistics
-
logSummary
void logSummary()
log in info level the main statistics
-
getEntityStatistics
EntityStatistics getEntityStatistics(String entityName)
find entity statistics per name- Parameters:
entityName
- entity name- Returns:
- EntityStatistics object
-
getCollectionStatistics
CollectionStatistics getCollectionStatistics(String role)
Get collection statistics per role- Parameters:
role
- collection role- Returns:
- CollectionStatistics
-
getNaturalIdStatistics
NaturalIdStatistics getNaturalIdStatistics(String entityName)
Natural id resolution query statistics for an entity type- Parameters:
entityName
- The entity name that is the root of the hierarchy containing the natural id- Returns:
- NaturalIdCacheStatistics
-
getQueryStatistics
QueryStatistics getQueryStatistics(String queryString)
Query statistics from query string (HQL or SQL)- Parameters:
queryString
- query string- Returns:
- QueryStatistics
-
getDomainDataRegionStatistics
CacheRegionStatistics getDomainDataRegionStatistics(String regionName)
Second-level cache statistics per domain data (entity, collection, natural-id) region- Parameters:
regionName
- The unqualified region name- Returns:
- The stats for the named region, or
null
if the second level cache is not enabled - Throws:
IllegalArgumentException
- if the region name could not be resolved
-
getQueryRegionStatistics
CacheRegionStatistics getQueryRegionStatistics(String regionName)
Second-level cache statistics per query region- Parameters:
regionName
- The unqualified region name- Returns:
- Stats for the named region, or
null
if (1) query result caching is not enabled or (2) no query region exists with that name
-
getCacheRegionStatistics
CacheRegionStatistics getCacheRegionStatistics(String regionName)
Get statistics for either a domain-data or query-result region - this method checks both, preferring domain data region if one. Think of it as a cascading check to: Note that returning null is preferred here over throwing an exception when no region exists with that name.- Parameters:
regionName
- The unqualified region name- Returns:
- Stats for the named region, or
null
if no such region exists
-
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 fetches- 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
-
getNaturalIdQueryExecutionCount
long getNaturalIdQueryExecutionCount()
Get the global number of natural id queries executed against the database
-
getNaturalIdQueryExecutionMaxTime
long getNaturalIdQueryExecutionMaxTime()
Get the global maximum query time for natural id queries executed against the database
-
getNaturalIdQueryExecutionMaxTimeRegion
String getNaturalIdQueryExecutionMaxTimeRegion()
Get the region for the maximum natural id query time
-
getNaturalIdQueryExecutionMaxTimeEntity
String getNaturalIdQueryExecutionMaxTimeEntity()
-
getNaturalIdCacheHitCount
long getNaturalIdCacheHitCount()
Get the global number of cached natural id lookups successfully retrieved from cache
-
getNaturalIdCacheMissCount
long getNaturalIdCacheMissCount()
Get the global number of cached natural id lookups *not* found in cache
-
getNaturalIdCachePutCount
long getNaturalIdCachePutCount()
Get the global number of cacheable natural id lookups put in cache
-
getUpdateTimestampsCacheHitCount
long getUpdateTimestampsCacheHitCount()
Get the global number of timestamps successfully retrieved from cache
-
getUpdateTimestampsCacheMissCount
long getUpdateTimestampsCacheMissCount()
Get the global number of timestamp requests that were not found in the cache
-
getUpdateTimestampsCachePutCount
long getUpdateTimestampsCachePutCount()
Get the global number of timestamps 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()
The milliseconds (JVM standardSystem.currentTimeMillis()
) since the initial creation of this Statistics instance or the last timeclear()
was called.
-
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. Note: for backwards compatibility this method returns just the names of regions storing domain data, not query result regions
-
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
-
getSecondLevelCacheStatistics
@Deprecated SecondLevelCacheStatistics getSecondLevelCacheStatistics(String regionName)
Deprecated.(since 5.3) UsegetDomainDataRegionStatistics(java.lang.String)
insteadSecond-level cache statistics per region- Parameters:
regionName
- qualified region name- Returns:
- SecondLevelCacheStatistics or
null
if the second level cache is not enabled - Throws:
IllegalArgumentException
- if the region name could not be resolved
-
getNaturalIdCacheStatistics
@Deprecated NaturalIdCacheStatistics getNaturalIdCacheStatistics(String regionName)
Deprecated.(since 5.3) UsegetNaturalIdStatistics(java.lang.String)
orgetDomainDataRegionStatistics(java.lang.String)
instead depending on needNatural id cache statistics per region- Parameters:
regionName
- region name- Returns:
- NaturalIdCacheStatistics
-
-