KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > hibernate > stat > Statistics


1 //$Id: Statistics.java,v 1.14 2005/04/25 07:33:13 oneovthafew Exp $
2
package org.hibernate.stat;
3
4
5 /**
6  * Statistics for a particular <tt>SessionFactory</tt>.
7  * Beware of milliseconds metrics, they are depdendent of the JVM precision:
8  * you may then encounter a 10 ms approximation dending on you OS platform.
9  * Please refer to the JVM documentation for more information.
10  *
11  * @author Emmanuel Bernard
12  */

13 public interface Statistics {
14     /**
15      * reset all statistics
16      */

17     public void clear();
18
19     /**
20      * find entity statistics per name
21      *
22      * @param entityName entity name
23      * @return EntityStatistics object
24      */

25     public EntityStatistics getEntityStatistics(String JavaDoc entityName);
26     /**
27      * Get collection statistics per role
28      *
29      * @param role collection role
30      * @return CollectionStatistics
31      */

32     public CollectionStatistics getCollectionStatistics(String JavaDoc role);
33
34     /**
35      * Second level cache statistics per region
36      *
37      * @param regionName region name
38      * @return SecondLevelCacheStatistics
39      */

40     public SecondLevelCacheStatistics getSecondLevelCacheStatistics(String JavaDoc regionName);
41
42     /**
43      * Query statistics from query string (HQL or SQL)
44      *
45      * @param queryString query string
46      * @return QueryStatistics
47      */

48     public QueryStatistics getQueryStatistics(String JavaDoc queryString);
49
50     /**
51      * Get global number of entity deletes
52      * @return entity deletion count
53      */

54     public long getEntityDeleteCount();
55
56     /**
57      * Get global number of entity inserts
58      * @return entity insertion count
59      */

60     public long getEntityInsertCount();
61
62     /**
63      * Get global number of entity loads
64      * @return entity load (from DB)
65      */

66     public long getEntityLoadCount();
67     /**
68      * Get global number of entity fetchs
69      * @return entity fetch (from DB)
70      */

71     public long getEntityFetchCount();
72
73     /**
74      * Get global number of entity updates
75      * @return entity update
76      */

77     public long getEntityUpdateCount();
78
79     /**
80      * Get global number of executed queries
81      * @return query execution count
82      */

83     public long getQueryExecutionCount();
84
85     /**
86      * Get the time in milliseconds of the slowest query.
87      */

88     public long getQueryExecutionMaxTime();
89
90     /**
91      * Get the global number of cached queries successfully retrieved from cache
92      */

93     public long getQueryCacheHitCount();
94     /**
95      * Get the global number of cached queries *not* found in cache
96      */

97     public long getQueryCacheMissCount();
98     /**
99      * Get the global number of cacheable queries put in cache
100      */

101     public long getQueryCachePutCount();
102     /**
103      * Get the global number of flush executed by sessions (either implicit or explicit)
104      */

105     public long getFlushCount();
106     /**
107      * Get the global number of connections asked by the sessions
108      * (the actual number of connections used may be much smaller depending
109      * whether you use a connection pool or not)
110      */

111     public long getConnectCount();
112     /**
113      * Global number of cacheable entities/collections successfully retrieved from the cache
114      */

115     public long getSecondLevelCacheHitCount();
116     /**
117      * Global number of cacheable entities/collections not found in the cache and loaded from the database.
118      */

119     public long getSecondLevelCacheMissCount();
120     /**
121      * Global number of cacheable entities/collections put in the cache
122      */

123     public long getSecondLevelCachePutCount();
124     /**
125      * Global number of sessions closed
126      */

127     public long getSessionCloseCount();
128     /**
129      * Global number of sessions opened
130      */

131     public long getSessionOpenCount();
132     /**
133      * Global number of collections loaded
134      */

135     public long getCollectionLoadCount();
136     /**
137      * Global number of collections fetched
138      */

139     public long getCollectionFetchCount();
140     /**
141      * Global number of collections updated
142      */

143     public long getCollectionUpdateCount();
144     /**
145      * Global number of collections removed
146      */

147     //even on inverse="true"
148
public long getCollectionRemoveCount();
149     /**
150      * Global number of collections recreated
151      */

152     public long getCollectionRecreateCount();
153     /**
154      * @return start time in ms (JVM standards {@link System#currentTimeMillis()})
155      */

156     public long getStartTime();
157     /**
158      * log in info level the main statistics
159      */

160     public void logSummary();
161     /**
162      * Are statistics logged
163      */

164     public boolean isStatisticsEnabled();
165     /**
166      * Enable statistics logs (this is a dynamic parameter)
167      */

168     public void setStatisticsEnabled(boolean b);
169
170     /**
171      * Get all executed query strings
172      */

173     public String JavaDoc[] getQueries();
174     /**
175      * Get the names of all entities
176      */

177     public String JavaDoc[] getEntityNames();
178     /**
179      * Get the names of all collection roles
180      */

181     public String JavaDoc[] getCollectionRoleNames();
182     /**
183      * Get all second-level cache region names
184      */

185     public String JavaDoc[] getSecondLevelCacheRegionNames();
186     /**
187      * The number of transactions we know to have been successful
188      */

189     public long getSuccessfulTransactionCount();
190     /**
191      * The number of transactions we know to have completed
192      */

193     public long getTransactionCount();
194     /**
195      * The number of prepared statements that were acquired
196      */

197     public long getPrepareStatementCount();
198     /**
199      * The number of prepared statements that were released
200      */

201     public long getCloseStatementCount();
202 }
Popular Tags