org.hibernate.stat
Interface Statistics

All Known Subinterfaces:
StatisticsServiceMBean
All Known Implementing Classes:
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.

Author:
Emmanuel Bernard

Method Summary
 void clear()
          reset all statistics
 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)
 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 getOperationThreshold()
           
 long getOptimisticFailureCount()
          The number of StaleObjectStateExceptions 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.
 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)
          Second level cache statistics per region
 long getSessionCloseCount()
          Global number of sessions closed
 long getSessionOpenCount()
          Global number of sessions opened
 long getStartTime()
           
 long getSuccessfulTransactionCount()
          The number of transactions we know to have been successful
 long getTransactionCount()
          The number of transactions we know to have completed
 boolean isStatisticsEnabled()
          Are statistics logged
 void logSummary()
          log in info level the main statistics
 void setOperationThreshold(long threshold)
          Set the operationThreshold to a value greater than zero to enable logging of long running operations.
 void setStatisticsEnabled(boolean b)
          Enable statistics logs (this is a dynamic parameter)
 

Method Detail

clear

public void clear()
reset all statistics


getEntityStatistics

public EntityStatistics getEntityStatistics(String entityName)
find entity statistics per name

Parameters:
entityName - entity name
Returns:
EntityStatistics object

getCollectionStatistics

public CollectionStatistics getCollectionStatistics(String role)
Get collection statistics per role

Parameters:
role - collection role
Returns:
CollectionStatistics

getSecondLevelCacheStatistics

public SecondLevelCacheStatistics getSecondLevelCacheStatistics(String regionName)
Second level cache statistics per region

Parameters:
regionName - region name
Returns:
SecondLevelCacheStatistics

getQueryStatistics

public QueryStatistics getQueryStatistics(String queryString)
Query statistics from query string (HQL or SQL)

Parameters:
queryString - query string
Returns:
QueryStatistics

getEntityDeleteCount

public long getEntityDeleteCount()
Get global number of entity deletes

Returns:
entity deletion count

getEntityInsertCount

public long getEntityInsertCount()
Get global number of entity inserts

Returns:
entity insertion count

getEntityLoadCount

public long getEntityLoadCount()
Get global number of entity loads

Returns:
entity load (from DB)

getEntityFetchCount

public long getEntityFetchCount()
Get global number of entity fetchs

Returns:
entity fetch (from DB)

getEntityUpdateCount

public long getEntityUpdateCount()
Get global number of entity updates

Returns:
entity update

getQueryExecutionCount

public long getQueryExecutionCount()
Get global number of executed queries

Returns:
query execution count

getQueryExecutionMaxTime

public long getQueryExecutionMaxTime()
Get the time in milliseconds of the slowest query.


getQueryExecutionMaxTimeQueryString

public String getQueryExecutionMaxTimeQueryString()
Get the query string for the slowest query.


getQueryCacheHitCount

public long getQueryCacheHitCount()
Get the global number of cached queries successfully retrieved from cache


getQueryCacheMissCount

public long getQueryCacheMissCount()
Get the global number of cached queries *not* found in cache


getQueryCachePutCount

public long getQueryCachePutCount()
Get the global number of cacheable queries put in cache


getFlushCount

public long getFlushCount()
Get the global number of flush executed by sessions (either implicit or explicit)


getConnectCount

public 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

public long getSecondLevelCacheHitCount()
Global number of cacheable entities/collections successfully retrieved from the cache


getSecondLevelCacheMissCount

public long getSecondLevelCacheMissCount()
Global number of cacheable entities/collections not found in the cache and loaded from the database.


getSecondLevelCachePutCount

public long getSecondLevelCachePutCount()
Global number of cacheable entities/collections put in the cache


getSessionCloseCount

public long getSessionCloseCount()
Global number of sessions closed


getSessionOpenCount

public long getSessionOpenCount()
Global number of sessions opened


getCollectionLoadCount

public long getCollectionLoadCount()
Global number of collections loaded


getCollectionFetchCount

public long getCollectionFetchCount()
Global number of collections fetched


getCollectionUpdateCount

public long getCollectionUpdateCount()
Global number of collections updated


getCollectionRemoveCount

public long getCollectionRemoveCount()
Global number of collections removed


getCollectionRecreateCount

public long getCollectionRecreateCount()
Global number of collections recreated


getStartTime

public long getStartTime()
Returns:
start time in ms (JVM standards System.currentTimeMillis())

logSummary

public void logSummary()
log in info level the main statistics


isStatisticsEnabled

public boolean isStatisticsEnabled()
Are statistics logged


setStatisticsEnabled

public void setStatisticsEnabled(boolean b)
Enable statistics logs (this is a dynamic parameter)


getQueries

public String[] getQueries()
Get all executed query strings


getEntityNames

public String[] getEntityNames()
Get the names of all entities


getCollectionRoleNames

public String[] getCollectionRoleNames()
Get the names of all collection roles


getSecondLevelCacheRegionNames

public String[] getSecondLevelCacheRegionNames()
Get all second-level cache region names


getSuccessfulTransactionCount

public long getSuccessfulTransactionCount()
The number of transactions we know to have been successful


getTransactionCount

public long getTransactionCount()
The number of transactions we know to have completed


getPrepareStatementCount

public long getPrepareStatementCount()
The number of prepared statements that were acquired


getCloseStatementCount

public long getCloseStatementCount()
The number of prepared statements that were released


getOptimisticFailureCount

public long getOptimisticFailureCount()
The number of StaleObjectStateExceptions that occurred


setOperationThreshold

public void setOperationThreshold(long threshold)
Set the operationThreshold to a value greater than zero to enable logging of long running operations.

Parameters:
threshold - (milliseconds)

getOperationThreshold

public long getOperationThreshold()
Returns:
Operationthreshold, if greater than zero, operations that exceed the level will be logged.