use of org.hibernate.stat.Statistics in project wildfly by wildfly.
the class DummyEntityCustomRegionRESTResource method clearStatistics.
@GET
@Path("/clear-statistics")
@Produces("text/plain")
public Response clearStatistics() {
Statistics stats = em.unwrap(Session.class).getSessionFactory().getStatistics();
stats.clear();
return Response.ok().build();
}
use of org.hibernate.stat.Statistics in project gocd by gocd.
the class HibernateInformationProvider method asJson.
@Override
public Map<String, Object> asJson() {
LinkedHashMap<String, Object> json = new LinkedHashMap<>();
Statistics statistics = sessionFactory.getStatistics();
if (!statistics.isStatisticsEnabled()) {
return json;
}
json.put("EntityDeleteCount", statistics.getEntityDeleteCount());
json.put("EntityInsertCount", statistics.getEntityInsertCount());
json.put("EntityLoadCount", statistics.getEntityLoadCount());
json.put("EntityFetchCount", statistics.getEntityFetchCount());
json.put("EntityUpdateCount", statistics.getEntityUpdateCount());
json.put("QueryExecutionCount", statistics.getQueryExecutionCount());
json.put("QueryExecutionMaxTime", statistics.getQueryExecutionMaxTime());
json.put("QueryExecutionMaxTimeQueryString", statistics.getQueryExecutionMaxTimeQueryString());
json.put("QueryCacheHitCount", statistics.getQueryCacheHitCount());
json.put("QueryCacheMissCount", statistics.getQueryCacheMissCount());
json.put("QueryCachePutCount", statistics.getQueryCachePutCount());
json.put("FlushCount", statistics.getFlushCount());
json.put("ConnectCount", statistics.getConnectCount());
json.put("SecondLevelCacheHitCount", statistics.getSecondLevelCacheHitCount());
json.put("SecondLevelCacheMissCount", statistics.getSecondLevelCacheMissCount());
json.put("SecondLevelCachePutCount", statistics.getSecondLevelCachePutCount());
json.put("SessionCloseCount", statistics.getSessionCloseCount());
json.put("SessionOpenCount", statistics.getSessionOpenCount());
json.put("CollectionLoadCount", statistics.getCollectionLoadCount());
json.put("CollectionFetchCount", statistics.getCollectionFetchCount());
json.put("CollectionUpdateCount", statistics.getCollectionUpdateCount());
json.put("CollectionRemoveCount", statistics.getCollectionRemoveCount());
json.put("CollectionRecreateCount", statistics.getCollectionRecreateCount());
json.put("StartTime", statistics.getStartTime());
json.put("SecondLevelCacheRegionNames", statistics.getSecondLevelCacheRegionNames());
json.put("SuccessfulTransactionCount", statistics.getSuccessfulTransactionCount());
json.put("TransactionCount", statistics.getTransactionCount());
json.put("PrepareStatementCount", statistics.getPrepareStatementCount());
json.put("CloseStatementCount", statistics.getCloseStatementCount());
json.put("OptimisticFailureCount", statistics.getOptimisticFailureCount());
LinkedHashMap<String, Object> queryStats = new LinkedHashMap<>();
json.put("Queries", queryStats);
String[] queries = statistics.getQueries();
for (String query : queries) {
queryStats.put(query, statistics.getQueryStatistics(query));
}
LinkedHashMap<String, Object> entityStatistics = new LinkedHashMap<>();
json.put("EntityStatistics", entityStatistics);
String[] entityNames = statistics.getEntityNames();
for (String entityName : entityNames) {
entityStatistics.put(entityName, statistics.getEntityStatistics(entityName));
}
LinkedHashMap<String, Object> roleStatistics = new LinkedHashMap<>();
json.put("RoleStatistics", roleStatistics);
String[] roleNames = statistics.getCollectionRoleNames();
for (String roleName : roleNames) {
roleStatistics.put(roleName, statistics.getCollectionStatistics(roleName));
}
return json;
}
use of org.hibernate.stat.Statistics in project openolat by klemens.
the class DatabaseWebService method getHibernateStatistics.
private HibernateStatisticsVO getHibernateStatistics() {
Statistics statistics = DBFactory.getInstance().getStatistics();
if (!statistics.isStatisticsEnabled()) {
return null;
}
HibernateStatisticsVO stats = new HibernateStatisticsVO();
stats.setOpenSessionsCount(statistics.getSessionOpenCount());
stats.setTransactionsCount(statistics.getTransactionCount());
stats.setSuccessfulTransactionCount(statistics.getSuccessfulTransactionCount());
stats.setFailedTransactionsCount(statistics.getTransactionCount() - statistics.getSuccessfulTransactionCount());
stats.setOptimisticFailureCount(statistics.getOptimisticFailureCount());
stats.setQueryExecutionCount(statistics.getQueryExecutionCount());
stats.setQueryExecutionMaxTime(statistics.getQueryExecutionMaxTime());
stats.setQueryExecutionMaxTimeQueryString(statistics.getQueryExecutionMaxTimeQueryString());
return stats;
}
use of org.hibernate.stat.Statistics in project hibernate-orm by hibernate.
the class HibernateStatsImpl method getEntityStats.
@Override
public TabularData getEntityStats() {
final List<CompositeData> result = new ArrayList<CompositeData>();
final Statistics statistics = getStatistics();
for (String entity : statistics.getEntityNames()) {
final EntityStats entityStats = new EntityStats(entity, statistics.getEntityStatistics(entity));
result.add(entityStats.toCompositeData());
}
final TabularData td = EntityStats.newTabularDataInstance();
td.putAll(result.toArray(new CompositeData[result.size()]));
return td;
}
use of org.hibernate.stat.Statistics in project hibernate-orm by hibernate.
the class HibernateStatsImpl method getCollectionStats.
@Override
public TabularData getCollectionStats() {
final List<CompositeData> result = new ArrayList<CompositeData>();
final Statistics statistics = getStatistics();
for (String roleName : statistics.getCollectionRoleNames()) {
final CollectionStats collectionStats = new CollectionStats(roleName, statistics.getCollectionStatistics(roleName));
result.add(collectionStats.toCompositeData());
}
final TabularData td = CollectionStats.newTabularDataInstance();
td.putAll(result.toArray(new CompositeData[result.size()]));
return td;
}
Aggregations