aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2012-06-05 00:17:55 +0100
committerJustin Clark-Casey (justincc)2012-06-05 00:17:55 +0100
commit655625ab872659cd8aff1fe5b11dc568c91aee6d (patch)
treec531af096c55b9d37b555b5ee5b81838762b641e /OpenSim/Region/Framework/Scenes/SimStatsReporter.cs
parentMerge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff)
downloadopensim-SC_OLD-655625ab872659cd8aff1fe5b11dc568c91aee6d.zip
opensim-SC_OLD-655625ab872659cd8aff1fe5b11dc568c91aee6d.tar.gz
opensim-SC_OLD-655625ab872659cd8aff1fe5b11dc568c91aee6d.tar.bz2
opensim-SC_OLD-655625ab872659cd8aff1fe5b11dc568c91aee6d.tar.xz
Start sending spare frame time MS viewer stat. Make frame time correctly display total frame time, not just non-spare time.
This makes it easier to see when components of frame time exceed normal permitted frame time. Currently reflect scene frame times.
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Framework/Scenes/SimStatsReporter.cs112
1 files changed, 78 insertions, 34 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs b/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs
index 11c321b..88e0b05 100644
--- a/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs
+++ b/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs
@@ -56,10 +56,17 @@ namespace OpenSim.Region.Framework.Scenes
56 56
57 public event YourStatsAreWrong OnStatsIncorrect; 57 public event YourStatsAreWrong OnStatsIncorrect;
58 58
59 private SendStatResult handlerSendStatResult = null; 59 private SendStatResult handlerSendStatResult;
60 60
61 private YourStatsAreWrong handlerStatsIncorrect = null; 61 private YourStatsAreWrong handlerStatsIncorrect;
62 62
63 /// <summary>
64 /// These are the IDs of stats sent in the StatsPacket to the viewer.
65 /// </summary>
66 /// <remarks>
67 /// Some of these are not relevant to OpenSimulator since it is architected differently to other simulators
68 /// (e.g. script instructions aren't executed as part of the frame loop so 'script time' is tricky).
69 /// </remarks>
63 public enum Stats : uint 70 public enum Stats : uint
64 { 71 {
65 TimeDilation = 0, 72 TimeDilation = 0,
@@ -83,7 +90,20 @@ namespace OpenSim.Region.Framework.Scenes
83 OutPacketsPerSecond = 18, 90 OutPacketsPerSecond = 18,
84 PendingDownloads = 19, 91 PendingDownloads = 19,
85 PendingUploads = 20, 92 PendingUploads = 20,
93 VirtualSizeKb = 21,
94 ResidentSizeKb = 22,
95 PendingLocalUploads = 23,
86 UnAckedBytes = 24, 96 UnAckedBytes = 24,
97 PhysicsPinnedTasks = 25,
98 PhysicsLodTasks = 26,
99 SimPhysicsStepMs = 27,
100 SimPhysicsShapeMs = 28,
101 SimPhysicsOtherMs = 29,
102 SimPhysicsMemory = 30,
103 ScriptEps = 31,
104 SimSpareMs = 32,
105 SimSleepMs = 33,
106 SimIoPumpTime = 34
87 } 107 }
88 108
89 /// <summary> 109 /// <summary>
@@ -118,9 +138,9 @@ namespace OpenSim.Region.Framework.Scenes
118 138
119 // Sending a stats update every 3 seconds- 139 // Sending a stats update every 3 seconds-
120 private int m_statsUpdatesEveryMS = 3000; 140 private int m_statsUpdatesEveryMS = 3000;
121 private float m_statsUpdateFactor = 0; 141 private float m_statsUpdateFactor;
122 private float m_timeDilation = 0; 142 private float m_timeDilation;
123 private int m_fps = 0; 143 private int m_fps;
124 144
125 /// <summary> 145 /// <summary>
126 /// Number of the last frame on which we processed a stats udpate. 146 /// Number of the last frame on which we processed a stats udpate.
@@ -143,41 +163,42 @@ namespace OpenSim.Region.Framework.Scenes
143 private float m_reportedFpsCorrectionFactor = 5; 163 private float m_reportedFpsCorrectionFactor = 5;
144 164
145 // saved last reported value so there is something available for llGetRegionFPS 165 // saved last reported value so there is something available for llGetRegionFPS
146 private float lastReportedSimFPS = 0; 166 private float lastReportedSimFPS;
147 private float[] lastReportedSimStats = new float[21]; 167 private float[] lastReportedSimStats = new float[22];
148 private float m_pfps = 0; 168 private float m_pfps;
149 169
150 /// <summary> 170 /// <summary>
151 /// Number of agent updates requested in this stats cycle 171 /// Number of agent updates requested in this stats cycle
152 /// </summary> 172 /// </summary>
153 private int m_agentUpdates = 0; 173 private int m_agentUpdates;
154 174
155 /// <summary> 175 /// <summary>
156 /// Number of object updates requested in this stats cycle 176 /// Number of object updates requested in this stats cycle
157 /// </summary> 177 /// </summary>
158 private int m_objectUpdates; 178 private int m_objectUpdates;
159 179
160 private int m_frameMS = 0; 180 private int m_frameMS;
161 private int m_netMS = 0; 181 private int m_spareMS;
162 private int m_agentMS = 0; 182 private int m_netMS;
163 private int m_physicsMS = 0; 183 private int m_agentMS;
164 private int m_imageMS = 0; 184 private int m_physicsMS;
165 private int m_otherMS = 0; 185 private int m_imageMS;
186 private int m_otherMS;
166 187
167//Ckrinke: (3-21-08) Comment out to remove a compiler warning. Bring back into play when needed. 188//Ckrinke: (3-21-08) Comment out to remove a compiler warning. Bring back into play when needed.
168//Ckrinke private int m_scriptMS = 0; 189//Ckrinke private int m_scriptMS = 0;
169 190
170 private int m_rootAgents = 0; 191 private int m_rootAgents;
171 private int m_childAgents = 0; 192 private int m_childAgents;
172 private int m_numPrim = 0; 193 private int m_numPrim;
173 private int m_inPacketsPerSecond = 0; 194 private int m_inPacketsPerSecond;
174 private int m_outPacketsPerSecond = 0; 195 private int m_outPacketsPerSecond;
175 private int m_activePrim = 0; 196 private int m_activePrim;
176 private int m_unAckedBytes = 0; 197 private int m_unAckedBytes;
177 private int m_pendingDownloads = 0; 198 private int m_pendingDownloads;
178 private int m_pendingUploads = 0; 199 private int m_pendingUploads = 0; // FIXME: Not currently filled in
179 private int m_activeScripts = 0; 200 private int m_activeScripts;
180 private int m_scriptLinesPerSecond = 0; 201 private int m_scriptLinesPerSecond;
181 202
182 private int m_objectCapacity = 45000; 203 private int m_objectCapacity = 45000;
183 204
@@ -199,7 +220,7 @@ namespace OpenSim.Region.Framework.Scenes
199 m_objectCapacity = scene.RegionInfo.ObjectCapacity; 220 m_objectCapacity = scene.RegionInfo.ObjectCapacity;
200 m_report.AutoReset = true; 221 m_report.AutoReset = true;
201 m_report.Interval = m_statsUpdatesEveryMS; 222 m_report.Interval = m_statsUpdatesEveryMS;
202 m_report.Elapsed += statsHeartBeat; 223 m_report.Elapsed += TriggerStatsHeartbeat;
203 m_report.Enabled = true; 224 m_report.Enabled = true;
204 225
205 if (StatsManager.SimExtraStats != null) 226 if (StatsManager.SimExtraStats != null)
@@ -208,7 +229,7 @@ namespace OpenSim.Region.Framework.Scenes
208 229
209 public void Close() 230 public void Close()
210 { 231 {
211 m_report.Elapsed -= statsHeartBeat; 232 m_report.Elapsed -= TriggerStatsHeartbeat;
212 m_report.Close(); 233 m_report.Close();
213 } 234 }
214 235
@@ -223,9 +244,23 @@ namespace OpenSim.Region.Framework.Scenes
223 m_report.Interval = m_statsUpdatesEveryMS; 244 m_report.Interval = m_statsUpdatesEveryMS;
224 } 245 }
225 246
247 private void TriggerStatsHeartbeat(object sender, EventArgs args)
248 {
249 try
250 {
251 statsHeartBeat(sender, args);
252 }
253 catch (Exception e)
254 {
255 m_log.Warn(string.Format(
256 "[SIM STATS REPORTER] Update for {0} failed with exception ",
257 m_scene.RegionInfo.RegionName), e);
258 }
259 }
260
226 private void statsHeartBeat(object sender, EventArgs e) 261 private void statsHeartBeat(object sender, EventArgs e)
227 { 262 {
228 SimStatsPacket.StatBlock[] sb = new SimStatsPacket.StatBlock[21]; 263 SimStatsPacket.StatBlock[] sb = new SimStatsPacket.StatBlock[22];
229 SimStatsPacket.RegionBlock rb = new SimStatsPacket.RegionBlock(); 264 SimStatsPacket.RegionBlock rb = new SimStatsPacket.RegionBlock();
230 265
231 // Know what's not thread safe in Mono... modifying timers. 266 // Know what's not thread safe in Mono... modifying timers.
@@ -292,7 +327,7 @@ namespace OpenSim.Region.Framework.Scenes
292 if (framesUpdated == 0) 327 if (framesUpdated == 0)
293 framesUpdated = 1; 328 framesUpdated = 1;
294 329
295 for (int i = 0; i < 21; i++) 330 for (int i = 0; i < 22; i++)
296 { 331 {
297 sb[i] = new SimStatsPacket.StatBlock(); 332 sb[i] = new SimStatsPacket.StatBlock();
298 } 333 }
@@ -359,8 +394,11 @@ namespace OpenSim.Region.Framework.Scenes
359 394
360 sb[20].StatID = (uint)Stats.ScriptLinesPerSecond; 395 sb[20].StatID = (uint)Stats.ScriptLinesPerSecond;
361 sb[20].StatValue = m_scriptLinesPerSecond / m_statsUpdateFactor; 396 sb[20].StatValue = m_scriptLinesPerSecond / m_statsUpdateFactor;
362 397
363 for (int i = 0; i < 21; i++) 398 sb[21].StatID = (uint)Stats.SimSpareMs;
399 sb[21].StatValue = m_spareMS / framesUpdated;
400
401 for (int i = 0; i < 22; i++)
364 { 402 {
365 lastReportedSimStats[i] = sb[i].StatValue; 403 lastReportedSimStats[i] = sb[i].StatValue;
366 } 404 }
@@ -398,11 +436,11 @@ namespace OpenSim.Region.Framework.Scenes
398 } 436 }
399 } 437 }
400 438
401 resetvalues(); 439 ResetValues();
402 } 440 }
403 } 441 }
404 442
405 private void resetvalues() 443 private void ResetValues()
406 { 444 {
407 m_timeDilation = 0; 445 m_timeDilation = 0;
408 m_fps = 0; 446 m_fps = 0;
@@ -420,6 +458,7 @@ namespace OpenSim.Region.Framework.Scenes
420 m_physicsMS = 0; 458 m_physicsMS = 0;
421 m_imageMS = 0; 459 m_imageMS = 0;
422 m_otherMS = 0; 460 m_otherMS = 0;
461 m_spareMS = 0;
423 462
424//Ckrinke This variable is not used, so comment to remove compiler warning until it is used. 463//Ckrinke This variable is not used, so comment to remove compiler warning until it is used.
425//Ckrinke m_scriptMS = 0; 464//Ckrinke m_scriptMS = 0;
@@ -498,6 +537,11 @@ namespace OpenSim.Region.Framework.Scenes
498 m_frameMS += ms; 537 m_frameMS += ms;
499 } 538 }
500 539
540 public void AddSpareMS(int ms)
541 {
542 m_spareMS += ms;
543 }
544
501 public void addNetMS(int ms) 545 public void addNetMS(int ms)
502 { 546 {
503 m_netMS += ms; 547 m_netMS += ms;