diff options
author | Teravus Ovares | 2008-01-16 19:34:48 +0000 |
---|---|---|
committer | Teravus Ovares | 2008-01-16 19:34:48 +0000 |
commit | c3061717d0328c4d408b834606c4ddeea12d5662 (patch) | |
tree | 5616f50ee0fd3f83965f6e378b307ef32f632724 /OpenSim/Region | |
parent | * Store task inventory when an object is taken into agent inventory (diff) | |
download | opensim-SC-c3061717d0328c4d408b834606c4ddeea12d5662.zip opensim-SC-c3061717d0328c4d408b834606c4ddeea12d5662.tar.gz opensim-SC-c3061717d0328c4d408b834606c4ddeea12d5662.tar.bz2 opensim-SC-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')
-rw-r--r-- | OpenSim/Region/ClientStack/ClientView.cs | 14 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/Scene.cs | 2 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/SimStatsReporter.cs | 50 |
3 files changed, 36 insertions, 30 deletions
diff --git a/OpenSim/Region/ClientStack/ClientView.cs b/OpenSim/Region/ClientStack/ClientView.cs index 0a291a8..414c81e 100644 --- a/OpenSim/Region/ClientStack/ClientView.cs +++ b/OpenSim/Region/ClientStack/ClientView.cs | |||
@@ -65,11 +65,11 @@ namespace OpenSim.Region.ClientStack | |||
65 | private Timer m_clientPingTimer; | 65 | private Timer m_clientPingTimer; |
66 | 66 | ||
67 | private int m_packetsReceived = 0; | 67 | private int m_packetsReceived = 0; |
68 | private int m_lastpacketsSentToScene = 0; | 68 | private int m_lastPacketsReceivedSentToScene = 0; |
69 | private int m_unAckedBytes = 0; | 69 | private int m_unAckedBytes = 0; |
70 | 70 | ||
71 | private int m_packetsSent = 0; | 71 | private int m_packetsSent = 0; |
72 | private int m_lastPacketsSent = 0; | 72 | private int m_lastPacketsSentSentToScene = 0; |
73 | 73 | ||
74 | private int m_probesWithNoIngressPackets = 0; | 74 | private int m_probesWithNoIngressPackets = 0; |
75 | private int m_lastPacketsReceived = 0; | 75 | private int m_lastPacketsReceived = 0; |
@@ -426,7 +426,7 @@ namespace OpenSim.Region.ClientStack | |||
426 | m_lastPacketsReceived = m_packetsReceived; | 426 | m_lastPacketsReceived = m_packetsReceived; |
427 | 427 | ||
428 | } | 428 | } |
429 | SendPacketStats(); | 429 | //SendPacketStats(); |
430 | } | 430 | } |
431 | 431 | ||
432 | # region Setup | 432 | # region Setup |
@@ -2503,7 +2503,7 @@ namespace OpenSim.Region.ClientStack | |||
2503 | 2503 | ||
2504 | SendAcks(); | 2504 | SendAcks(); |
2505 | ResendUnacked(); | 2505 | ResendUnacked(); |
2506 | 2506 | SendPacketStats(); | |
2507 | 2507 | ||
2508 | } | 2508 | } |
2509 | 2509 | ||
@@ -2511,9 +2511,9 @@ namespace OpenSim.Region.ClientStack | |||
2511 | { | 2511 | { |
2512 | if (OnPacketStats != null) | 2512 | if (OnPacketStats != null) |
2513 | { | 2513 | { |
2514 | OnPacketStats(m_packetsReceived - m_lastPacketsReceived, m_packetsSent - m_lastPacketsSent, m_unAckedBytes); | 2514 | OnPacketStats(m_packetsReceived - m_lastPacketsReceivedSentToScene, m_packetsSent - m_lastPacketsSentSentToScene, m_unAckedBytes); |
2515 | m_lastPacketsReceived = m_packetsReceived; | 2515 | m_lastPacketsReceivedSentToScene = m_packetsReceived; |
2516 | m_lastPacketsSent = m_packetsSent; | 2516 | m_lastPacketsSentSentToScene = m_packetsSent; |
2517 | } | 2517 | } |
2518 | } | 2518 | } |
2519 | 2519 | ||
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 | } |