Package org.hibernate.stat
Interface Statistics
-
- All Known Subinterfaces:
StatisticsImplementor
public interface StatisticsExposes 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 voidclear()reset all statisticsCacheRegionStatisticsgetCacheRegionStatistics(java.lang.String regionName)Get statistics for either a domain-data or query-result region - this method checks both, preferring domain data region if one.longgetCloseStatementCount()The number of prepared statements that were releasedlonggetCollectionFetchCount()Global number of collections fetchedlonggetCollectionLoadCount()Global number of collections loadedlonggetCollectionRecreateCount()Global number of collections recreatedlonggetCollectionRemoveCount()Global number of collections removedjava.lang.String[]getCollectionRoleNames()Get the names of all collection rolesCollectionStatisticsgetCollectionStatistics(java.lang.String role)Get collection statistics per rolelonggetCollectionUpdateCount()Global number of collections updatedlonggetConnectCount()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)CacheRegionStatisticsgetDomainDataRegionStatistics(java.lang.String regionName)Second-level cache statistics per domain data (entity, collection, natural-id) regionlonggetEntityDeleteCount()Get global number of entity deleteslonggetEntityFetchCount()Get global number of entity fetcheslonggetEntityInsertCount()Get global number of entity insertslonggetEntityLoadCount()Get global number of entity loadsjava.lang.String[]getEntityNames()Get the names of all entitiesEntityStatisticsgetEntityStatistics(java.lang.String entityName)find entity statistics per namelonggetEntityUpdateCount()Get global number of entity updateslonggetFlushCount()Get the global number of flush executed by sessions (either implicit or explicit)longgetNaturalIdCacheHitCount()Get the global number of cached natural id lookups successfully retrieved from cachelonggetNaturalIdCacheMissCount()Get the global number of cached natural id lookups *not* found in cachelonggetNaturalIdCachePutCount()Get the global number of cacheable natural id lookups put in cacheNaturalIdCacheStatisticsgetNaturalIdCacheStatistics(java.lang.String regionName)Deprecated.(since 5.3) UsegetNaturalIdStatistics(java.lang.String)orgetDomainDataRegionStatistics(java.lang.String)instead depending on needlonggetNaturalIdQueryExecutionCount()Get the global number of natural id queries executed against the databaselonggetNaturalIdQueryExecutionMaxTime()Get the global maximum query time for natural id queries executed against the databasejava.lang.StringgetNaturalIdQueryExecutionMaxTimeEntity()java.lang.StringgetNaturalIdQueryExecutionMaxTimeRegion()Get the region for the maximum natural id query timeNaturalIdStatisticsgetNaturalIdStatistics(java.lang.String entityName)Natural id resolution query statistics for an entity typelonggetOptimisticFailureCount()The number of StaleObjectStateExceptions that occurredlonggetPrepareStatementCount()The number of prepared statements that were acquiredjava.lang.String[]getQueries()Get all executed query stringslonggetQueryCacheHitCount()Get the global number of cached queries successfully retrieved from cachelonggetQueryCacheMissCount()Get the global number of cached queries *not* found in cachelonggetQueryCachePutCount()Get the global number of cacheable queries put in cachelonggetQueryExecutionCount()Get global number of executed querieslonggetQueryExecutionMaxTime()Get the time in milliseconds of the slowest query.java.lang.StringgetQueryExecutionMaxTimeQueryString()Get the query string for the slowest query.CacheRegionStatisticsgetQueryRegionStatistics(java.lang.String regionName)Second-level cache statistics per query regionQueryStatisticsgetQueryStatistics(java.lang.String queryString)Query statistics from query string (HQL or SQL)longgetSecondLevelCacheHitCount()Global number of cacheable entities/collections successfully retrieved from the cachelonggetSecondLevelCacheMissCount()Global number of cacheable entities/collections not found in the cache and loaded from the database.longgetSecondLevelCachePutCount()Global number of cacheable entities/collections put in the cachejava.lang.String[]getSecondLevelCacheRegionNames()Get all second-level cache region names.SecondLevelCacheStatisticsgetSecondLevelCacheStatistics(java.lang.String regionName)Deprecated.(since 5.3) UsegetDomainDataRegionStatistics(java.lang.String)insteadlonggetSessionCloseCount()Global number of sessions closedlonggetSessionOpenCount()Global number of sessions openedlonggetStartTime()The milliseconds (JVM standardSystem.currentTimeMillis()) since the initial creation of this Statistics instance or the last timeclear()was called.longgetSuccessfulTransactionCount()The number of transactions we know to have been successfullonggetTransactionCount()The number of transactions we know to have completedlonggetUpdateTimestampsCacheHitCount()Get the global number of timestamps successfully retrieved from cachelonggetUpdateTimestampsCacheMissCount()Get the global number of timestamp requests that were not found in the cachelonggetUpdateTimestampsCachePutCount()Get the global number of timestamps put in cachebooleanisStatisticsEnabled()Are statistics enabledvoidlogSummary()log in info level the main statisticsvoidsetStatisticsEnabled(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(java.lang.String entityName)
find entity statistics per name- Parameters:
entityName- entity name- Returns:
- EntityStatistics object
-
getCollectionStatistics
CollectionStatistics getCollectionStatistics(java.lang.String role)
Get collection statistics per role- Parameters:
role- collection role- Returns:
- CollectionStatistics
-
getNaturalIdStatistics
NaturalIdStatistics getNaturalIdStatistics(java.lang.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(java.lang.String queryString)
Query statistics from query string (HQL or SQL)- Parameters:
queryString- query string- Returns:
- QueryStatistics
-
getDomainDataRegionStatistics
CacheRegionStatistics getDomainDataRegionStatistics(java.lang.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
nullif the second level cache is not enabled - Throws:
java.lang.IllegalArgumentException- if the region name could not be resolved
-
getQueryRegionStatistics
CacheRegionStatistics getQueryRegionStatistics(java.lang.String regionName)
Second-level cache statistics per query region- Parameters:
regionName- The unqualified region name- Returns:
- Stats for the named region, or
nullif (1) query result caching is not enabled or (2) no query region exists with that name
-
getCacheRegionStatistics
CacheRegionStatistics getCacheRegionStatistics(java.lang.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
nullif 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
java.lang.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
java.lang.String getNaturalIdQueryExecutionMaxTimeRegion()
Get the region for the maximum natural id query time
-
getNaturalIdQueryExecutionMaxTimeEntity
java.lang.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
java.lang.String[] getQueries()
Get all executed query strings
-
getEntityNames
java.lang.String[] getEntityNames()
Get the names of all entities
-
getCollectionRoleNames
java.lang.String[] getCollectionRoleNames()
Get the names of all collection roles
-
getSecondLevelCacheRegionNames
java.lang.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(java.lang.String regionName)
Deprecated.(since 5.3) UsegetDomainDataRegionStatistics(java.lang.String)insteadSecond-level cache statistics per region- Parameters:
regionName- qualified region name- Returns:
- SecondLevelCacheStatistics or
nullif the second level cache is not enabled - Throws:
java.lang.IllegalArgumentException- if the region name could not be resolved
-
getNaturalIdCacheStatistics
@Deprecated NaturalIdCacheStatistics getNaturalIdCacheStatistics(java.lang.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
-
-