aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Monitoring
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Framework/Monitoring')
-rw-r--r--OpenSim/Framework/Monitoring/ServerStatsCollector.cs14
1 files changed, 4 insertions, 10 deletions
diff --git a/OpenSim/Framework/Monitoring/ServerStatsCollector.cs b/OpenSim/Framework/Monitoring/ServerStatsCollector.cs
index ac0f0bc..b4e0b16 100644
--- a/OpenSim/Framework/Monitoring/ServerStatsCollector.cs
+++ b/OpenSim/Framework/Monitoring/ServerStatsCollector.cs
@@ -141,7 +141,7 @@ namespace OpenSim.Framework.Monitoring
141 processorPercentPerfCounter = new PerfCounterControl(tempPC); 141 processorPercentPerfCounter = new PerfCounterControl(tempPC);
142 // A long time bug in mono is that CPU percent is reported as CPU percent idle. Windows reports CPU percent busy. 142 // A long time bug in mono is that CPU percent is reported as CPU percent idle. Windows reports CPU percent busy.
143 tempStat = new Stat(tempName, tempName, "", "percent", CategoryServer, ContainerProcessor, 143 tempStat = new Stat(tempName, tempName, "", "percent", CategoryServer, ContainerProcessor,
144 StatType.Pull, (s) => { GetNextValue(s, processorPercentPerfCounter, Util.IsWindows() ? 1 : -1); }, 144 StatType.Pull, (s) => { GetNextValue(s, processorPercentPerfCounter); },
145 StatVerbosity.Info); 145 StatVerbosity.Info);
146 StatsManager.RegisterStat(tempStat); 146 StatsManager.RegisterStat(tempStat);
147 RegisteredStats.Add(tempName, tempStat); 147 RegisteredStats.Add(tempName, tempStat);
@@ -253,28 +253,22 @@ namespace OpenSim.Framework.Monitoring
253 // "How to get the CPU Usage in C#": http://stackoverflow.com/questions/278071/how-to-get-the-cpu-usage-in-c 253 // "How to get the CPU Usage in C#": http://stackoverflow.com/questions/278071/how-to-get-the-cpu-usage-in-c
254 // "Mono Performance Counters": http://www.mono-project.com/Mono_Performance_Counters 254 // "Mono Performance Counters": http://www.mono-project.com/Mono_Performance_Counters
255 private delegate double PerfCounterNextValue(); 255 private delegate double PerfCounterNextValue();
256
256 private void GetNextValue(Stat stat, PerfCounterControl perfControl) 257 private void GetNextValue(Stat stat, PerfCounterControl perfControl)
257 { 258 {
258 GetNextValue(stat, perfControl, 1.0);
259 }
260 private void GetNextValue(Stat stat, PerfCounterControl perfControl, double factor)
261 {
262 if (Util.EnvironmentTickCountSubtract(perfControl.lastFetch) > performanceCounterSampleInterval) 259 if (Util.EnvironmentTickCountSubtract(perfControl.lastFetch) > performanceCounterSampleInterval)
263 { 260 {
264 if (perfControl != null && perfControl.perfCounter != null) 261 if (perfControl != null && perfControl.perfCounter != null)
265 { 262 {
266 try 263 try
267 { 264 {
268 // Kludge for factor to run double duty. If -1, subtract the value from one 265 stat.Value = perfControl.perfCounter.NextValue();
269 if (factor == -1)
270 stat.Value = 1 - perfControl.perfCounter.NextValue();
271 else
272 stat.Value = perfControl.perfCounter.NextValue() / factor;
273 } 266 }
274 catch (Exception e) 267 catch (Exception e)
275 { 268 {
276 m_log.ErrorFormat("{0} Exception on NextValue fetching {1}: {2}", LogHeader, stat.Name, e); 269 m_log.ErrorFormat("{0} Exception on NextValue fetching {1}: {2}", LogHeader, stat.Name, e);
277 } 270 }
271
278 perfControl.lastFetch = Util.EnvironmentTickCount(); 272 perfControl.lastFetch = Util.EnvironmentTickCount();
279 } 273 }
280 } 274 }