diff options
author | Teravus Ovares | 2008-01-16 02:48:39 +0000 |
---|---|---|
committer | Teravus Ovares | 2008-01-16 02:48:39 +0000 |
commit | 314c554ed40fe015397cf0fa6981e47b5025b6f8 (patch) | |
tree | 7337f1b63bc207809306c1967559577479e448ec /OpenSim/Region/Environment/Scenes | |
parent | * Restore non dash asset UUID persistence which was made dashed in r3069 (diff) | |
download | opensim-SC_OLD-314c554ed40fe015397cf0fa6981e47b5025b6f8.zip opensim-SC_OLD-314c554ed40fe015397cf0fa6981e47b5025b6f8.tar.gz opensim-SC_OLD-314c554ed40fe015397cf0fa6981e47b5025b6f8.tar.bz2 opensim-SC_OLD-314c554ed40fe015397cf0fa6981e47b5025b6f8.tar.xz |
* Refactored the SimStatsReporter to reuse the same packet and packet blocks over and over again instead of creating 1 a second.
* Added frame Milliseconds, Physics Milliseconds and Other Milliseconds to the Sim Stats Reporter so we can start to figure out what the slowdowns are. (these were the most convenient to get and had just about no overhead.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/Scene.cs | 23 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/SceneObjectPart.cs | 2 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/SimStatsReporter.cs | 110 |
3 files changed, 110 insertions, 25 deletions
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 86f43b3..9af43f5 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs | |||
@@ -125,6 +125,12 @@ namespace OpenSim.Region.Environment.Scenes | |||
125 | private int m_update_land = 1; | 125 | private int m_update_land = 1; |
126 | private int m_update_avatars = 1; | 126 | private int m_update_avatars = 1; |
127 | 127 | ||
128 | private int frameMS = 0; | ||
129 | private int physicsMS2 = 0; | ||
130 | private int physicsMS = 0; | ||
131 | private int otherMS = 0; | ||
132 | |||
133 | |||
128 | #endregion | 134 | #endregion |
129 | 135 | ||
130 | #region Properties | 136 | #region Properties |
@@ -551,6 +557,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
551 | // Aquire a lock so only one update call happens at once | 557 | // Aquire a lock so only one update call happens at once |
552 | updateLock.WaitOne(); | 558 | updateLock.WaitOne(); |
553 | float physicsFPS = 0; | 559 | float physicsFPS = 0; |
560 | |||
561 | frameMS = System.Environment.TickCount; | ||
554 | try | 562 | try |
555 | { | 563 | { |
556 | // Increment the frame counter | 564 | // Increment the frame counter |
@@ -559,18 +567,26 @@ namespace OpenSim.Region.Environment.Scenes | |||
559 | // Loop it | 567 | // Loop it |
560 | if (m_frame == Int32.MaxValue) | 568 | if (m_frame == Int32.MaxValue) |
561 | m_frame = 0; | 569 | m_frame = 0; |
570 | |||
562 | 571 | ||
572 | physicsMS2 = System.Environment.TickCount; | ||
563 | if (m_frame%m_update_physics == 0) | 573 | if (m_frame%m_update_physics == 0) |
564 | m_innerScene.UpdatePreparePhysics(); | 574 | m_innerScene.UpdatePreparePhysics(); |
575 | physicsMS2 = System.Environment.TickCount - physicsMS2; | ||
565 | 576 | ||
566 | if (m_frame%m_update_entitymovement == 0) | 577 | if (m_frame%m_update_entitymovement == 0) |
567 | m_innerScene.UpdateEntityMovement(); | 578 | m_innerScene.UpdateEntityMovement(); |
568 | 579 | ||
580 | physicsMS = System.Environment.TickCount; | ||
569 | if (m_frame%m_update_physics == 0) | 581 | if (m_frame%m_update_physics == 0) |
570 | physicsFPS = m_innerScene.UpdatePhysics( | 582 | physicsFPS = m_innerScene.UpdatePhysics( |
571 | Math.Max(SinceLastFrame.TotalSeconds, m_timespan) | 583 | Math.Max(SinceLastFrame.TotalSeconds, m_timespan) |
572 | ); | 584 | ); |
585 | |||
586 | physicsMS = System.Environment.TickCount - physicsMS; | ||
587 | physicsMS += physicsMS2; | ||
573 | 588 | ||
589 | otherMS = System.Environment.TickCount; | ||
574 | if (m_frame%m_update_entities == 0) | 590 | if (m_frame%m_update_entities == 0) |
575 | m_innerScene.UpdateEntities(); | 591 | m_innerScene.UpdateEntities(); |
576 | 592 | ||
@@ -585,7 +601,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
585 | 601 | ||
586 | if (m_frame%m_update_land == 0) | 602 | if (m_frame%m_update_land == 0) |
587 | UpdateLand(); | 603 | UpdateLand(); |
588 | 604 | otherMS = System.Environment.TickCount - otherMS; | |
589 | // if (m_frame%m_update_avatars == 0) | 605 | // if (m_frame%m_update_avatars == 0) |
590 | // UpdateInWorldTime(); | 606 | // UpdateInWorldTime(); |
591 | m_statsReporter.AddPhysicsFPS(physicsFPS); | 607 | m_statsReporter.AddPhysicsFPS(physicsFPS); |
@@ -597,6 +613,11 @@ namespace OpenSim.Region.Environment.Scenes | |||
597 | m_statsReporter.SetChildAgents(m_innerScene.GetChildAgentCount()); | 613 | m_statsReporter.SetChildAgents(m_innerScene.GetChildAgentCount()); |
598 | m_statsReporter.SetObjects(m_innerScene.GetTotalObjects()); | 614 | m_statsReporter.SetObjects(m_innerScene.GetTotalObjects()); |
599 | m_statsReporter.SetActiveObjects(m_innerScene.GetActiveObjects()); | 615 | m_statsReporter.SetActiveObjects(m_innerScene.GetActiveObjects()); |
616 | frameMS = System.Environment.TickCount - frameMS; | ||
617 | m_statsReporter.addFrameMS(frameMS); | ||
618 | m_statsReporter.addPhysicsMS(physicsMS); | ||
619 | m_statsReporter.addOtherMS(otherMS); | ||
620 | |||
600 | } | 621 | } |
601 | catch (NotImplementedException) | 622 | catch (NotImplementedException) |
602 | { | 623 | { |
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs index 60ea480..660deaf 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs | |||
@@ -327,7 +327,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
327 | } | 327 | } |
328 | else | 328 | else |
329 | { | 329 | { |
330 | // Child prim we have to calculate it's world rotation | 330 | // Child prim we have to calculate it's world rotationwel |
331 | LLQuaternion resultingrotation = GetWorldRotation(); | 331 | LLQuaternion resultingrotation = GetWorldRotation(); |
332 | PhysActor.Orientation = new Quaternion(resultingrotation.W, resultingrotation.X, resultingrotation.Y, resultingrotation.Z); | 332 | PhysActor.Orientation = new Quaternion(resultingrotation.W, resultingrotation.X, resultingrotation.Y, resultingrotation.Z); |
333 | //MainLog.Instance.Verbose("PART", "RO2:" + PhysActor.Orientation.ToString()); | 333 | //MainLog.Instance.Verbose("PART", "RO2:" + PhysActor.Orientation.ToString()); |
diff --git a/OpenSim/Region/Environment/Scenes/SimStatsReporter.cs b/OpenSim/Region/Environment/Scenes/SimStatsReporter.cs index 1b2ff9a..36c2868 100644 --- a/OpenSim/Region/Environment/Scenes/SimStatsReporter.cs +++ b/OpenSim/Region/Environment/Scenes/SimStatsReporter.cs | |||
@@ -45,6 +45,12 @@ namespace OpenSim.Region.Environment.Scenes | |||
45 | SimFPS = 1, | 45 | SimFPS = 1, |
46 | PhysicsFPS = 2, | 46 | PhysicsFPS = 2, |
47 | AgentUpdates = 3, | 47 | AgentUpdates = 3, |
48 | FrameMS = 4, | ||
49 | NetMS = 5, | ||
50 | OtherMS = 6, | ||
51 | PhysicsMS = 7, | ||
52 | AgentMS = 8, | ||
53 | ImageMS = 9, | ||
48 | TotalPrim = 11, | 54 | TotalPrim = 11, |
49 | ActivePrim = 12, | 55 | ActivePrim = 12, |
50 | Agents = 13, | 56 | Agents = 13, |
@@ -59,6 +65,11 @@ namespace OpenSim.Region.Environment.Scenes | |||
59 | private int m_fps = 0; | 65 | private int m_fps = 0; |
60 | private float m_pfps = 0; | 66 | private float m_pfps = 0; |
61 | private float m_agentUpdates = 0; | 67 | private float m_agentUpdates = 0; |
68 | private int m_frameMS = 0; | ||
69 | private int m_netMS = 0; | ||
70 | private int m_physicsMS = 0; | ||
71 | private int m_imageMS = 0; | ||
72 | private int m_otherMS = 0; | ||
62 | private int m_rootAgents = 0; | 73 | private int m_rootAgents = 0; |
63 | private int m_childAgents = 0; | 74 | private int m_childAgents = 0; |
64 | private int m_numPrim = 0; | 75 | private int m_numPrim = 0; |
@@ -66,6 +77,12 @@ namespace OpenSim.Region.Environment.Scenes | |||
66 | private int m_outPacketsPerSecond = 0; | 77 | private int m_outPacketsPerSecond = 0; |
67 | private int m_activePrim = 0; | 78 | private int m_activePrim = 0; |
68 | private int m_unAckedBytes = 0; | 79 | private int m_unAckedBytes = 0; |
80 | |||
81 | SimStatsPacket.StatBlock[] sb = new SimStatsPacket.StatBlock[16]; | ||
82 | SimStatsPacket.RegionBlock rb = new SimStatsPacket.RegionBlock(); | ||
83 | SimStatsPacket statpack = (SimStatsPacket)PacketPool.Instance.GetPacket(PacketType.SimStats); | ||
84 | |||
85 | |||
69 | private RegionInfo ReportingRegion; | 86 | private RegionInfo ReportingRegion; |
70 | 87 | ||
71 | private Timer m_report = new Timer(); | 88 | private Timer m_report = new Timer(); |
@@ -74,6 +91,10 @@ namespace OpenSim.Region.Environment.Scenes | |||
74 | public SimStatsReporter(RegionInfo regionData) | 91 | public SimStatsReporter(RegionInfo regionData) |
75 | { | 92 | { |
76 | ReportingRegion = regionData; | 93 | ReportingRegion = regionData; |
94 | for (int i = 0; i<16;i++) | ||
95 | { | ||
96 | sb[i] = new SimStatsPacket.StatBlock(); | ||
97 | } | ||
77 | m_report.AutoReset = true; | 98 | m_report.AutoReset = true; |
78 | m_report.Interval = statsUpdatesEveryMS; | 99 | m_report.Interval = statsUpdatesEveryMS; |
79 | m_report.Elapsed += new ElapsedEventHandler(statsHeartBeat); | 100 | m_report.Elapsed += new ElapsedEventHandler(statsHeartBeat); |
@@ -83,11 +104,11 @@ namespace OpenSim.Region.Environment.Scenes | |||
83 | private void statsHeartBeat(object sender, EventArgs e) | 104 | private void statsHeartBeat(object sender, EventArgs e) |
84 | { | 105 | { |
85 | m_report.Enabled = false; | 106 | m_report.Enabled = false; |
86 | SimStatsPacket statpack = (SimStatsPacket) PacketPool.Instance.GetPacket(PacketType.SimStats); | 107 | |
87 | // TODO: don't create new blocks if recycling an old packet | 108 | // Packet is already initialized and ready for data insert |
88 | 109 | ||
89 | SimStatsPacket.StatBlock[] sb = new SimStatsPacket.StatBlock[11]; | 110 | |
90 | statpack.Region = new SimStatsPacket.RegionBlock(); | 111 | statpack.Region = rb; |
91 | statpack.Region.RegionX = ReportingRegion.RegionLocX; | 112 | statpack.Region.RegionX = ReportingRegion.RegionLocX; |
92 | statpack.Region.RegionY = ReportingRegion.RegionLocY; | 113 | statpack.Region.RegionY = ReportingRegion.RegionLocY; |
93 | try | 114 | try |
@@ -119,49 +140,64 @@ namespace OpenSim.Region.Environment.Scenes | |||
119 | 140 | ||
120 | #endregion | 141 | #endregion |
121 | 142 | ||
122 | sb[0] = new SimStatsPacket.StatBlock(); | 143 | //sb[0] = sbb; |
123 | sb[0].StatID = (uint) Stats.TimeDilation; | 144 | sb[0].StatID = (uint) Stats.TimeDilation; |
124 | sb[0].StatValue = (m_timeDilation); | 145 | sb[0].StatValue = (m_timeDilation); |
125 | 146 | ||
126 | sb[1] = new SimStatsPacket.StatBlock(); | 147 | //sb[1] = sbb; |
127 | sb[1].StatID = (uint) Stats.SimFPS; | 148 | sb[1].StatID = (uint) Stats.SimFPS; |
128 | sb[1].StatValue = simfps; | 149 | sb[1].StatValue = simfps; |
129 | 150 | ||
130 | sb[2] = new SimStatsPacket.StatBlock(); | 151 | //sb[2] = sbb; |
131 | sb[2].StatID = (uint) Stats.PhysicsFPS; | 152 | sb[2].StatID = (uint) Stats.PhysicsFPS; |
132 | sb[2].StatValue = physfps; | 153 | sb[2].StatValue = physfps; |
133 | 154 | ||
134 | sb[3] = new SimStatsPacket.StatBlock(); | 155 | //sb[3] = sbb; |
135 | sb[3].StatID = (uint) Stats.AgentUpdates; | 156 | sb[3].StatID = (uint) Stats.AgentUpdates; |
136 | sb[3].StatValue = (m_agentUpdates/statsUpdatesEveryMS); | 157 | sb[3].StatValue = (m_agentUpdates); |
137 | 158 | ||
138 | sb[4] = new SimStatsPacket.StatBlock(); | 159 | //sb[4] = sbb; |
139 | sb[4].StatID = (uint) Stats.Agents; | 160 | //sb[4].StatID = (uint) Stats.Agents; |
140 | sb[4].StatValue = m_rootAgents; | 161 | sb[4].StatValue = m_rootAgents; |
141 | 162 | ||
142 | sb[5] = new SimStatsPacket.StatBlock(); | 163 | //sb[5] = sbb; |
143 | sb[5].StatID = (uint) Stats.ChildAgents; | 164 | sb[5].StatID = (uint) Stats.ChildAgents; |
144 | sb[5].StatValue = m_childAgents; | 165 | sb[5].StatValue = m_childAgents; |
145 | 166 | ||
146 | sb[6] = new SimStatsPacket.StatBlock(); | 167 | //sb[6] = sbb; |
147 | sb[6].StatID = (uint) Stats.TotalPrim; | 168 | sb[6].StatID = (uint) Stats.TotalPrim; |
148 | sb[6].StatValue = m_numPrim; | 169 | sb[6].StatValue = m_numPrim; |
149 | 170 | ||
150 | sb[7] = new SimStatsPacket.StatBlock(); | 171 | //sb[7] = sbb; |
151 | sb[7].StatID = (uint) Stats.ActivePrim; | 172 | sb[7].StatID = (uint) Stats.ActivePrim; |
152 | sb[7].StatValue = m_activePrim; | 173 | sb[7].StatValue = m_activePrim; |
153 | 174 | ||
154 | sb[8] = new SimStatsPacket.StatBlock(); | 175 | sb[8].StatID = (uint)Stats.FrameMS; |
155 | sb[8].StatID = (uint) Stats.InPacketsPerSecond; | 176 | sb[8].StatValue = m_frameMS; |
156 | sb[8].StatValue = (int) (m_inPacketsPerSecond/statsUpdatesEveryMS); | 177 | |
178 | sb[9].StatID = (uint)Stats.NetMS; | ||
179 | sb[9].StatValue = m_netMS; | ||
180 | |||
181 | sb[10].StatID = (uint)Stats.PhysicsMS; | ||
182 | sb[10].StatValue = m_physicsMS; | ||
157 | 183 | ||
158 | sb[9] = new SimStatsPacket.StatBlock(); | 184 | sb[11].StatID = (uint)Stats.ImageMS ; |
159 | sb[9].StatID = (uint) Stats.OutPacketsPerSecond; | 185 | sb[11].StatValue = m_imageMS; |
160 | sb[9].StatValue = (int) (m_outPacketsPerSecond/statsUpdatesEveryMS); | ||
161 | 186 | ||
162 | sb[10] = new SimStatsPacket.StatBlock(); | 187 | sb[12].StatID = (uint)Stats.OtherMS; |
163 | sb[10].StatID = (uint) Stats.UnAckedBytes; | 188 | sb[12].StatValue = m_otherMS; |
164 | sb[10].StatValue = (int) (m_unAckedBytes/statsUpdatesEveryMS); | 189 | |
190 | //sb[8] = sbb; | ||
191 | sb[13].StatID = (uint) Stats.InPacketsPerSecond; | ||
192 | sb[13].StatValue = (m_inPacketsPerSecond); | ||
193 | |||
194 | //sb[9] = sbb; | ||
195 | sb[14].StatID = (uint) Stats.OutPacketsPerSecond; | ||
196 | sb[14].StatValue = (m_outPacketsPerSecond); | ||
197 | |||
198 | //sb[10] = sbb; | ||
199 | sb[15].StatID = (uint) Stats.UnAckedBytes; | ||
200 | sb[15].StatValue = m_unAckedBytes; | ||
165 | 201 | ||
166 | statpack.Stat = sb; | 202 | statpack.Stat = sb; |
167 | 203 | ||
@@ -181,8 +217,15 @@ namespace OpenSim.Region.Environment.Scenes | |||
181 | m_inPacketsPerSecond = 0; | 217 | m_inPacketsPerSecond = 0; |
182 | m_outPacketsPerSecond = 0; | 218 | m_outPacketsPerSecond = 0; |
183 | m_unAckedBytes = 0; | 219 | m_unAckedBytes = 0; |
220 | m_frameMS = 0; | ||
221 | m_netMS = 0; | ||
222 | m_physicsMS = 0; | ||
223 | m_imageMS = 0; | ||
224 | m_otherMS = 0; | ||
184 | } | 225 | } |
185 | 226 | ||
227 | |||
228 | |||
186 | public void SetTimeDilation(float td) | 229 | public void SetTimeDilation(float td) |
187 | { | 230 | { |
188 | m_timeDilation = td; | 231 | m_timeDilation = td; |
@@ -242,5 +285,26 @@ namespace OpenSim.Region.Environment.Scenes | |||
242 | { | 285 | { |
243 | m_unAckedBytes += numBytes; | 286 | m_unAckedBytes += numBytes; |
244 | } | 287 | } |
288 | |||
289 | public void addFrameMS(int ms) | ||
290 | { | ||
291 | m_frameMS += ms; | ||
292 | } | ||
293 | public void addNetMS(int ms) | ||
294 | { | ||
295 | m_netMS += ms; | ||
296 | } | ||
297 | public void addPhysicsMS(int ms) | ||
298 | { | ||
299 | m_physicsMS += ms; | ||
300 | } | ||
301 | public void addImageMS(int ms) | ||
302 | { | ||
303 | m_imageMS += ms; | ||
304 | } | ||
305 | public void addOtherMS(int ms) | ||
306 | { | ||
307 | m_otherMS += ms; | ||
308 | } | ||
245 | } | 309 | } |
246 | } | 310 | } |