diff options
author | Justin Clark-Casey (justincc) | 2012-10-23 01:50:05 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2012-10-23 01:52:10 +0100 |
commit | 4578ff74fec7500902f58fbdee6ce5a6b39601fb (patch) | |
tree | 5058ada18085a83ae8a76a791ba1052c7025b6d6 /OpenSim/Framework/Pool.cs | |
parent | minor: Get content type handler logger to log "unset" for the content type in... (diff) | |
download | opensim-SC_OLD-4578ff74fec7500902f58fbdee6ce5a6b39601fb.zip opensim-SC_OLD-4578ff74fec7500902f58fbdee6ce5a6b39601fb.tar.gz opensim-SC_OLD-4578ff74fec7500902f58fbdee6ce5a6b39601fb.tar.bz2 opensim-SC_OLD-4578ff74fec7500902f58fbdee6ce5a6b39601fb.tar.xz |
Add object count stats for new IncomingPacket and UDPPacketBuffer pools if they are enabled. Add count stats for existing LLUDP pool.
This introduces a pull stat type in addition to the push stat type.
A pull stat takes a method on construction which knows how to update the stat on request.
In this way, special interfaces for pull stat collection are not necessary.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Framework/Pool.cs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/OpenSim/Framework/Pool.cs b/OpenSim/Framework/Pool.cs index 1ca06c3..5484f5c 100644 --- a/OpenSim/Framework/Pool.cs +++ b/OpenSim/Framework/Pool.cs | |||
@@ -38,8 +38,23 @@ namespace OpenSim.Framework | |||
38 | /// </remarks> | 38 | /// </remarks> |
39 | public class Pool<T> | 39 | public class Pool<T> |
40 | { | 40 | { |
41 | /// <summary> | ||
42 | /// Number of objects in the pool. | ||
43 | /// </summary> | ||
44 | public int Count | ||
45 | { | ||
46 | get | ||
47 | { | ||
48 | lock (m_pool) | ||
49 | return m_pool.Count; | ||
50 | } | ||
51 | } | ||
52 | |||
41 | private Stack<T> m_pool; | 53 | private Stack<T> m_pool; |
42 | 54 | ||
55 | /// <summary> | ||
56 | /// Maximum pool size. Beyond this, any returned objects are not pooled. | ||
57 | /// </summary> | ||
43 | private int m_maxPoolSize; | 58 | private int m_maxPoolSize; |
44 | 59 | ||
45 | private Func<T> m_createFunction; | 60 | private Func<T> m_createFunction; |