aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorSean Dague2008-04-16 10:54:32 +0000
committerSean Dague2008-04-16 10:54:32 +0000
commit1eb0fedd93b3ff70bb8e04dc2fa8df069b2a91f8 (patch)
tree6cc3a4b0a9ca9cdce0d5c27a785f65d4cb3595e4 /OpenSim
parent* Committing PumaCode SvnDotNet DLL library - a C# binding for SVN access. (diff)
downloadopensim-SC_OLD-1eb0fedd93b3ff70bb8e04dc2fa8df069b2a91f8.zip
opensim-SC_OLD-1eb0fedd93b3ff70bb8e04dc2fa8df069b2a91f8.tar.gz
opensim-SC_OLD-1eb0fedd93b3ff70bb8e04dc2fa8df069b2a91f8.tar.bz2
opensim-SC_OLD-1eb0fedd93b3ff70bb8e04dc2fa8df069b2a91f8.tar.xz
After reading Timer.cs in the mono source, I'm not
convinced that timer.Enabled modification is thread safe. I suspect the statsHeartBeat call to be one of our hot spots because is tries to synchronize not with a lock, but by disabling and enabling itself. I've replaced that with a lock in the hopes that this affects either the 100% bug, or the invoke_void bugs.
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/Environment/Scenes/SimStatsReporter.cs234
1 files changed, 118 insertions, 116 deletions
diff --git a/OpenSim/Region/Environment/Scenes/SimStatsReporter.cs b/OpenSim/Region/Environment/Scenes/SimStatsReporter.cs
index d72bee0..a53bfcd 100644
--- a/OpenSim/Region/Environment/Scenes/SimStatsReporter.cs
+++ b/OpenSim/Region/Environment/Scenes/SimStatsReporter.cs
@@ -138,127 +138,129 @@ namespace OpenSim.Region.Environment.Scenes
138 138
139 private void statsHeartBeat(object sender, EventArgs e) 139 private void statsHeartBeat(object sender, EventArgs e)
140 { 140 {
141 m_report.Enabled = false; 141 // Know what's not thread safe in Mono... modifying timers.
142 142 // System.Console.WriteLine("Firing Stats Heart Beat");
143 // Packet is already initialized and ready for data insert 143 lock (m_report)
144
145
146 statpack.Region = rb;
147 statpack.Region.RegionX = ReportingRegion.RegionLocX;
148 statpack.Region.RegionY = ReportingRegion.RegionLocY;
149 try
150 { 144 {
151 statpack.Region.RegionFlags = (uint) ReportingRegion.EstateSettings.regionFlags; 145 // Packet is already initialized and ready for data insert
152 } 146
153 catch (Exception) 147
154 { 148 statpack.Region = rb;
155 statpack.Region.RegionFlags = (uint) 0; 149 statpack.Region.RegionX = ReportingRegion.RegionLocX;
156 } 150 statpack.Region.RegionY = ReportingRegion.RegionLocY;
157 statpack.Region.ObjectCapacity = (uint) objectCapacity; 151 try
158 152 {
159 #region various statistic googly moogly 153 statpack.Region.RegionFlags = (uint) ReportingRegion.EstateSettings.regionFlags;
160 154 }
161 // Our FPS is actually 10fps, so multiplying by 5 to get the amount that people expect there 155 catch (Exception)
162 // 0-50 is pretty close to 0-45 156 {
163 float simfps = (int) ((m_fps * 5)); 157 statpack.Region.RegionFlags = (uint) 0;
164 158 }
165 //if (simfps > 45) 159 statpack.Region.ObjectCapacity = (uint) objectCapacity;
166 //simfps = simfps - (simfps - 45); 160
167 //if (simfps < 0) 161#region various statistic googly moogly
162
163 // Our FPS is actually 10fps, so multiplying by 5 to get the amount that people expect there
164 // 0-50 is pretty close to 0-45
165 float simfps = (int) ((m_fps * 5));
166
167 //if (simfps > 45)
168 //simfps = simfps - (simfps - 45);
169 //if (simfps < 0)
168 //simfps = 0; 170 //simfps = 0;
169 171
170 // 172 //
171 float physfps = ((m_pfps / 1000)); 173 float physfps = ((m_pfps / 1000));
172 174
173 //if (physfps > 600) 175 //if (physfps > 600)
174 //physfps = physfps - (physfps - 600); 176 //physfps = physfps - (physfps - 600);
175 177
176 if (physfps < 0) 178 if (physfps < 0)
177 physfps = 0; 179 physfps = 0;
178 180
179 #endregion 181#endregion
180 182
181 //Our time dilation is 0.91 when we're running a full speed, 183 //Our time dilation is 0.91 when we're running a full speed,
182 // therefore to make sure we get an appropriate range, 184 // therefore to make sure we get an appropriate range,
183 // we have to factor in our error. (0.10f * statsUpdateFactor) 185 // we have to factor in our error. (0.10f * statsUpdateFactor)
184 // multiplies the fix for the error times the amount of times it'll occur a second 186 // multiplies the fix for the error times the amount of times it'll occur a second
185 // / 10 divides the value by the number of times the sim heartbeat runs (10fps) 187 // / 10 divides the value by the number of times the sim heartbeat runs (10fps)
186 // Then we divide the whole amount by the amount of seconds pass in between stats updates. 188 // Then we divide the whole amount by the amount of seconds pass in between stats updates.
187 189
188 sb[0].StatID = (uint) Stats.TimeDilation; 190 sb[0].StatID = (uint) Stats.TimeDilation;
189 sb[0].StatValue = m_timeDilation ; //((((m_timeDilation + (0.10f * statsUpdateFactor)) /10) / statsUpdateFactor)); 191 sb[0].StatValue = m_timeDilation ; //((((m_timeDilation + (0.10f * statsUpdateFactor)) /10) / statsUpdateFactor));
190 192
191 sb[1].StatID = (uint) Stats.SimFPS; 193 sb[1].StatID = (uint) Stats.SimFPS;
192 sb[1].StatValue = simfps/statsUpdateFactor; 194 sb[1].StatValue = simfps/statsUpdateFactor;
193 195
194 sb[2].StatID = (uint) Stats.PhysicsFPS; 196 sb[2].StatID = (uint) Stats.PhysicsFPS;
195 sb[2].StatValue = physfps / statsUpdateFactor; 197 sb[2].StatValue = physfps / statsUpdateFactor;
196 198
197 sb[3].StatID = (uint) Stats.AgentUpdates; 199 sb[3].StatID = (uint) Stats.AgentUpdates;
198 sb[3].StatValue = (m_agentUpdates / statsUpdateFactor); 200 sb[3].StatValue = (m_agentUpdates / statsUpdateFactor);
199 201
200 sb[4].StatID = (uint) Stats.Agents; 202 sb[4].StatID = (uint) Stats.Agents;
201 sb[4].StatValue = m_rootAgents; 203 sb[4].StatValue = m_rootAgents;
202 204
203 sb[5].StatID = (uint) Stats.ChildAgents; 205 sb[5].StatID = (uint) Stats.ChildAgents;
204 sb[5].StatValue = m_childAgents; 206 sb[5].StatValue = m_childAgents;
205 207
206 sb[6].StatID = (uint) Stats.TotalPrim; 208 sb[6].StatID = (uint) Stats.TotalPrim;
207 sb[6].StatValue = m_numPrim; 209 sb[6].StatValue = m_numPrim;
208 210
209 sb[7].StatID = (uint) Stats.ActivePrim; 211 sb[7].StatID = (uint) Stats.ActivePrim;
210 sb[7].StatValue = m_activePrim; 212 sb[7].StatValue = m_activePrim;
211 213
212 sb[8].StatID = (uint)Stats.FrameMS; 214 sb[8].StatID = (uint)Stats.FrameMS;
213 sb[8].StatValue = m_frameMS / statsUpdateFactor; 215 sb[8].StatValue = m_frameMS / statsUpdateFactor;
214 216
215 sb[9].StatID = (uint)Stats.NetMS; 217 sb[9].StatID = (uint)Stats.NetMS;
216 sb[9].StatValue = m_netMS / statsUpdateFactor; 218 sb[9].StatValue = m_netMS / statsUpdateFactor;
217 219
218 sb[10].StatID = (uint)Stats.PhysicsMS; 220 sb[10].StatID = (uint)Stats.PhysicsMS;
219 sb[10].StatValue = m_physicsMS / statsUpdateFactor; 221 sb[10].StatValue = m_physicsMS / statsUpdateFactor;
220 222
221 sb[11].StatID = (uint)Stats.ImageMS ; 223 sb[11].StatID = (uint)Stats.ImageMS ;
222 sb[11].StatValue = m_imageMS / statsUpdateFactor; 224 sb[11].StatValue = m_imageMS / statsUpdateFactor;
223 225
224 sb[12].StatID = (uint)Stats.OtherMS; 226 sb[12].StatID = (uint)Stats.OtherMS;
225 sb[12].StatValue = m_otherMS / statsUpdateFactor; 227 sb[12].StatValue = m_otherMS / statsUpdateFactor;
226 228
227 sb[13].StatID = (uint)Stats.InPacketsPerSecond; 229 sb[13].StatID = (uint)Stats.InPacketsPerSecond;
228 sb[13].StatValue = (m_inPacketsPerSecond); 230 sb[13].StatValue = (m_inPacketsPerSecond);
229 231
230 sb[14].StatID = (uint)Stats.OutPacketsPerSecond; 232 sb[14].StatID = (uint)Stats.OutPacketsPerSecond;
231 sb[14].StatValue = (m_outPacketsPerSecond / statsUpdateFactor); 233 sb[14].StatValue = (m_outPacketsPerSecond / statsUpdateFactor);
232 234
233 sb[15].StatID = (uint)Stats.UnAckedBytes; 235 sb[15].StatID = (uint)Stats.UnAckedBytes;
234 sb[15].StatValue = m_unAckedBytes; 236 sb[15].StatValue = m_unAckedBytes;
235 237
236 sb[16].StatID = (uint)Stats.AgentMS; 238 sb[16].StatID = (uint)Stats.AgentMS;
237 sb[16].StatValue = m_agentMS / statsUpdateFactor; 239 sb[16].StatValue = m_agentMS / statsUpdateFactor;
238 240
239 sb[17].StatID = (uint)Stats.PendingDownloads; 241 sb[17].StatID = (uint)Stats.PendingDownloads;
240 sb[17].StatValue = m_pendingDownloads; 242 sb[17].StatValue = m_pendingDownloads;
241 243
242 sb[18].StatID = (uint)Stats.PendingUploads; 244 sb[18].StatID = (uint)Stats.PendingUploads;
243 sb[18].StatValue = m_pendingUploads; 245 sb[18].StatValue = m_pendingUploads;
244 246
245 sb[19].StatID = (uint)Stats.ActiveScripts; 247 sb[19].StatID = (uint)Stats.ActiveScripts;
246 sb[19].StatValue = m_activeScripts; 248 sb[19].StatValue = m_activeScripts;
247 249
248 sb[20].StatID = (uint)Stats.ScriptLinesPerSecond; 250 sb[20].StatID = (uint)Stats.ScriptLinesPerSecond;
249 sb[20].StatValue = m_scriptLinesPerSecond / statsUpdateFactor; 251 sb[20].StatValue = m_scriptLinesPerSecond / statsUpdateFactor;
250 252
251 statpack.Stat = sb; 253 statpack.Stat = sb;
252 254
253 handlerSendStatResult = OnSendStatsResult; 255 handlerSendStatResult = OnSendStatsResult;
254 if (handlerSendStatResult != null) 256 if (handlerSendStatResult != null)
255 { 257 {
256 handlerSendStatResult(statpack); 258 handlerSendStatResult(statpack);
259 }
260 resetvalues();
257 } 261 }
258 resetvalues();
259 m_report.Enabled = true;
260 } 262 }
261 263
262 private void resetvalues() 264 private void resetvalues()
263 { 265 {
264 m_timeDilation = 0; 266 m_timeDilation = 0;