aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJustin Clarke Casey2008-07-15 18:07:23 +0000
committerJustin Clarke Casey2008-07-15 18:07:23 +0000
commitd75cacb050777493bfa880f5fa694590cba0ebe4 (patch)
tree6e41cce9c0d3a0c59322350068ed5460849ed2b1
parentcleanup: fixing CamelCase issue with RestDeserialiseHandler. (diff)
downloadopensim-SC_OLD-d75cacb050777493bfa880f5fa694590cba0ebe4.zip
opensim-SC_OLD-d75cacb050777493bfa880f5fa694590cba0ebe4.tar.gz
opensim-SC_OLD-d75cacb050777493bfa880f5fa694590cba0ebe4.tar.bz2
opensim-SC_OLD-d75cacb050777493bfa880f5fa694590cba0ebe4.tar.xz
* Expose client statistics to the console via 'show stats'
* Potentially useful for diagnostics without needing to log in a client * Packet queue statistics commented out for now pending a better way to cope with the information overload
-rw-r--r--OpenSim/Framework/Statistics/SimExtraStatsCollector.cs92
-rw-r--r--OpenSim/Region/Environment/Scenes/SimStatsReporter.cs5
2 files changed, 95 insertions, 2 deletions
diff --git a/OpenSim/Framework/Statistics/SimExtraStatsCollector.cs b/OpenSim/Framework/Statistics/SimExtraStatsCollector.cs
index d4d1f9d..06b3185 100644
--- a/OpenSim/Framework/Statistics/SimExtraStatsCollector.cs
+++ b/OpenSim/Framework/Statistics/SimExtraStatsCollector.cs
@@ -29,6 +29,7 @@ using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Text; 30using System.Text;
31using libsecondlife; 31using libsecondlife;
32using libsecondlife.Packets;
32using OpenSim.Framework.Statistics.Interfaces; 33using OpenSim.Framework.Statistics.Interfaces;
33 34
34namespace OpenSim.Framework.Statistics 35namespace OpenSim.Framework.Statistics
@@ -49,6 +50,28 @@ namespace OpenSim.Framework.Statistics
49 private long assetServiceRequestFailures; 50 private long assetServiceRequestFailures;
50 private long inventoryServiceRetrievalFailures; 51 private long inventoryServiceRetrievalFailures;
51 52
53 private float timeDilation;
54 private float simFps;
55 private float physicsFps;
56 private float agentUpdates;
57 private float rootAgents;
58 private float childAgents;
59 private float totalPrims;
60 private float activePrims;
61 private float totalFrameTime;
62 private float netFrameTime;
63 private float physicsFrameTime;
64 private float otherFrameTime;
65 private float imageFrameTime;
66 private float inPacketsPerSecond;
67 private float outPacketsPerSecond;
68 private float unackedBytes;
69 private float agentFrameTime;
70 private float pendingDownloads;
71 private float pendingUploads;
72 private float activeScripts;
73 private float scriptLinesPerSecond;
74
52 /// <summary> 75 /// <summary>
53 /// Number of times that a client thread terminated because of an exception 76 /// Number of times that a client thread terminated because of an exception
54 /// </summary> 77 /// </summary>
@@ -85,6 +108,16 @@ namespace OpenSim.Framework.Statistics
85 /// we do not yet timeout this situation. 108 /// we do not yet timeout this situation.
86 /// </summary> 109 /// </summary>
87 public long InventoryServiceRetrievalFailures { get { return inventoryServiceRetrievalFailures; } } 110 public long InventoryServiceRetrievalFailures { get { return inventoryServiceRetrievalFailures; } }
111
112 /// <summary>
113 /// Retrieve the total frame time (in ms) of the last frame
114 /// </summary>
115 //public float TotalFrameTime { get { return totalFrameTime; } }
116
117 /// <summary>
118 /// Retrieve the physics update component (in ms) of the last frame
119 /// </summary>
120 //public float PhysicsFrameTime { get { return physicsFrameTime; } }
88 121
89 /// <summary> 122 /// <summary>
90 /// Retain a dictionary of all packet queues stats reporters 123 /// Retain a dictionary of all packet queues stats reporters
@@ -166,7 +199,39 @@ namespace OpenSim.Framework.Statistics
166 packetQueueStatsCollectors.Remove(uuid); 199 packetQueueStatsCollectors.Remove(uuid);
167 } 200 }
168 } 201 }
169 202
203 /// <summary>
204 /// This is the method on which the classic sim stats reporter (which collects stats for
205 /// client purposes) sends information to listeners.
206 /// </summary>
207 /// <param name="pack"></param>
208 public void ReceiveClassicSimStatsPacket(SimStatsPacket statsPacket)
209 {
210 // FIXME: Really shouldn't rely on the probably arbitrary order in which
211 // stats are packed into the packet
212 timeDilation = statsPacket.Stat[0].StatValue;
213 simFps = statsPacket.Stat[1].StatValue;
214 physicsFps = statsPacket.Stat[2].StatValue;
215 agentUpdates = statsPacket.Stat[3].StatValue;
216 rootAgents = statsPacket.Stat[4].StatValue;
217 childAgents = statsPacket.Stat[5].StatValue;
218 totalPrims = statsPacket.Stat[6].StatValue;
219 activePrims = statsPacket.Stat[7].StatValue;
220 totalFrameTime = statsPacket.Stat[8].StatValue;
221 netFrameTime = statsPacket.Stat[9].StatValue;
222 physicsFrameTime = statsPacket.Stat[10].StatValue;
223 otherFrameTime = statsPacket.Stat[11].StatValue;
224 imageFrameTime = statsPacket.Stat[12].StatValue;
225 inPacketsPerSecond = statsPacket.Stat[13].StatValue;
226 outPacketsPerSecond = statsPacket.Stat[14].StatValue;
227 unackedBytes = statsPacket.Stat[15].StatValue;
228 agentFrameTime = statsPacket.Stat[16].StatValue;
229 pendingDownloads = statsPacket.Stat[17].StatValue;
230 pendingUploads = statsPacket.Stat[18].StatValue;
231 activeScripts = statsPacket.Stat[19].StatValue;
232 scriptLinesPerSecond = statsPacket.Stat[20].StatValue;
233 }
234
170 /// <summary> 235 /// <summary>
171 /// Report back collected statistical information. 236 /// Report back collected statistical information.
172 /// </summary> 237 /// </summary>
@@ -202,7 +267,31 @@ Asset service request failures: {5}"+ Environment.NewLine,
202 string.Format( 267 string.Format(
203 "Initial inventory caching failures: {0}" + Environment.NewLine, 268 "Initial inventory caching failures: {0}" + Environment.NewLine,
204 InventoryServiceRetrievalFailures)); 269 InventoryServiceRetrievalFailures));
270
271 sb.Append(Environment.NewLine);
272 sb.Append("FRAME STATISTICS");
273 sb.Append(Environment.NewLine);
274 sb.Append("Dilatn SimFPS PhyFPS AgntUp RootAg ChldAg Prims AtvPrm AtvScr ScrLPS");
275 sb.Append(Environment.NewLine);
276 sb.Append(
277 string.Format(
278 "{0,6:0.00} {1,6:0} {2,6:0.0} {3,6:0.0} {4,6:0} {5,6:0} {6,6:0} {7,6:0} {8,6:0} {9,6:0}",
279 timeDilation, simFps, physicsFps, agentUpdates, rootAgents,
280 childAgents, totalPrims, activePrims, activeScripts, scriptLinesPerSecond));
281
282 sb.Append(Environment.NewLine);
283 sb.Append(Environment.NewLine);
284 // There is no script frame time currently because we don't yet collect it
285 sb.Append("PktsIn PktOut PendDl PendUl UnackB TotlFt NetFt PhysFt OthrFt AgntFt ImgsFt");
286 sb.Append(Environment.NewLine);
287 sb.Append(
288 string.Format(
289 "{0,6:0} {1,6:0} {2,6:0} {3,6:0} {4,6:0} {5,6:0.0} {6,6:0.0} {7,6:0.0} {8,6:0.0} {9,6:0.0} {10,6:0.0}",
290 inPacketsPerSecond, outPacketsPerSecond, pendingDownloads, pendingUploads, unackedBytes, totalFrameTime,
291 netFrameTime, physicsFrameTime, otherFrameTime, agentFrameTime, imageFrameTime));
292 sb.Append(Environment.NewLine);
205 293
294 /*
206 sb.Append(Environment.NewLine); 295 sb.Append(Environment.NewLine);
207 sb.Append("PACKET QUEUE STATISTICS"); 296 sb.Append("PACKET QUEUE STATISTICS");
208 sb.Append(Environment.NewLine); 297 sb.Append(Environment.NewLine);
@@ -219,6 +308,7 @@ Asset service request failures: {5}"+ Environment.NewLine,
219 sb.Append(packetQueueStatsCollectors[key].Report()); 308 sb.Append(packetQueueStatsCollectors[key].Report());
220 sb.Append(Environment.NewLine); 309 sb.Append(Environment.NewLine);
221 } 310 }
311 */
222 312
223 sb.Append(base.Report()); 313 sb.Append(base.Report());
224 314
diff --git a/OpenSim/Region/Environment/Scenes/SimStatsReporter.cs b/OpenSim/Region/Environment/Scenes/SimStatsReporter.cs
index 609b4ed..60b5c10 100644
--- a/OpenSim/Region/Environment/Scenes/SimStatsReporter.cs
+++ b/OpenSim/Region/Environment/Scenes/SimStatsReporter.cs
@@ -29,6 +29,7 @@ using System;
29using System.Timers; 29using System.Timers;
30using libsecondlife.Packets; 30using libsecondlife.Packets;
31using OpenSim.Framework; 31using OpenSim.Framework;
32using OpenSim.Framework.Statistics;
32using OpenSim.Region.Environment.Interfaces; 33using OpenSim.Region.Environment.Interfaces;
33 34
34namespace OpenSim.Region.Environment.Scenes 35namespace OpenSim.Region.Environment.Scenes
@@ -114,7 +115,6 @@ namespace OpenSim.Region.Environment.Scenes
114 115
115 public SimStatsReporter(Scene scene) 116 public SimStatsReporter(Scene scene)
116 { 117 {
117
118 statsUpdateFactor = (float)(statsUpdatesEveryMS / 1000); 118 statsUpdateFactor = (float)(statsUpdatesEveryMS / 1000);
119 m_scene = scene; 119 m_scene = scene;
120 ReportingRegion = scene.RegionInfo; 120 ReportingRegion = scene.RegionInfo;
@@ -126,6 +126,9 @@ namespace OpenSim.Region.Environment.Scenes
126 m_report.Interval = statsUpdatesEveryMS; 126 m_report.Interval = statsUpdatesEveryMS;
127 m_report.Elapsed += new ElapsedEventHandler(statsHeartBeat); 127 m_report.Elapsed += new ElapsedEventHandler(statsHeartBeat);
128 m_report.Enabled = true; 128 m_report.Enabled = true;
129
130 if (StatsManager.SimExtraStats != null)
131 OnSendStatsResult += StatsManager.SimExtraStats.ReceiveClassicSimStatsPacket;
129 } 132 }
130 133
131 public void SetUpdateMS(int ms) 134 public void SetUpdateMS(int ms)