public interface Statistics
Exposes statistics for a particular SessionFactory
. 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.
Modifier and Type | Method and Description |
---|---|
void |
clear()
reset all statistics
|
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.
|
long |
getCloseStatementCount()
The number of prepared statements that were released
|
long |
getCollectionFetchCount()
Global number of collections fetched
|
long |
getCollectionLoadCount()
Global number of collections loaded
|
long |
getCollectionRecreateCount()
Global number of collections recreated
|
long |
getCollectionRemoveCount()
Global number of collections removed
|
String[] |
getCollectionRoleNames()
Get the names of all collection roles
|
CollectionStatistics |
getCollectionStatistics(String role)
Get collection statistics per role
|
long |
getCollectionUpdateCount()
Global number of collections updated
|
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)
|
CacheRegionStatistics |
getDomainDataRegionStatistics(String regionName)
Second level cache statistics per domain data (entity, collection, natural-id) region
|
long |
getEntityDeleteCount()
Get global number of entity deletes
|
long |
getEntityFetchCount()
Get global number of entity fetchs
|
long |
getEntityInsertCount()
Get global number of entity inserts
|
long |
getEntityLoadCount()
Get global number of entity loads
|
String[] |
getEntityNames()
Get the names of all entities
|
EntityStatistics |
getEntityStatistics(String entityName)
find entity statistics per name
|
long |
getEntityUpdateCount()
Get global number of entity updates
|
long |
getFlushCount()
Get the global number of flush executed by sessions (either implicit or explicit)
|
long |
getNaturalIdCacheHitCount()
Get the global number of cached naturalId lookups successfully retrieved from cache
|
long |
getNaturalIdCacheMissCount()
Get the global number of cached naturalId lookups not found in cache
|
long |
getNaturalIdCachePutCount()
Get the global number of cacheable naturalId lookups put in cache
|
NaturalIdCacheStatistics |
getNaturalIdCacheStatistics(String regionName)
Deprecated.
(since 5.3) Use
getNaturalIdStatistics(java.lang.String) or
@getDomainDataRegionStatistics instead depending on need |
long |
getNaturalIdQueryExecutionCount()
Get the global number of naturalId queries executed against the database
|
long |
getNaturalIdQueryExecutionMaxTime()
Get the global maximum query time for naturalId queries executed against the database
|
String |
getNaturalIdQueryExecutionMaxTimeEntity() |
String |
getNaturalIdQueryExecutionMaxTimeRegion()
Get the region for the maximum naturalId query time
|
NaturalIdStatistics |
getNaturalIdStatistics(String entityName)
Natural id resolution query statistics for an entity type
|
long |
getOptimisticFailureCount()
The number of <tt>StaleObjectStateException</tt>s
that occurred
|
long |
getPrepareStatementCount()
The number of prepared statements that were acquired
|
String[] |
getQueries()
Get all executed query strings
|
long |
getQueryCacheHitCount()
Get the global number of cached queries successfully retrieved from cache
|
long |
getQueryCacheMissCount()
Get the global number of cached queries not found in cache
|
long |
getQueryCachePutCount()
Get the global number of cacheable queries put in cache
|
long |
getQueryExecutionCount()
Get global number of executed queries
|
long |
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 region
|
QueryStatistics |
getQueryStatistics(String queryString)
Query statistics from query string (HQL or SQL)
|
long |
getSecondLevelCacheHitCount()
Global number of cacheable entities/collections successfully retrieved from the cache
|
long |
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 cache
|
String[] |
getSecondLevelCacheRegionNames()
Get all second-level cache region names.
|
SecondLevelCacheStatistics |
getSecondLevelCacheStatistics(String regionName)
Deprecated.
(since 5.3) Use
getDomainDataRegionStatistics(java.lang.String) instead |
long |
getSessionCloseCount()
Global number of sessions closed
|
long |
getSessionOpenCount()
Global number of sessions opened
|
long |
getStartTime()
The milliseconds (JVM standard
System.currentTimeMillis() ) from
which all statistics accessed since the initial creation of this Statistics
instance or the last clear() |
long |
getSuccessfulTransactionCount()
The number of transactions we know to have been successful
|
long |
getTransactionCount()
The number of transactions we know to have completed
|
long |
getUpdateTimestampsCacheHitCount()
Get the global number of timestamps successfully retrieved from cache
|
long |
getUpdateTimestampsCacheMissCount()
Get the global number of tables for which no update timestamps was not found in cache
|
long |
getUpdateTimestampsCachePutCount()
Get the global number of timestamps put in cache
|
boolean |
isStatisticsEnabled()
Are statistics enabled
|
void |
logSummary()
log in info level the main statistics
|
void |
setStatisticsEnabled(boolean b)
Enable statistics logs (this is a dynamic parameter)
|
boolean isStatisticsEnabled()
Are statistics enabled
void setStatisticsEnabled(boolean b)
Enable statistics logs (this is a dynamic parameter)
void clear()
reset all statistics
void logSummary()
log in info level the main statistics
EntityStatistics getEntityStatistics(String entityName)
find entity statistics per name
entityName
- entity nameCollectionStatistics getCollectionStatistics(String role)
Get collection statistics per role
role
- collection roleNaturalIdStatistics getNaturalIdStatistics(String entityName)
Natural id resolution query statistics for an entity type
entityName
- The entity name that is the root of the hierarchy containing the
natural idQueryStatistics getQueryStatistics(String queryString)
Query statistics from query string (HQL or SQL)
queryString
- query stringCacheRegionStatistics getDomainDataRegionStatistics(String regionName)
Second level cache statistics per domain data (entity, collection, natural-id) region
regionName
- The unqualified region namenull
if the second level cache is
not enabledIllegalArgumentException
- if the region name could not be resolvedCacheRegionStatistics getQueryRegionStatistics(String regionName)
Second level cache statistics per query region
regionName
- The unqualified region namenull
if (1) query result caching is
not enabled or (2) no query region exists with that nameCacheRegionStatistics 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:<ol>
<li>getDomainDataRegionStatistics(java.lang.String)
</li>
<li>getQueryRegionStatistics(java.lang.String)
</li>
</ol>
Note that returning null is preferred here over throwing an exception when
no region exists with that name.
regionName
- The unqualified region namenull
if no such region existslong getEntityDeleteCount()
Get global number of entity deletes
long getEntityInsertCount()
Get global number of entity inserts
long getEntityLoadCount()
Get global number of entity loads
long getEntityFetchCount()
Get global number of entity fetchs
long getEntityUpdateCount()
Get global number of entity updates
long getQueryExecutionCount()
Get global number of executed queries
long getQueryExecutionMaxTime()
Get the time in milliseconds of the slowest query.
String getQueryExecutionMaxTimeQueryString()
Get the query string for the slowest query.
long getQueryCacheHitCount()
Get the global number of cached queries successfully retrieved from cache
long getQueryCacheMissCount()
Get the global number of cached queries not found in cache
long getQueryCachePutCount()
Get the global number of cacheable queries put in cache
long getNaturalIdQueryExecutionCount()
Get the global number of naturalId queries executed against the database
long getNaturalIdQueryExecutionMaxTime()
Get the global maximum query time for naturalId queries executed against the database
String getNaturalIdQueryExecutionMaxTimeRegion()
Get the region for the maximum naturalId query time
String getNaturalIdQueryExecutionMaxTimeEntity()
long getNaturalIdCacheHitCount()
Get the global number of cached naturalId lookups successfully retrieved from cache
long getNaturalIdCacheMissCount()
Get the global number of cached naturalId lookups not found in cache
long getNaturalIdCachePutCount()
Get the global number of cacheable naturalId lookups put in cache
long getUpdateTimestampsCacheHitCount()
Get the global number of timestamps successfully retrieved from cache
long getUpdateTimestampsCacheMissCount()
Get the global number of tables for which no update timestamps was not found in cache
long getUpdateTimestampsCachePutCount()
Get the global number of timestamps put in cache
long getFlushCount()
Get the global number of flush executed by sessions (either implicit or explicit)
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)
long getSecondLevelCacheHitCount()
Global number of cacheable entities/collections successfully retrieved from the cache
long 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 cache
long getSessionCloseCount()
Global number of sessions closed
long getSessionOpenCount()
Global number of sessions opened
long getCollectionLoadCount()
Global number of collections loaded
long getCollectionFetchCount()
Global number of collections fetched
long getCollectionUpdateCount()
Global number of collections updated
long getCollectionRemoveCount()
Global number of collections removed
long getCollectionRecreateCount()
Global number of collections recreated
long getStartTime()
The milliseconds (JVM standard System.currentTimeMillis()
) from
which all statistics accessed since the initial creation of this Statistics
instance or the last clear()
String[] getQueries()
Get all executed query strings
String[] getEntityNames()
Get the names of all entities
String[] getCollectionRoleNames()
Get the names of all collection roles
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
long getSuccessfulTransactionCount()
The number of transactions we know to have been successful
long getTransactionCount()
The number of transactions we know to have completed
long getPrepareStatementCount()
The number of prepared statements that were acquired
long getCloseStatementCount()
The number of prepared statements that were released
long getOptimisticFailureCount()
The number of <tt>StaleObjectStateException</tt>s that occurred
@Deprecated SecondLevelCacheStatistics getSecondLevelCacheStatistics(String regionName)
getDomainDataRegionStatistics(java.lang.String)
insteadSecond level cache statistics per region
regionName
- qualified region namenull
if the second level cache is not enabledIllegalArgumentException
- if the region name could not be resolved@Deprecated NaturalIdCacheStatistics getNaturalIdCacheStatistics(String regionName)
getNaturalIdStatistics(java.lang.String)
or
@getDomainDataRegionStatistics
instead depending on needNatural id cache statistics per region
regionName
- region nameCopyright © 2001-2018 Red Hat, Inc. All Rights Reserved.