aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Scenes/SimStatsReporter.cs
diff options
context:
space:
mode:
authorTeravus Ovares2008-01-16 02:48:39 +0000
committerTeravus Ovares2008-01-16 02:48:39 +0000
commit314c554ed40fe015397cf0fa6981e47b5025b6f8 (patch)
tree7337f1b63bc207809306c1967559577479e448ec /OpenSim/Region/Environment/Scenes/SimStatsReporter.cs
parent* Restore non dash asset UUID persistence which was made dashed in r3069 (diff)
downloadopensim-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 'OpenSim/Region/Environment/Scenes/SimStatsReporter.cs')
-rw-r--r--OpenSim/Region/Environment/Scenes/SimStatsReporter.cs110
1 files changed, 87 insertions, 23 deletions
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}