aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Monitoring/ServerStatsCollector.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Framework/Monitoring/ServerStatsCollector.cs')
-rw-r--r--OpenSim/Framework/Monitoring/ServerStatsCollector.cs77
1 files changed, 63 insertions, 14 deletions
diff --git a/OpenSim/Framework/Monitoring/ServerStatsCollector.cs b/OpenSim/Framework/Monitoring/ServerStatsCollector.cs
index 77315bb..a26a6e0 100644
--- a/OpenSim/Framework/Monitoring/ServerStatsCollector.cs
+++ b/OpenSim/Framework/Monitoring/ServerStatsCollector.cs
@@ -88,7 +88,7 @@ namespace OpenSim.Framework.Monitoring
88 IConfig cfg = source.Configs["Monitoring"]; 88 IConfig cfg = source.Configs["Monitoring"];
89 89
90 if (cfg != null) 90 if (cfg != null)
91 Enabled = cfg.GetBoolean("ServerStatsEnabled", true); 91 Enabled = cfg.GetBoolean("ServerStatsEnabled", false);
92 92
93 if (Enabled) 93 if (Enabled)
94 { 94 {
@@ -98,12 +98,18 @@ namespace OpenSim.Framework.Monitoring
98 98
99 public void Start() 99 public void Start()
100 { 100 {
101 if(!Enabled)
102 return;
103
101 if (RegisteredStats.Count == 0) 104 if (RegisteredStats.Count == 0)
102 RegisterServerStats(); 105 RegisterServerStats();
103 } 106 }
104 107
105 public void Close() 108 public void Close()
106 { 109 {
110 if(!Enabled)
111 return;
112
107 if (RegisteredStats.Count > 0) 113 if (RegisteredStats.Count > 0)
108 { 114 {
109 foreach (Stat stat in RegisteredStats.Values) 115 foreach (Stat stat in RegisteredStats.Values)
@@ -167,18 +173,18 @@ namespace OpenSim.Framework.Monitoring
167 } 173 }
168 174
169 MakeStat("BuiltinThreadpoolWorkerThreadsAvailable", null, "threads", ContainerThreadpool, 175 MakeStat("BuiltinThreadpoolWorkerThreadsAvailable", null, "threads", ContainerThreadpool,
170 s => 176 s =>
171 { 177 {
172 int workerThreads, iocpThreads; 178 int workerThreads, iocpThreads;
173 ThreadPool.GetAvailableThreads(out workerThreads, out iocpThreads); 179 ThreadPool.GetAvailableThreads(out workerThreads, out iocpThreads);
174 s.Value = workerThreads; 180 s.Value = workerThreads;
175 }); 181 });
176 182
177 MakeStat("BuiltinThreadpoolIOCPThreadsAvailable", null, "threads", ContainerThreadpool, 183 MakeStat("BuiltinThreadpoolIOCPThreadsAvailable", null, "threads", ContainerThreadpool,
178 s => 184 s =>
179 { 185 {
180 int workerThreads, iocpThreads; 186 int workerThreads, iocpThreads;
181 ThreadPool.GetAvailableThreads(out workerThreads, out iocpThreads); 187 ThreadPool.GetAvailableThreads(out workerThreads, out iocpThreads);
182 s.Value = iocpThreads; 188 s.Value = iocpThreads;
183 }); 189 });
184 190
@@ -193,10 +199,10 @@ namespace OpenSim.Framework.Monitoring
193 } 199 }
194 200
195 MakeStat( 201 MakeStat(
196 "HTTPRequestsMade", 202 "HTTPRequestsMade",
197 "Number of outbound HTTP requests made", 203 "Number of outbound HTTP requests made",
198 "requests", 204 "requests",
199 ContainerNetwork, 205 ContainerNetwork,
200 s => s.Value = WebUtil.RequestNumber, 206 s => s.Value = WebUtil.RequestNumber,
201 MeasuresOfInterest.AverageChangeOverTime); 207 MeasuresOfInterest.AverageChangeOverTime);
202 208
@@ -249,9 +255,52 @@ namespace OpenSim.Framework.Monitoring
249 (s) => { s.Value = Math.Round(MemoryWatchdog.LastHeapAllocationRate * 1000d / 1024d / 1024d, 3); }); 255 (s) => { s.Value = Math.Round(MemoryWatchdog.LastHeapAllocationRate * 1000d / 1024d / 1024d, 3); });
250 MakeStat("AverageHeapAllocationRate", null, "MB/sec", ContainerMemory, 256 MakeStat("AverageHeapAllocationRate", null, "MB/sec", ContainerMemory,
251 (s) => { s.Value = Math.Round(MemoryWatchdog.AverageHeapAllocationRate * 1000d / 1024d / 1024d, 3); }); 257 (s) => { s.Value = Math.Round(MemoryWatchdog.AverageHeapAllocationRate * 1000d / 1024d / 1024d, 3); });
258
259 MakeStat("ProcessResident", null, "MB", ContainerProcess,
260 (s) =>
261 {
262 Process myprocess = Process.GetCurrentProcess();
263 myprocess.Refresh();
264 s.Value = Math.Round(Process.GetCurrentProcess().WorkingSet64 / 1024.0 / 1024.0);
265 });
266 MakeStat("ProcessPaged", null, "MB", ContainerProcess,
267 (s) =>
268 {
269 Process myprocess = Process.GetCurrentProcess();
270 myprocess.Refresh();
271 s.Value = Math.Round(Process.GetCurrentProcess().PagedMemorySize64 / 1024.0 / 1024.0);
272 });
273 MakeStat("ProcessVirtual", null, "MB", ContainerProcess,
274 (s) =>
275 {
276 Process myprocess = Process.GetCurrentProcess();
277 myprocess.Refresh();
278 s.Value = Math.Round(Process.GetCurrentProcess().VirtualMemorySize64 / 1024.0 / 1024.0);
279 });
280 MakeStat("PeakProcessResident", null, "MB", ContainerProcess,
281 (s) =>
282 {
283 Process myprocess = Process.GetCurrentProcess();
284 myprocess.Refresh();
285 s.Value = Math.Round(Process.GetCurrentProcess().PeakWorkingSet64 / 1024.0 / 1024.0);
286 });
287 MakeStat("PeakProcessPaged", null, "MB", ContainerProcess,
288 (s) =>
289 {
290 Process myprocess = Process.GetCurrentProcess();
291 myprocess.Refresh();
292 s.Value = Math.Round(Process.GetCurrentProcess().PeakPagedMemorySize64 / 1024.0 / 1024.0);
293 });
294 MakeStat("PeakProcessVirtual", null, "MB", ContainerProcess,
295 (s) =>
296 {
297 Process myprocess = Process.GetCurrentProcess();
298 myprocess.Refresh();
299 s.Value = Math.Round(Process.GetCurrentProcess().PeakVirtualMemorySize64 / 1024.0 / 1024.0);
300 });
252 } 301 }
253 302
254 // Notes on performance counters: 303 // Notes on performance counters:
255 // "How To Read Performance Counters": http://blogs.msdn.com/b/bclteam/archive/2006/06/02/618156.aspx 304 // "How To Read Performance Counters": http://blogs.msdn.com/b/bclteam/archive/2006/06/02/618156.aspx
256 // "How to get the CPU Usage in C#": http://stackoverflow.com/questions/278071/how-to-get-the-cpu-usage-in-c 305 // "How to get the CPU Usage in C#": http://stackoverflow.com/questions/278071/how-to-get-the-cpu-usage-in-c
257 // "Mono Performance Counters": http://www.mono-project.com/Mono_Performance_Counters 306 // "Mono Performance Counters": http://www.mono-project.com/Mono_Performance_Counters