-
Notifications
You must be signed in to change notification settings - Fork 935
/
Copy pathIStatistics.cs
150 lines (109 loc) · 5.41 KB
/
IStatistics.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
using System;
using System.Diagnostics;
namespace NHibernate.Stat
{
/// <summary>
/// Statistics for a particular <see cref="ISessionFactory"/>.
/// Beware of metrics, they are dependent of the <see cref="Stopwatch"/> precision:
/// </summary>
public interface IStatistics
{
/// <summary> Global number of entity deletes</summary>
long EntityDeleteCount { get; }
/// <summary> Global number of entity inserts</summary>
long EntityInsertCount { get; }
/// <summary> Global number of entity loads</summary>
long EntityLoadCount { get; }
/// <summary> Global number of entity fetchs</summary>
long EntityFetchCount { get; }
/// <summary> Global number of entity updates</summary>
long EntityUpdateCount { get; }
/// <summary> Global number of executed queries</summary>
long QueryExecutionCount { get; }
/// <summary> The <see cref="TimeSpan"/> of the slowest query.</summary>
TimeSpan QueryExecutionMaxTime { get; }
/// <summary> The query string for the slowest query.</summary>
string QueryExecutionMaxTimeQueryString { get; }
/// <summary> The global number of cached queries successfully retrieved from cache</summary>
long QueryCacheHitCount { get; }
/// <summary> The global number of cached queries *not* found in cache</summary>
long QueryCacheMissCount { get; }
/// <summary> The global number of cacheable queries put in cache</summary>
long QueryCachePutCount { get; }
/// <summary> Get the global number of flush executed by sessions (either implicit or explicit)</summary>
long FlushCount { get; }
/// <summary>
/// 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)
/// </summary>
long ConnectCount { get; }
/// <summary> Global number of cacheable entities/collections successfully retrieved from the cache</summary>
long SecondLevelCacheHitCount { get; }
/// <summary> Global number of cacheable entities/collections not found in the cache and loaded from the database.</summary>
long SecondLevelCacheMissCount { get; }
/// <summary> Global number of cacheable entities/collections put in the cache</summary>
long SecondLevelCachePutCount { get; }
/// <summary> Global number of sessions closed</summary>
long SessionCloseCount { get; }
/// <summary> Global number of sessions opened</summary>
long SessionOpenCount { get; }
/// <summary> Global number of collections loaded</summary>
long CollectionLoadCount { get; }
/// <summary> Global number of collections fetched</summary>
long CollectionFetchCount { get; }
/// <summary> Global number of collections updated</summary>
long CollectionUpdateCount { get; }
/// <summary> Global number of collections removed</summary>
long CollectionRemoveCount { get; }
/// <summary> Global number of collections recreated</summary>
long CollectionRecreateCount { get; }
/// <summary> Start time </summary>
DateTime StartTime { get; }
/// <summary> Enable/Disable statistics logs (this is a dynamic parameter)</summary>
bool IsStatisticsEnabled { get; set; }
/// <summary> All executed query strings</summary>
string[] Queries { get; }
/// <summary> The names of all entities</summary>
string[] EntityNames { get; }
/// <summary> The names of all collection roles</summary>
string[] CollectionRoleNames { get; }
/// <summary> Get all second-level cache region names</summary>
string[] SecondLevelCacheRegionNames { get; }
/// <summary> The number of transactions we know to have been successful</summary>
long SuccessfulTransactionCount { get; }
/// <summary> The number of transactions we know to have completed</summary>
long TransactionCount { get; }
/// <summary> The number of prepared statements that were acquired</summary>
long PrepareStatementCount { get; }
/// <summary> The number of prepared statements that were released</summary>
long CloseStatementCount { get; }
/// <summary> The number of <tt>StaleObjectStateException</tt>s that occurred </summary>
long OptimisticFailureCount { get; }
/// <summary> Reset all statistics</summary>
void Clear();
/// <summary> Find entity statistics per name </summary>
/// <param name="entityName">entity name </param>
/// <returns> EntityStatistics object </returns>
EntityStatistics GetEntityStatistics(string entityName);
/// <summary> Get collection statistics per role </summary>
/// <param name="role">collection role </param>
/// <returns> CollectionStatistics </returns>
CollectionStatistics GetCollectionStatistics(string role);
/// <summary> Second level cache statistics per region </summary>
/// <param name="regionName">region name </param>
/// <returns> SecondLevelCacheStatistics </returns>
SecondLevelCacheStatistics GetSecondLevelCacheStatistics(string regionName);
/// <summary> Query statistics from query string (HQL or SQL) </summary>
/// <param name="queryString">query string </param>
/// <returns> QueryStatistics </returns>
QueryStatistics GetQueryStatistics(string queryString);
/// <summary> log in info level the main statistics</summary>
void LogSummary();
/// <summary>
/// The OperationThreshold to a value greater than <see cref="TimeSpan.MinValue"/> to enable logging of long running operations.
/// </summary>
/// <remarks>Operations that exceed the level will be logged.</remarks>
TimeSpan OperationThreshold { get; set; }
}
}