aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Scenes
diff options
context:
space:
mode:
authorTeravus Ovares2008-01-16 19:34:48 +0000
committerTeravus Ovares2008-01-16 19:34:48 +0000
commitc3061717d0328c4d408b834606c4ddeea12d5662 (patch)
tree5616f50ee0fd3f83965f6e378b307ef32f632724 /OpenSim/Region/Environment/Scenes
parent* Store task inventory when an object is taken into agent inventory (diff)
downloadopensim-SC_OLD-c3061717d0328c4d408b834606c4ddeea12d5662.zip
opensim-SC_OLD-c3061717d0328c4d408b834606c4ddeea12d5662.tar.gz
opensim-SC_OLD-c3061717d0328c4d408b834606c4ddeea12d5662.tar.bz2
opensim-SC_OLD-c3061717d0328c4d408b834606c4ddeea12d5662.tar.xz
* Fixed a packet counting issue that I introduced
* Fixed a bunch of goofy math for calculating the sim stats counters * Made most of the sim stats counters additive so it's easy to change the sim stats interval * Changed the sim stats send interval to 3 seconds
Diffstat (limited to 'OpenSim/Region/Environment/Scenes')
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs2
-rw-r--r--OpenSim/Region/Environment/Scenes/SimStatsReporter.cs50
2 files changed, 29 insertions, 23 deletions
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index f1a1843..449e1d2 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -605,7 +605,7 @@ namespace OpenSim.Region.Environment.Scenes
605 // if (m_frame%m_update_avatars == 0) 605 // if (m_frame%m_update_avatars == 0)
606 // UpdateInWorldTime(); 606 // UpdateInWorldTime();
607 m_statsReporter.AddPhysicsFPS(physicsFPS); 607 m_statsReporter.AddPhysicsFPS(physicsFPS);
608 m_statsReporter.SetTimeDilation(m_timedilation); 608 m_statsReporter.AddTimeDilation(m_timedilation);
609 m_statsReporter.AddFPS(1); 609 m_statsReporter.AddFPS(1);
610 m_statsReporter.AddInPackets(0); 610 m_statsReporter.AddInPackets(0);
611 m_statsReporter.SetRootAgents(m_innerScene.GetRootAgentCount()); 611 m_statsReporter.SetRootAgents(m_innerScene.GetRootAgentCount());
diff --git a/OpenSim/Region/Environment/Scenes/SimStatsReporter.cs b/OpenSim/Region/Environment/Scenes/SimStatsReporter.cs
index d4af90c..150c519 100644
--- a/OpenSim/Region/Environment/Scenes/SimStatsReporter.cs
+++ b/OpenSim/Region/Environment/Scenes/SimStatsReporter.cs
@@ -62,8 +62,9 @@ namespace OpenSim.Region.Environment.Scenes
62 UnAckedBytes = 24 62 UnAckedBytes = 24
63 } 63 }
64 64
65 private int statsUpdatesEveryMS = 5000; 65 // Sending a stats update every 3 seconds
66 private int statsUpdateFactor = 0; 66 private int statsUpdatesEveryMS = 3000;
67 private float statsUpdateFactor = 0;
67 private float m_timeDilation = 0; 68 private float m_timeDilation = 0;
68 private int m_fps = 0; 69 private int m_fps = 0;
69 private float m_pfps = 0; 70 private float m_pfps = 0;
@@ -97,7 +98,8 @@ namespace OpenSim.Region.Environment.Scenes
97 98
98 public SimStatsReporter(RegionInfo regionData) 99 public SimStatsReporter(RegionInfo regionData)
99 { 100 {
100 statsUpdateFactor = (int)(statsUpdatesEveryMS / 1000); 101
102 statsUpdateFactor = (float)(statsUpdatesEveryMS / 1000);
101 ReportingRegion = regionData; 103 ReportingRegion = regionData;
102 for (int i = 0; i<19;i++) 104 for (int i = 0; i<19;i++)
103 { 105 {
@@ -131,6 +133,8 @@ namespace OpenSim.Region.Environment.Scenes
131 133
132 #region various statistic googly moogly 134 #region various statistic googly moogly
133 135
136 // Our FPS is actually 10fps, so multiplying by 5 to get the amount that people expect there
137 // 0-50 is pretty close to 0-45
134 float simfps = (int) ((m_fps * 5)); 138 float simfps = (int) ((m_fps * 5));
135 139
136 //if (simfps > 45) 140 //if (simfps > 45)
@@ -138,6 +142,7 @@ namespace OpenSim.Region.Environment.Scenes
138 //if (simfps < 0) 142 //if (simfps < 0)
139 //simfps = 0; 143 //simfps = 0;
140 144
145 //
141 float physfps = ((m_pfps / 1000)); 146 float physfps = ((m_pfps / 1000));
142 147
143 //if (physfps > 600) 148 //if (physfps > 600)
@@ -148,35 +153,34 @@ namespace OpenSim.Region.Environment.Scenes
148 153
149 #endregion 154 #endregion
150 155
151 //sb[0] = sbb; 156 //Our time dilation is 0.91 when we're running a full speed,
157 // therefore to make sure we get an appropriate range,
158 // we have to factor in our error. (0.10f * statsUpdateFactor)
159 // multiplies the fix for the error times the amount of times it'll occur a second
160 // / 10 divides the value by the number of times the sim heartbeat runs (10fps)
161 // Then we divide the whole amount by the amount of seconds pass in between stats updates.
162
152 sb[0].StatID = (uint) Stats.TimeDilation; 163 sb[0].StatID = (uint) Stats.TimeDilation;
153 sb[0].StatValue = ((m_timeDilation / statsUpdateFactor)); 164 sb[0].StatValue = ((((m_timeDilation + (0.10f * statsUpdateFactor)) /10) / statsUpdateFactor));
154 165
155 //sb[1] = sbb;
156 sb[1].StatID = (uint) Stats.SimFPS; 166 sb[1].StatID = (uint) Stats.SimFPS;
157 sb[1].StatValue = simfps/statsUpdateFactor; 167 sb[1].StatValue = simfps/statsUpdateFactor;
158 168
159 //sb[2] = sbb;
160 sb[2].StatID = (uint) Stats.PhysicsFPS; 169 sb[2].StatID = (uint) Stats.PhysicsFPS;
161 sb[2].StatValue = physfps / statsUpdateFactor; 170 sb[2].StatValue = physfps / statsUpdateFactor;
162 171
163 //sb[3] = sbb;
164 sb[3].StatID = (uint) Stats.AgentUpdates; 172 sb[3].StatID = (uint) Stats.AgentUpdates;
165 sb[3].StatValue = (m_agentUpdates / statsUpdateFactor); 173 sb[3].StatValue = (m_agentUpdates / statsUpdateFactor);
166 174
167 //sb[4] = sbb;
168 sb[4].StatID = (uint) Stats.Agents; 175 sb[4].StatID = (uint) Stats.Agents;
169 sb[4].StatValue = m_rootAgents; 176 sb[4].StatValue = m_rootAgents;
170 177
171 //sb[5] = sbb;
172 sb[5].StatID = (uint) Stats.ChildAgents; 178 sb[5].StatID = (uint) Stats.ChildAgents;
173 sb[5].StatValue = m_childAgents; 179 sb[5].StatValue = m_childAgents;
174 180
175 //sb[6] = sbb;
176 sb[6].StatID = (uint) Stats.TotalPrim; 181 sb[6].StatID = (uint) Stats.TotalPrim;
177 sb[6].StatValue = m_numPrim; 182 sb[6].StatValue = m_numPrim;
178 183
179 //sb[7] = sbb;
180 sb[7].StatID = (uint) Stats.ActivePrim; 184 sb[7].StatID = (uint) Stats.ActivePrim;
181 sb[7].StatValue = m_activePrim; 185 sb[7].StatValue = m_activePrim;
182 186
@@ -195,15 +199,12 @@ namespace OpenSim.Region.Environment.Scenes
195 sb[12].StatID = (uint)Stats.OtherMS; 199 sb[12].StatID = (uint)Stats.OtherMS;
196 sb[12].StatValue = m_otherMS / statsUpdateFactor; 200 sb[12].StatValue = m_otherMS / statsUpdateFactor;
197 201
198 //sb[8] = sbb;
199 sb[13].StatID = (uint)Stats.InPacketsPerSecond; 202 sb[13].StatID = (uint)Stats.InPacketsPerSecond;
200 sb[13].StatValue = (m_inPacketsPerSecond); 203 sb[13].StatValue = (m_inPacketsPerSecond);
201 204
202 //sb[9] = sbb;
203 sb[14].StatID = (uint)Stats.OutPacketsPerSecond; 205 sb[14].StatID = (uint)Stats.OutPacketsPerSecond;
204 sb[14].StatValue = (m_outPacketsPerSecond / statsUpdateFactor); 206 sb[14].StatValue = (m_outPacketsPerSecond / statsUpdateFactor);
205 207
206 //sb[10] = sbb;
207 sb[15].StatID = (uint)Stats.UnAckedBytes; 208 sb[15].StatID = (uint)Stats.UnAckedBytes;
208 sb[15].StatValue = m_unAckedBytes; 209 sb[15].StatValue = m_unAckedBytes;
209 210
@@ -243,16 +244,19 @@ namespace OpenSim.Region.Environment.Scenes
243 m_otherMS = 0; 244 m_otherMS = 0;
244 } 245 }
245 246
246 247 # region methods called from Scene
248 // The majority of these functions are additive
249 // so that you can easily change the amount of
250 // seconds in between sim stats updates
247 251
248 public void SetTimeDilation(float td) 252 public void AddTimeDilation(float td)
249 { 253 {
250 float tdsetting = td; 254 float tdsetting = td;
251 //if (tdsetting > 1.0f) 255 if (tdsetting > 1.0f)
252 //tdsetting = (tdsetting - (tdsetting - 0.91f)); 256 tdsetting = (tdsetting - (tdsetting - 0.91f));
253 257
254 //if (tdsetting < 0) 258 if (tdsetting < 0)
255 //tdsetting = 0.0f; 259 tdsetting = 0.0f;
256 m_timeDilation += tdsetting; 260 m_timeDilation += tdsetting;
257 } 261 }
258 262
@@ -334,6 +338,8 @@ namespace OpenSim.Region.Environment.Scenes
334 { 338 {
335 m_pendingDownloads += count; 339 m_pendingDownloads += count;
336 } 340 }
337 341
342 #endregion
343
338 } 344 }
339} 345}