aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Scenes/SimStatsReporter.cs
diff options
context:
space:
mode:
authorlbsa712007-12-27 21:41:48 +0000
committerlbsa712007-12-27 21:41:48 +0000
commitefd90b56b761219af6425b1c7a2cdd3b6ffb4de2 (patch)
treebf5b897e1e3c13211e3e2fc61d30508b94c928c0 /OpenSim/Region/Environment/Scenes/SimStatsReporter.cs
parent* removed always true if (diff)
downloadopensim-SC-efd90b56b761219af6425b1c7a2cdd3b6ffb4de2.zip
opensim-SC-efd90b56b761219af6425b1c7a2cdd3b6ffb4de2.tar.gz
opensim-SC-efd90b56b761219af6425b1c7a2cdd3b6ffb4de2.tar.bz2
opensim-SC-efd90b56b761219af6425b1c7a2cdd3b6ffb4de2.tar.xz
* Optimized usings
* shortened references * Removed redundant 'this' * Normalized EOF
Diffstat (limited to 'OpenSim/Region/Environment/Scenes/SimStatsReporter.cs')
-rw-r--r--OpenSim/Region/Environment/Scenes/SimStatsReporter.cs69
1 files changed, 38 insertions, 31 deletions
diff --git a/OpenSim/Region/Environment/Scenes/SimStatsReporter.cs b/OpenSim/Region/Environment/Scenes/SimStatsReporter.cs
index bfdacfe..b183c04 100644
--- a/OpenSim/Region/Environment/Scenes/SimStatsReporter.cs
+++ b/OpenSim/Region/Environment/Scenes/SimStatsReporter.cs
@@ -27,22 +27,19 @@
27*/ 27*/
28 28
29using System; 29using System;
30using System.Collections.Generic;
31using System.Text;
32using System.Timers; 30using System.Timers;
33using libsecondlife.Packets; 31using libsecondlife.Packets;
34using OpenSim.Framework; 32using OpenSim.Framework;
35using Timer = System.Timers.Timer;
36 33
37namespace OpenSim.Region.Environment.Scenes 34namespace OpenSim.Region.Environment.Scenes
38{ 35{
39 public class SimStatsReporter 36 public class SimStatsReporter
40 { 37 {
41 public delegate void SendStatResult(SimStatsPacket pack); 38 public delegate void SendStatResult(SimStatsPacket pack);
42 39
43 public event SendStatResult OnSendStatsResult; 40 public event SendStatResult OnSendStatsResult;
44 41
45 private enum Stats : uint 42 private enum Stats : uint
46 { 43 {
47 TimeDilation = 0, 44 TimeDilation = 0,
48 SimFPS = 1, 45 SimFPS = 1,
@@ -72,7 +69,7 @@ namespace OpenSim.Region.Environment.Scenes
72 private RegionInfo ReportingRegion; 69 private RegionInfo ReportingRegion;
73 70
74 private Timer m_report = new Timer(); 71 private Timer m_report = new Timer();
75 72
76 73
77 public SimStatsReporter(RegionInfo regionData) 74 public SimStatsReporter(RegionInfo regionData)
78 { 75 {
@@ -93,23 +90,24 @@ namespace OpenSim.Region.Environment.Scenes
93 statpack.Region.RegionY = ReportingRegion.RegionLocY; 90 statpack.Region.RegionY = ReportingRegion.RegionLocY;
94 try 91 try
95 { 92 {
96 statpack.Region.RegionFlags = (uint)ReportingRegion.EstateSettings.regionFlags; 93 statpack.Region.RegionFlags = (uint) ReportingRegion.EstateSettings.regionFlags;
97 } 94 }
98 catch(System.Exception) 95 catch (Exception)
99 { 96 {
100 statpack.Region.RegionFlags = (uint)0; 97 statpack.Region.RegionFlags = (uint) 0;
101 } 98 }
102 statpack.Region.ObjectCapacity = (uint)15000; 99 statpack.Region.ObjectCapacity = (uint) 15000;
103 100
104 #region various statistic googly moogly 101 #region various statistic googly moogly
105 float simfps = (int)(m_fps * 5); 102
103 float simfps = (int) (m_fps*5);
106 104
107 if (simfps > 45) 105 if (simfps > 45)
108 simfps = simfps - (simfps - 45); 106 simfps = simfps - (simfps - 45);
109 if (simfps < 0) 107 if (simfps < 0)
110 simfps = 0; 108 simfps = 0;
111 109
112 float physfps = (m_pfps / statsUpdatesEveryMS); 110 float physfps = (m_pfps/statsUpdatesEveryMS);
113 111
114 if (physfps > 50) 112 if (physfps > 50)
115 physfps = physfps - (physfps - 50); 113 physfps = physfps - (physfps - 50);
@@ -120,49 +118,49 @@ namespace OpenSim.Region.Environment.Scenes
120 #endregion 118 #endregion
121 119
122 sb[0] = new SimStatsPacket.StatBlock(); 120 sb[0] = new SimStatsPacket.StatBlock();
123 sb[0].StatID = (uint)Stats.TimeDilation; 121 sb[0].StatID = (uint) Stats.TimeDilation;
124 sb[0].StatValue = (m_timeDilation); 122 sb[0].StatValue = (m_timeDilation);
125 123
126 sb[1] = new SimStatsPacket.StatBlock(); 124 sb[1] = new SimStatsPacket.StatBlock();
127 sb[1].StatID = (uint)Stats.SimFPS; 125 sb[1].StatID = (uint) Stats.SimFPS;
128 sb[1].StatValue = simfps; 126 sb[1].StatValue = simfps;
129 127
130 sb[2] = new SimStatsPacket.StatBlock(); 128 sb[2] = new SimStatsPacket.StatBlock();
131 sb[2].StatID = (uint)Stats.PhysicsFPS; 129 sb[2].StatID = (uint) Stats.PhysicsFPS;
132 sb[2].StatValue = physfps; 130 sb[2].StatValue = physfps;
133 131
134 sb[3] = new SimStatsPacket.StatBlock(); 132 sb[3] = new SimStatsPacket.StatBlock();
135 sb[3].StatID = (uint)Stats.AgentUpdates; 133 sb[3].StatID = (uint) Stats.AgentUpdates;
136 sb[3].StatValue = (m_agentUpdates / statsUpdatesEveryMS); 134 sb[3].StatValue = (m_agentUpdates/statsUpdatesEveryMS);
137 135
138 sb[4] = new SimStatsPacket.StatBlock(); 136 sb[4] = new SimStatsPacket.StatBlock();
139 sb[4].StatID = (uint)Stats.Agents; 137 sb[4].StatID = (uint) Stats.Agents;
140 sb[4].StatValue = m_rootAgents; 138 sb[4].StatValue = m_rootAgents;
141 139
142 sb[5] = new SimStatsPacket.StatBlock(); 140 sb[5] = new SimStatsPacket.StatBlock();
143 sb[5].StatID = (uint)Stats.ChildAgents; 141 sb[5].StatID = (uint) Stats.ChildAgents;
144 sb[5].StatValue = m_childAgents; 142 sb[5].StatValue = m_childAgents;
145 143
146 sb[6] = new SimStatsPacket.StatBlock(); 144 sb[6] = new SimStatsPacket.StatBlock();
147 sb[6].StatID = (uint)Stats.TotalPrim; 145 sb[6].StatID = (uint) Stats.TotalPrim;
148 sb[6].StatValue = m_numPrim; 146 sb[6].StatValue = m_numPrim;
149 147
150 sb[7] = new SimStatsPacket.StatBlock(); 148 sb[7] = new SimStatsPacket.StatBlock();
151 sb[7].StatID = (uint)Stats.ActivePrim; 149 sb[7].StatID = (uint) Stats.ActivePrim;
152 sb[7].StatValue = m_activePrim; 150 sb[7].StatValue = m_activePrim;
153 151
154 sb[8] = new SimStatsPacket.StatBlock(); 152 sb[8] = new SimStatsPacket.StatBlock();
155 sb[8].StatID = (uint)Stats.InPacketsPerSecond; 153 sb[8].StatID = (uint) Stats.InPacketsPerSecond;
156 sb[8].StatValue = (int)(m_inPacketsPerSecond / statsUpdatesEveryMS); 154 sb[8].StatValue = (int) (m_inPacketsPerSecond/statsUpdatesEveryMS);
157 155
158 sb[9] = new SimStatsPacket.StatBlock(); 156 sb[9] = new SimStatsPacket.StatBlock();
159 sb[9].StatID = (uint)Stats.OutPacketsPerSecond; 157 sb[9].StatID = (uint) Stats.OutPacketsPerSecond;
160 sb[9].StatValue = (int)(m_outPacketsPerSecond / statsUpdatesEveryMS); 158 sb[9].StatValue = (int) (m_outPacketsPerSecond/statsUpdatesEveryMS);
161 159
162 sb[10] = new SimStatsPacket.StatBlock(); 160 sb[10] = new SimStatsPacket.StatBlock();
163 sb[10].StatID = (uint)Stats.UnAckedBytes; 161 sb[10].StatID = (uint) Stats.UnAckedBytes;
164 sb[10].StatValue = (int) (m_unAckedBytes / statsUpdatesEveryMS); 162 sb[10].StatValue = (int) (m_unAckedBytes/statsUpdatesEveryMS);
165 163
166 statpack.Stat = sb; 164 statpack.Stat = sb;
167 165
168 if (OnSendStatsResult != null) 166 if (OnSendStatsResult != null)
@@ -181,8 +179,8 @@ namespace OpenSim.Region.Environment.Scenes
181 m_inPacketsPerSecond = 0; 179 m_inPacketsPerSecond = 0;
182 m_outPacketsPerSecond = 0; 180 m_outPacketsPerSecond = 0;
183 m_unAckedBytes = 0; 181 m_unAckedBytes = 0;
184
185 } 182 }
183
186 public void SetTimeDilation(float td) 184 public void SetTimeDilation(float td)
187 { 185 {
188 m_timeDilation = td; 186 m_timeDilation = td;
@@ -191,47 +189,56 @@ namespace OpenSim.Region.Environment.Scenes
191 189
192 if (m_timeDilation < 0) 190 if (m_timeDilation < 0)
193 m_timeDilation = 0.0f; 191 m_timeDilation = 0.0f;
194
195 } 192 }
193
196 public void SetRootAgents(int rootAgents) 194 public void SetRootAgents(int rootAgents)
197 { 195 {
198 m_rootAgents = rootAgents; 196 m_rootAgents = rootAgents;
199 } 197 }
198
200 public void SetChildAgents(int childAgents) 199 public void SetChildAgents(int childAgents)
201 { 200 {
202 m_childAgents = childAgents; 201 m_childAgents = childAgents;
203 } 202 }
203
204 public void SetObjects(int objects) 204 public void SetObjects(int objects)
205 { 205 {
206 m_numPrim = objects; 206 m_numPrim = objects;
207 } 207 }
208
208 public void SetActiveObjects(int objects) 209 public void SetActiveObjects(int objects)
209 { 210 {
210 m_activePrim = objects; 211 m_activePrim = objects;
211 } 212 }
213
212 public void AddFPS(int frames) 214 public void AddFPS(int frames)
213 { 215 {
214 m_fps += frames; 216 m_fps += frames;
215 } 217 }
218
216 public void AddPhysicsFPS(float frames) 219 public void AddPhysicsFPS(float frames)
217 { 220 {
218 m_pfps += frames; 221 m_pfps += frames;
219 } 222 }
223
220 public void AddAgentUpdates(float numUpdates) 224 public void AddAgentUpdates(float numUpdates)
221 { 225 {
222 m_agentUpdates += numUpdates; 226 m_agentUpdates += numUpdates;
223 } 227 }
228
224 public void AddInPackets(int numPackets) 229 public void AddInPackets(int numPackets)
225 { 230 {
226 m_inPacketsPerSecond += numPackets; 231 m_inPacketsPerSecond += numPackets;
227 } 232 }
233
228 public void AddOutPackets(int numPackets) 234 public void AddOutPackets(int numPackets)
229 { 235 {
230 m_outPacketsPerSecond += numPackets; 236 m_outPacketsPerSecond += numPackets;
231 } 237 }
238
232 public void AddunAckedBytes(int numBytes) 239 public void AddunAckedBytes(int numBytes)
233 { 240 {
234 m_unAckedBytes += numBytes; 241 m_unAckedBytes += numBytes;
235 } 242 }
236 } 243 }
237} 244} \ No newline at end of file