@@ -105,13 +105,13 @@ pub struct Statistics {
105105 ///
106106 /// This counter is incremented before the `get` operation starts waiting,
107107 /// so that it's possible to monitor the size of the queue by computing the
108- /// different with the other `get_*` statistics.
108+ /// difference with the other `get_*` statistics.
109109 pub get_started : u64 ,
110- /// Total gets performed that did not have to wait for a connection.
110+ /// Total gets completed that did not have to wait for a connection.
111111 pub get_direct : u64 ,
112- /// Total gets performed that had to wait for a connection available.
112+ /// Total gets completed that had to wait for a connection available.
113113 pub get_waited : u64 ,
114- /// Total gets performed that timed out while waiting for a connection.
114+ /// Total gets completed that timed out while waiting for a connection.
115115 pub get_timed_out : u64 ,
116116 /// Total time accumulated waiting for a connection.
117117 pub get_wait_time : Duration ,
@@ -129,6 +129,18 @@ pub struct Statistics {
129129 pub connections_closed_idle_timeout : u64 ,
130130}
131131
132+ impl Statistics {
133+ /// Total pending gets waiting for a connection.
134+ pub fn pending_gets ( & self ) -> u64 {
135+ self . get_started - self . completed_gets ( )
136+ }
137+
138+ /// Total gets completed.
139+ pub fn completed_gets ( & self ) -> u64 {
140+ self . get_direct + self . get_waited + self . get_timed_out
141+ }
142+ }
143+
132144/// A builder for a connection pool.
133145#[ derive( Debug ) ]
134146pub struct Builder < M : ManageConnection > {
0 commit comments