1
0

SimExtraStatsCollector.cs 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544
  1. /*
  2. * Copyright (c) Contributors, http://opensimulator.org/
  3. * See CONTRIBUTORS.TXT for a full list of copyright holders.
  4. *
  5. * Redistribution and use in source and binary forms, with or without
  6. * modification, are permitted provided that the following conditions are met:
  7. * * Redistributions of source code must retain the above copyright
  8. * notice, this list of conditions and the following disclaimer.
  9. * * Redistributions in binary form must reproduce the above copyright
  10. * notice, this list of conditions and the following disclaimer in the
  11. * documentation and/or other materials provided with the distribution.
  12. * * Neither the name of the OpenSimulator Project nor the
  13. * names of its contributors may be used to endorse or promote products
  14. * derived from this software without specific prior written permission.
  15. *
  16. * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
  17. * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  18. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  19. * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
  20. * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  21. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  22. * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  23. * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  24. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  25. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  26. */
  27. using System;
  28. using System.Collections.Generic;
  29. using System.Diagnostics;
  30. using System.Linq;
  31. using System.Text;
  32. using OpenMetaverse;
  33. using OpenMetaverse.StructuredData;
  34. using OpenSim.Framework.Monitoring.Interfaces;
  35. namespace OpenSim.Framework.Monitoring
  36. {
  37. /// <summary>
  38. /// Collects sim statistics which aren't already being collected for the linden viewer's statistics pane
  39. /// </summary>
  40. public class SimExtraStatsCollector : BaseStatsCollector
  41. {
  42. // private long assetsInCache;
  43. // private long texturesInCache;
  44. // private long assetCacheMemoryUsage;
  45. // private long textureCacheMemoryUsage;
  46. // private TimeSpan assetRequestTimeAfterCacheMiss;
  47. // private long blockedMissingTextureRequests;
  48. // private long assetServiceRequestFailures;
  49. // private long inventoryServiceRetrievalFailures;
  50. private volatile float timeDilation;
  51. private volatile float simFps;
  52. private volatile float physicsFps;
  53. private volatile float agentUpdates;
  54. private volatile float rootAgents;
  55. private volatile float childAgents;
  56. private volatile float totalPrims;
  57. private volatile float activePrims;
  58. private volatile float totalFrameTime;
  59. private volatile float netFrameTime;
  60. private volatile float physicsFrameTime;
  61. private volatile float otherFrameTime;
  62. private volatile float imageFrameTime;
  63. private volatile float inPacketsPerSecond;
  64. private volatile float outPacketsPerSecond;
  65. private volatile float unackedBytes;
  66. private volatile float agentFrameTime;
  67. private volatile float pendingDownloads;
  68. private volatile float pendingUploads;
  69. private volatile float activeScripts;
  70. private volatile float spareTime;
  71. private volatile float sleepTime;
  72. private volatile float physicsStep;
  73. private volatile float scriptLinesPerSecond;
  74. private volatile float m_frameDilation;
  75. private volatile float m_usersLoggingIn;
  76. private volatile float m_totalGeoPrims;
  77. private volatile float m_totalMeshes;
  78. private volatile float m_inUseThreads;
  79. // /// <summary>
  80. // /// These statistics are being collected by push rather than pull. Pull would be simpler, but I had the
  81. // /// notion of providing some flow statistics (which pull wouldn't give us). Though admittedly these
  82. // /// haven't yet been implemented...
  83. // /// </summary>
  84. // public long AssetsInCache { get { return assetsInCache; } }
  85. //
  86. // /// <value>
  87. // /// Currently unused
  88. // /// </value>
  89. // public long TexturesInCache { get { return texturesInCache; } }
  90. //
  91. // /// <value>
  92. // /// Currently misleading since we can't currently subtract removed asset memory usage without a performance hit
  93. // /// </value>
  94. // public long AssetCacheMemoryUsage { get { return assetCacheMemoryUsage; } }
  95. //
  96. // /// <value>
  97. // /// Currently unused
  98. // /// </value>
  99. // public long TextureCacheMemoryUsage { get { return textureCacheMemoryUsage; } }
  100. public float TimeDilation { get { return timeDilation; } }
  101. public float SimFps { get { return simFps; } }
  102. public float PhysicsFps { get { return physicsFps; } }
  103. public float AgentUpdates { get { return agentUpdates; } }
  104. public float RootAgents { get { return rootAgents; } }
  105. public float ChildAgents { get { return childAgents; } }
  106. public float TotalPrims { get { return totalPrims; } }
  107. public float ActivePrims { get { return activePrims; } }
  108. public float TotalFrameTime { get { return totalFrameTime; } }
  109. public float NetFrameTime { get { return netFrameTime; } }
  110. public float PhysicsFrameTime { get { return physicsFrameTime; } }
  111. public float OtherFrameTime { get { return otherFrameTime; } }
  112. public float ImageFrameTime { get { return imageFrameTime; } }
  113. public float InPacketsPerSecond { get { return inPacketsPerSecond; } }
  114. public float OutPacketsPerSecond { get { return outPacketsPerSecond; } }
  115. public float UnackedBytes { get { return unackedBytes; } }
  116. public float AgentFrameTime { get { return agentFrameTime; } }
  117. public float PendingDownloads { get { return pendingDownloads; } }
  118. public float PendingUploads { get { return pendingUploads; } }
  119. public float ActiveScripts { get { return activeScripts; } }
  120. public float ScriptLinesPerSecond { get { return scriptLinesPerSecond; } }
  121. // /// <summary>
  122. // /// This is the time it took for the last asset request made in response to a cache miss.
  123. // /// </summary>
  124. // public TimeSpan AssetRequestTimeAfterCacheMiss { get { return assetRequestTimeAfterCacheMiss; } }
  125. //
  126. // /// <summary>
  127. // /// Number of persistent requests for missing textures we have started blocking from clients. To some extent
  128. // /// this is just a temporary statistic to keep this problem in view - the root cause of this lies either
  129. // /// in a mishandling of the reply protocol, related to avatar appearance or may even originate in graphics
  130. // /// driver bugs on clients (though this seems less likely).
  131. // /// </summary>
  132. // public long BlockedMissingTextureRequests { get { return blockedMissingTextureRequests; } }
  133. //
  134. // /// <summary>
  135. // /// Record the number of times that an asset request has failed. Failures are effectively exceptions, such as
  136. // /// request timeouts. If an asset service replies that a particular asset cannot be found, this is not counted
  137. // /// as a failure
  138. // /// </summary>
  139. // public long AssetServiceRequestFailures { get { return assetServiceRequestFailures; } }
  140. /// <summary>
  141. /// Number of known failures to retrieve avatar inventory from the inventory service. This does not
  142. /// cover situations where the inventory service accepts the request but never returns any data, since
  143. /// we do not yet timeout this situation.
  144. /// </summary>
  145. /// <remarks>Commented out because we do not cache inventory at this point</remarks>
  146. // public long InventoryServiceRetrievalFailures { get { return inventoryServiceRetrievalFailures; } }
  147. /// <summary>
  148. /// Retrieve the total frame time (in ms) of the last frame
  149. /// </summary>
  150. //public float TotalFrameTime { get { return totalFrameTime; } }
  151. /// <summary>
  152. /// Retrieve the physics update component (in ms) of the last frame
  153. /// </summary>
  154. //public float PhysicsFrameTime { get { return physicsFrameTime; } }
  155. /// <summary>
  156. /// Retain a dictionary of all packet queues stats reporters
  157. /// </summary>
  158. private IDictionary<UUID, PacketQueueStatsCollector> packetQueueStatsCollectors
  159. = new Dictionary<UUID, PacketQueueStatsCollector>();
  160. // public void AddAsset(AssetBase asset)
  161. // {
  162. // assetsInCache++;
  163. // //assetCacheMemoryUsage += asset.Data.Length;
  164. // }
  165. //
  166. // public void RemoveAsset(UUID uuid)
  167. // {
  168. // assetsInCache--;
  169. // }
  170. //
  171. // public void AddTexture(AssetBase image)
  172. // {
  173. // if (image.Data != null)
  174. // {
  175. // texturesInCache++;
  176. //
  177. // // This could have been a pull stat, though there was originally a nebulous idea to measure flow rates
  178. // textureCacheMemoryUsage += image.Data.Length;
  179. // }
  180. // }
  181. //
  182. // /// <summary>
  183. // /// Signal that the asset cache has been cleared.
  184. // /// </summary>
  185. // public void ClearAssetCacheStatistics()
  186. // {
  187. // assetsInCache = 0;
  188. // assetCacheMemoryUsage = 0;
  189. // texturesInCache = 0;
  190. // textureCacheMemoryUsage = 0;
  191. // }
  192. //
  193. // public void AddAssetRequestTimeAfterCacheMiss(TimeSpan ts)
  194. // {
  195. // assetRequestTimeAfterCacheMiss = ts;
  196. // }
  197. //
  198. // public void AddBlockedMissingTextureRequest()
  199. // {
  200. // blockedMissingTextureRequests++;
  201. // }
  202. //
  203. // public void AddAssetServiceRequestFailure()
  204. // {
  205. // assetServiceRequestFailures++;
  206. // }
  207. // public void AddInventoryServiceRetrievalFailure()
  208. // {
  209. // inventoryServiceRetrievalFailures++;
  210. // }
  211. /// <summary>
  212. /// Register as a packet queue stats provider
  213. /// </summary>
  214. /// <param name="uuid">An agent UUID</param>
  215. /// <param name="provider"></param>
  216. public void RegisterPacketQueueStatsProvider(UUID uuid, IPullStatsProvider provider)
  217. {
  218. lock (packetQueueStatsCollectors)
  219. {
  220. // FIXME: If the region service is providing more than one region, then the child and root agent
  221. // queues are wrongly replacing each other here.
  222. packetQueueStatsCollectors[uuid] = new PacketQueueStatsCollector(provider);
  223. }
  224. }
  225. /// <summary>
  226. /// Deregister a packet queue stats provider
  227. /// </summary>
  228. /// <param name="uuid">An agent UUID</param>
  229. public void DeregisterPacketQueueStatsProvider(UUID uuid)
  230. {
  231. lock (packetQueueStatsCollectors)
  232. {
  233. packetQueueStatsCollectors.Remove(uuid);
  234. }
  235. }
  236. /// <summary>
  237. /// This is the method on which the classic sim stats reporter (which collects stats for
  238. /// client purposes) sends information to listeners.
  239. /// </summary>
  240. /// <param name="pack"></param>
  241. public void ReceiveClassicSimStatsPacket(SimStats stats)
  242. {
  243. // FIXME: SimStats shouldn't allow an arbitrary stat packing order (which is inherited from the original
  244. // SimStatsPacket that was being used).
  245. // For an unknown reason the original designers decided not to
  246. // include the spare MS statistic inside of this class, this is
  247. // located inside the StatsBlock at location 21, thus it is skipped
  248. timeDilation = stats.StatsBlock[0].StatValue;
  249. simFps = stats.StatsBlock[1].StatValue;
  250. physicsFps = stats.StatsBlock[2].StatValue;
  251. agentUpdates = stats.StatsBlock[3].StatValue;
  252. rootAgents = stats.StatsBlock[4].StatValue;
  253. childAgents = stats.StatsBlock[5].StatValue;
  254. totalPrims = stats.StatsBlock[6].StatValue;
  255. activePrims = stats.StatsBlock[7].StatValue;
  256. totalFrameTime = stats.StatsBlock[8].StatValue;
  257. netFrameTime = stats.StatsBlock[9].StatValue;
  258. physicsFrameTime = stats.StatsBlock[10].StatValue;
  259. imageFrameTime = stats.StatsBlock[11].StatValue;
  260. otherFrameTime = stats.StatsBlock[12].StatValue;
  261. inPacketsPerSecond = stats.StatsBlock[13].StatValue;
  262. outPacketsPerSecond = stats.StatsBlock[14].StatValue;
  263. unackedBytes = stats.StatsBlock[15].StatValue;
  264. agentFrameTime = stats.StatsBlock[16].StatValue;
  265. pendingDownloads = stats.StatsBlock[17].StatValue;
  266. pendingUploads = stats.StatsBlock[18].StatValue;
  267. activeScripts = stats.StatsBlock[19].StatValue;
  268. sleepTime = stats.StatsBlock[20].StatValue;
  269. spareTime = stats.StatsBlock[21].StatValue;
  270. physicsStep = stats.StatsBlock[22].StatValue;
  271. scriptLinesPerSecond = stats.ExtraStatsBlock[0].StatValue;
  272. m_frameDilation = stats.ExtraStatsBlock[1].StatValue;
  273. m_usersLoggingIn = stats.ExtraStatsBlock[2].StatValue;
  274. m_totalGeoPrims = stats.ExtraStatsBlock[3].StatValue;
  275. m_totalMeshes = stats.ExtraStatsBlock[4].StatValue;
  276. m_inUseThreads = stats.ExtraStatsBlock[5].StatValue;
  277. }
  278. /// <summary>
  279. /// Report back collected statistical information.
  280. /// </summary>
  281. /// <returns></returns>
  282. public override string Report()
  283. {
  284. StringBuilder sb = new StringBuilder(Environment.NewLine);
  285. // sb.Append("ASSET STATISTICS");
  286. // sb.Append(Environment.NewLine);
  287. /*
  288. sb.Append(
  289. string.Format(
  290. @"Asset cache contains {0,6} non-texture assets using {1,10} K
  291. Texture cache contains {2,6} texture assets using {3,10} K
  292. Latest asset request time after cache miss: {4}s
  293. Blocked client requests for missing textures: {5}
  294. Asset service request failures: {6}"+ Environment.NewLine,
  295. AssetsInCache, Math.Round(AssetCacheMemoryUsage / 1024.0),
  296. TexturesInCache, Math.Round(TextureCacheMemoryUsage / 1024.0),
  297. assetRequestTimeAfterCacheMiss.Milliseconds / 1000.0,
  298. BlockedMissingTextureRequests,
  299. AssetServiceRequestFailures));
  300. */
  301. /*
  302. sb.Append(
  303. string.Format(
  304. @"Asset cache contains {0,6} assets
  305. Latest asset request time after cache miss: {1}s
  306. Blocked client requests for missing textures: {2}
  307. Asset service request failures: {3}" + Environment.NewLine,
  308. AssetsInCache,
  309. assetRequestTimeAfterCacheMiss.Milliseconds / 1000.0,
  310. BlockedMissingTextureRequests,
  311. AssetServiceRequestFailures));
  312. */
  313. sb.Append(Environment.NewLine);
  314. sb.Append("CONNECTION STATISTICS");
  315. sb.Append(Environment.NewLine);
  316. List<Stat> stats = StatsManager.GetStatsFromEachContainer("clientstack", "ClientLogoutsDueToNoReceives");
  317. sb.AppendFormat(
  318. "Client logouts due to no data receive timeout: {0}\n\n",
  319. stats != null ? stats.Sum(s => s.Value).ToString() : "unknown");
  320. // sb.Append(Environment.NewLine);
  321. // sb.Append("INVENTORY STATISTICS");
  322. // sb.Append(Environment.NewLine);
  323. // sb.Append(
  324. // string.Format(
  325. // "Initial inventory caching failures: {0}" + Environment.NewLine,
  326. // InventoryServiceRetrievalFailures));
  327. sb.Append(Environment.NewLine);
  328. sb.Append("SAMPLE FRAME STATISTICS");
  329. sb.Append(Environment.NewLine);
  330. sb.Append("Dilatn SimFPS PhyFPS AgntUp RootAg ChldAg Prims AtvPrm AtvScr ScrLPS");
  331. sb.Append(Environment.NewLine);
  332. sb.Append(
  333. string.Format(
  334. "{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}",
  335. timeDilation, simFps, physicsFps, agentUpdates, rootAgents,
  336. childAgents, totalPrims, activePrims, activeScripts, scriptLinesPerSecond));
  337. sb.Append(Environment.NewLine);
  338. sb.Append(Environment.NewLine);
  339. // There is no script frame time currently because we don't yet collect it
  340. sb.Append("PktsIn PktOut PendDl PendUl UnackB TotlFt NetFt PhysFt OthrFt AgntFt ImgsFt");
  341. sb.Append(Environment.NewLine);
  342. sb.Append(
  343. string.Format(
  344. "{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}\n\n",
  345. inPacketsPerSecond, outPacketsPerSecond, pendingDownloads, pendingUploads, unackedBytes, totalFrameTime,
  346. netFrameTime, physicsFrameTime, otherFrameTime, agentFrameTime, imageFrameTime));
  347. /* 20130319 RA: For the moment, disable the dump of 'scene' catagory as they are mostly output by
  348. * the two formatted printouts above.
  349. SortedDictionary<string, SortedDictionary<string, Stat>> sceneStats;
  350. if (StatsManager.TryGetStats("scene", out sceneStats))
  351. {
  352. foreach (KeyValuePair<string, SortedDictionary<string, Stat>> kvp in sceneStats)
  353. {
  354. foreach (Stat stat in kvp.Value.Values)
  355. {
  356. if (stat.Verbosity == StatVerbosity.Info)
  357. {
  358. sb.AppendFormat("{0} ({1}): {2}{3}\n", stat.Name, stat.Container, stat.Value, stat.UnitName);
  359. }
  360. }
  361. }
  362. }
  363. */
  364. /*
  365. sb.Append(Environment.NewLine);
  366. sb.Append("PACKET QUEUE STATISTICS");
  367. sb.Append(Environment.NewLine);
  368. sb.Append("Agent UUID ");
  369. sb.Append(
  370. string.Format(
  371. " {0,7} {1,7} {2,7} {3,7} {4,7} {5,7} {6,7} {7,7} {8,7} {9,7}",
  372. "Send", "In", "Out", "Resend", "Land", "Wind", "Cloud", "Task", "Texture", "Asset"));
  373. sb.Append(Environment.NewLine);
  374. foreach (UUID key in packetQueueStatsCollectors.Keys)
  375. {
  376. sb.Append(string.Format("{0}: ", key));
  377. sb.Append(packetQueueStatsCollectors[key].Report());
  378. sb.Append(Environment.NewLine);
  379. }
  380. */
  381. sb.Append(base.Report());
  382. return sb.ToString();
  383. }
  384. /// <summary>
  385. /// Report back collected statistical information as json serialization.
  386. /// </summary>
  387. /// <returns></returns>
  388. public override string XReport(string uptime, string version)
  389. {
  390. return OSDParser.SerializeJsonString(OReport(uptime, version));
  391. }
  392. /// <summary>
  393. /// Report back collected statistical information as an OSDMap
  394. /// </summary>
  395. /// <returns></returns>
  396. public override OSDMap OReport(string uptime, string version)
  397. {
  398. // Get the amount of physical memory, allocated with the instance of this program, in kilobytes;
  399. // the working set is the set of memory pages currently visible to this program in physical RAM
  400. // memory and includes both shared (e.g. system libraries) and private data
  401. int numberThreadsRunning = 0;
  402. double memUsage = 0;
  403. using(Process p = Process.GetCurrentProcess())
  404. {
  405. memUsage = p.WorkingSet64 / 1024.0;
  406. // Get the number of threads from the system that are currently
  407. // running
  408. foreach (ProcessThread currentThread in p.Threads)
  409. {
  410. if (currentThread != null && currentThread.ThreadState == ThreadState.Running)
  411. numberThreadsRunning++;
  412. }
  413. }
  414. OSDMap args = new OSDMap(30);
  415. // args["AssetsInCache"] = OSD.FromString (String.Format ("{0:0.##}", AssetsInCache));
  416. // args["TimeAfterCacheMiss"] = OSD.FromString (String.Format ("{0:0.##}",
  417. // assetRequestTimeAfterCacheMiss.Milliseconds / 1000.0));
  418. // args["BlockedMissingTextureRequests"] = OSD.FromString (String.Format ("{0:0.##}",
  419. // BlockedMissingTextureRequests));
  420. // args["AssetServiceRequestFailures"] = OSD.FromString (String.Format ("{0:0.##}",
  421. // AssetServiceRequestFailures));
  422. // args["abnormalClientThreadTerminations"] = OSD.FromString (String.Format ("{0:0.##}",
  423. // abnormalClientThreadTerminations));
  424. // args["InventoryServiceRetrievalFailures"] = OSD.FromString (String.Format ("{0:0.##}",
  425. // InventoryServiceRetrievalFailures));
  426. args["Dilatn"] = OSD.FromString (String.Format ("{0:0.##}", timeDilation));
  427. args["SimFPS"] = OSD.FromString (String.Format ("{0:0.##}", simFps));
  428. args["PhyFPS"] = OSD.FromString (String.Format ("{0:0.##}", physicsFps));
  429. args["AgntUp"] = OSD.FromString (String.Format ("{0:0.##}", agentUpdates));
  430. args["RootAg"] = OSD.FromString (String.Format ("{0:0.##}", rootAgents));
  431. args["ChldAg"] = OSD.FromString (String.Format ("{0:0.##}", childAgents));
  432. args["Prims"] = OSD.FromString (String.Format ("{0:0.##}", totalPrims));
  433. args["AtvPrm"] = OSD.FromString (String.Format ("{0:0.##}", activePrims));
  434. args["AtvScr"] = OSD.FromString (String.Format ("{0:0.##}", activeScripts));
  435. args["ScrLPS"] = OSD.FromString (String.Format ("{0:0.##}", scriptLinesPerSecond));
  436. args["PktsIn"] = OSD.FromString (String.Format ("{0:0.##}", inPacketsPerSecond));
  437. args["PktOut"] = OSD.FromString (String.Format ("{0:0.##}", outPacketsPerSecond));
  438. args["PendDl"] = OSD.FromString (String.Format ("{0:0.##}", pendingDownloads));
  439. args["PendUl"] = OSD.FromString (String.Format ("{0:0.##}", pendingUploads));
  440. args["UnackB"] = OSD.FromString (String.Format ("{0:0.##}", unackedBytes));
  441. args["TotlFt"] = OSD.FromString (String.Format ("{0:0.##}", totalFrameTime));
  442. args["NetFt"] = OSD.FromString (String.Format ("{0:0.##}", netFrameTime));
  443. args["PhysFt"] = OSD.FromString (String.Format ("{0:0.##}", physicsFrameTime));
  444. args["OthrFt"] = OSD.FromString (String.Format ("{0:0.##}", otherFrameTime));
  445. args["AgntFt"] = OSD.FromString (String.Format ("{0:0.##}", agentFrameTime));
  446. args["ImgsFt"] = OSD.FromString (String.Format ("{0:0.##}", imageFrameTime));
  447. args["Memory"] = OSD.FromString (base.XReport (uptime, version));
  448. args["Uptime"] = OSD.FromString (uptime);
  449. args["Version"] = OSD.FromString (version);
  450. args["FrameDilatn"] = OSD.FromString(String.Format("{0:0.##}", m_frameDilation));
  451. args["Logging in Users"] = OSD.FromString(String.Format("{0:0.##}",
  452. m_usersLoggingIn));
  453. args["GeoPrims"] = OSD.FromString(String.Format("{0:0.##}",
  454. m_totalGeoPrims));
  455. args["Mesh Objects"] = OSD.FromString(String.Format("{0:0.##}",
  456. m_totalMeshes));
  457. args["XEngine Thread Count"] = OSD.FromString(String.Format("{0:0.##}",
  458. m_inUseThreads));
  459. args["Util Thread Count"] = OSD.FromString(String.Format("{0:0.##}",
  460. Util.GetSmartThreadPoolInfo().InUseThreads));
  461. args["System Thread Count"] = OSD.FromString(String.Format(
  462. "{0:0.##}", numberThreadsRunning));
  463. args["ProcMem"] = OSD.FromString(String.Format("{0:#,###,###.##}",
  464. memUsage));
  465. return args;
  466. }
  467. }
  468. /// <summary>
  469. /// Pull packet queue stats from packet queues and report
  470. /// </summary>
  471. public class PacketQueueStatsCollector : IStatsCollector
  472. {
  473. private IPullStatsProvider m_statsProvider;
  474. public PacketQueueStatsCollector(IPullStatsProvider provider)
  475. {
  476. m_statsProvider = provider;
  477. }
  478. /// <summary>
  479. /// Report back collected statistical information.
  480. /// </summary>
  481. /// <returns></returns>
  482. public string Report()
  483. {
  484. return m_statsProvider.GetStats();
  485. }
  486. public string XReport(string uptime, string version)
  487. {
  488. return "";
  489. }
  490. public OSDMap OReport(string uptime, string version)
  491. {
  492. OSDMap ret = new OSDMap();
  493. return ret;
  494. }
  495. }
  496. }