SimStatsReporter.cs 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635
  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.Timers;
  30. using OpenMetaverse.Packets;
  31. using OpenSim.Framework;
  32. using OpenSim.Framework.Monitoring;
  33. using OpenSim.Region.Framework.Interfaces;
  34. namespace OpenSim.Region.Framework.Scenes
  35. {
  36. /// <summary>
  37. /// Collect statistics from the scene to send to the client and for access by other monitoring tools.
  38. /// </summary>
  39. /// <remarks>
  40. /// FIXME: This should be a monitoring region module
  41. /// </remarks>
  42. public class SimStatsReporter
  43. {
  44. private static readonly log4net.ILog m_log
  45. = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
  46. public const string LastReportedObjectUpdateStatName = "LastReportedObjectUpdates";
  47. public const string SlowFramesStatName = "SlowFrames";
  48. public delegate void SendStatResult(SimStats stats);
  49. public delegate void YourStatsAreWrong();
  50. public event SendStatResult OnSendStatsResult;
  51. public event YourStatsAreWrong OnStatsIncorrect;
  52. private SendStatResult handlerSendStatResult;
  53. private YourStatsAreWrong handlerStatsIncorrect;
  54. /// <summary>
  55. /// These are the IDs of stats sent in the StatsPacket to the viewer.
  56. /// </summary>
  57. /// <remarks>
  58. /// Some of these are not relevant to OpenSimulator since it is architected differently to other simulators
  59. /// (e.g. script instructions aren't executed as part of the frame loop so 'script time' is tricky).
  60. /// </remarks>
  61. public enum Stats : uint
  62. {
  63. TimeDilation = 0,
  64. SimFPS = 1,
  65. PhysicsFPS = 2,
  66. AgentUpdates = 3,
  67. FrameMS = 4,
  68. NetMS = 5,
  69. OtherMS = 6,
  70. PhysicsMS = 7,
  71. AgentMS = 8,
  72. ImageMS = 9,
  73. ScriptMS = 10,
  74. TotalPrim = 11,
  75. ActivePrim = 12,
  76. Agents = 13,
  77. ChildAgents = 14,
  78. ActiveScripts = 15,
  79. ScriptLinesPerSecond = 16,
  80. InPacketsPerSecond = 17,
  81. OutPacketsPerSecond = 18,
  82. PendingDownloads = 19,
  83. PendingUploads = 20,
  84. VirtualSizeKb = 21,
  85. ResidentSizeKb = 22,
  86. PendingLocalUploads = 23,
  87. UnAckedBytes = 24,
  88. PhysicsPinnedTasks = 25,
  89. PhysicsLodTasks = 26,
  90. SimPhysicsStepMs = 27,
  91. SimPhysicsShapeMs = 28,
  92. SimPhysicsOtherMs = 29,
  93. SimPhysicsMemory = 30,
  94. ScriptEps = 31,
  95. SimSpareMs = 32,
  96. SimSleepMs = 33,
  97. SimIoPumpTime = 34
  98. }
  99. /// <summary>
  100. /// This is for llGetRegionFPS
  101. /// </summary>
  102. public float LastReportedSimFPS
  103. {
  104. get { return lastReportedSimFPS; }
  105. }
  106. /// <summary>
  107. /// Number of object updates performed in the last stats cycle
  108. /// </summary>
  109. /// <remarks>
  110. /// This isn't sent out to the client but it is very useful data to detect whether viewers are being sent a
  111. /// large number of object updates.
  112. /// </remarks>
  113. public float LastReportedObjectUpdates { get; private set; }
  114. public float[] LastReportedSimStats
  115. {
  116. get { return lastReportedSimStats; }
  117. }
  118. /// <summary>
  119. /// Number of frames that have taken longer to process than Scene.MIN_FRAME_TIME
  120. /// </summary>
  121. public Stat SlowFramesStat { get; private set; }
  122. /// <summary>
  123. /// The threshold at which we log a slow frame.
  124. /// </summary>
  125. public int SlowFramesStatReportThreshold { get; private set; }
  126. /// <summary>
  127. /// Extra sim statistics that are used by monitors but not sent to the client.
  128. /// </summary>
  129. /// <value>
  130. /// The keys are the stat names.
  131. /// </value>
  132. private Dictionary<string, float> m_lastReportedExtraSimStats = new Dictionary<string, float>();
  133. // Sending a stats update every 3 seconds-
  134. private int m_statsUpdatesEveryMS = 3000;
  135. private float m_statsUpdateFactor;
  136. private float m_timeDilation;
  137. private int m_fps;
  138. /// <summary>
  139. /// Number of the last frame on which we processed a stats udpate.
  140. /// </summary>
  141. private uint m_lastUpdateFrame;
  142. /// <summary>
  143. /// Our nominal fps target, as expected in fps stats when a sim is running normally.
  144. /// </summary>
  145. private float m_nominalReportedFps = 55;
  146. /// <summary>
  147. /// Parameter to adjust reported scene fps
  148. /// </summary>
  149. /// <remarks>
  150. /// Our scene loop runs slower than other server implementations, apparantly because we work somewhat differently.
  151. /// However, we will still report an FPS that's closer to what people are used to seeing. A lower FPS might
  152. /// affect clients and monitoring scripts/software.
  153. /// </remarks>
  154. private float m_reportedFpsCorrectionFactor = 5;
  155. // saved last reported value so there is something available for llGetRegionFPS
  156. private float lastReportedSimFPS;
  157. private float[] lastReportedSimStats = new float[22];
  158. private float m_pfps;
  159. /// <summary>
  160. /// Number of agent updates requested in this stats cycle
  161. /// </summary>
  162. private int m_agentUpdates;
  163. /// <summary>
  164. /// Number of object updates requested in this stats cycle
  165. /// </summary>
  166. private int m_objectUpdates;
  167. private int m_frameMS;
  168. private int m_spareMS;
  169. private int m_netMS;
  170. private int m_agentMS;
  171. private int m_physicsMS;
  172. private int m_imageMS;
  173. private int m_otherMS;
  174. //Ckrinke: (3-21-08) Comment out to remove a compiler warning. Bring back into play when needed.
  175. //Ckrinke private int m_scriptMS = 0;
  176. private int m_rootAgents;
  177. private int m_childAgents;
  178. private int m_numPrim;
  179. private int m_inPacketsPerSecond;
  180. private int m_outPacketsPerSecond;
  181. private int m_activePrim;
  182. private int m_unAckedBytes;
  183. private int m_pendingDownloads;
  184. private int m_pendingUploads = 0; // FIXME: Not currently filled in
  185. private int m_activeScripts;
  186. private int m_scriptLinesPerSecond;
  187. private int m_objectCapacity = 45000;
  188. private Scene m_scene;
  189. private RegionInfo ReportingRegion;
  190. private Timer m_report = new Timer();
  191. private IEstateModule estateModule;
  192. public SimStatsReporter(Scene scene)
  193. {
  194. m_scene = scene;
  195. m_reportedFpsCorrectionFactor = scene.MinFrameTime * m_nominalReportedFps;
  196. m_statsUpdateFactor = (float)(m_statsUpdatesEveryMS / 1000);
  197. ReportingRegion = scene.RegionInfo;
  198. m_objectCapacity = scene.RegionInfo.ObjectCapacity;
  199. m_report.AutoReset = true;
  200. m_report.Interval = m_statsUpdatesEveryMS;
  201. m_report.Elapsed += TriggerStatsHeartbeat;
  202. m_report.Enabled = true;
  203. if (StatsManager.SimExtraStats != null)
  204. OnSendStatsResult += StatsManager.SimExtraStats.ReceiveClassicSimStatsPacket;
  205. /// At the moment, we'll only report if a frame is over 120% of target, since commonly frames are a bit
  206. /// longer than ideal (which in itself is a concern).
  207. SlowFramesStatReportThreshold = (int)Math.Ceiling(m_scene.MinFrameTime * 1000 * 1.2);
  208. SlowFramesStat
  209. = new Stat(
  210. "SlowFrames",
  211. "Slow Frames",
  212. "Number of frames where frame time has been significantly longer than the desired frame time.",
  213. " frames",
  214. "scene",
  215. m_scene.Name,
  216. StatType.Push,
  217. null,
  218. StatVerbosity.Info);
  219. StatsManager.RegisterStat(SlowFramesStat);
  220. }
  221. public void Close()
  222. {
  223. m_report.Elapsed -= TriggerStatsHeartbeat;
  224. m_report.Close();
  225. }
  226. /// <summary>
  227. /// Sets the number of milliseconds between stat updates.
  228. /// </summary>
  229. /// <param name='ms'></param>
  230. public void SetUpdateMS(int ms)
  231. {
  232. m_statsUpdatesEveryMS = ms;
  233. m_statsUpdateFactor = (float)(m_statsUpdatesEveryMS / 1000);
  234. m_report.Interval = m_statsUpdatesEveryMS;
  235. }
  236. private void TriggerStatsHeartbeat(object sender, EventArgs args)
  237. {
  238. try
  239. {
  240. statsHeartBeat(sender, args);
  241. }
  242. catch (Exception e)
  243. {
  244. m_log.Warn(string.Format(
  245. "[SIM STATS REPORTER] Update for {0} failed with exception ",
  246. m_scene.RegionInfo.RegionName), e);
  247. }
  248. }
  249. private void statsHeartBeat(object sender, EventArgs e)
  250. {
  251. SimStatsPacket.StatBlock[] sb = new SimStatsPacket.StatBlock[22];
  252. SimStatsPacket.RegionBlock rb = new SimStatsPacket.RegionBlock();
  253. // Know what's not thread safe in Mono... modifying timers.
  254. // m_log.Debug("Firing Stats Heart Beat");
  255. lock (m_report)
  256. {
  257. uint regionFlags = 0;
  258. try
  259. {
  260. if (estateModule == null)
  261. estateModule = m_scene.RequestModuleInterface<IEstateModule>();
  262. regionFlags = estateModule != null ? estateModule.GetRegionFlags() : (uint) 0;
  263. }
  264. catch (Exception)
  265. {
  266. // leave region flags at 0
  267. }
  268. #region various statistic googly moogly
  269. // We're going to lie about the FPS because we've been lying since 2008. The actual FPS is currently
  270. // locked at a maximum of 11. Maybe at some point this can change so that we're not lying.
  271. int reportedFPS = (int)(m_fps * m_reportedFpsCorrectionFactor);
  272. // save the reported value so there is something available for llGetRegionFPS
  273. lastReportedSimFPS = reportedFPS / m_statsUpdateFactor;
  274. float physfps = ((m_pfps / 1000));
  275. //if (physfps > 600)
  276. //physfps = physfps - (physfps - 600);
  277. if (physfps < 0)
  278. physfps = 0;
  279. #endregion
  280. m_rootAgents = m_scene.SceneGraph.GetRootAgentCount();
  281. m_childAgents = m_scene.SceneGraph.GetChildAgentCount();
  282. m_numPrim = m_scene.SceneGraph.GetTotalObjectsCount();
  283. m_activePrim = m_scene.SceneGraph.GetActiveObjectsCount();
  284. m_activeScripts = m_scene.SceneGraph.GetActiveScriptsCount();
  285. // FIXME: Checking for stat sanity is a complex approach. What we really need to do is fix the code
  286. // so that stat numbers are always consistent.
  287. CheckStatSanity();
  288. //Our time dilation is 0.91 when we're running a full speed,
  289. // therefore to make sure we get an appropriate range,
  290. // we have to factor in our error. (0.10f * statsUpdateFactor)
  291. // multiplies the fix for the error times the amount of times it'll occur a second
  292. // / 10 divides the value by the number of times the sim heartbeat runs (10fps)
  293. // Then we divide the whole amount by the amount of seconds pass in between stats updates.
  294. // 'statsUpdateFactor' is how often stats packets are sent in seconds. Used below to change
  295. // values to X-per-second values.
  296. uint thisFrame = m_scene.Frame;
  297. float framesUpdated = (float)(thisFrame - m_lastUpdateFrame) * m_reportedFpsCorrectionFactor;
  298. m_lastUpdateFrame = thisFrame;
  299. // Avoid div-by-zero if somehow we've not updated any frames.
  300. if (framesUpdated == 0)
  301. framesUpdated = 1;
  302. for (int i = 0; i < 22; i++)
  303. {
  304. sb[i] = new SimStatsPacket.StatBlock();
  305. }
  306. sb[0].StatID = (uint) Stats.TimeDilation;
  307. sb[0].StatValue = (Single.IsNaN(m_timeDilation)) ? 0.1f : m_timeDilation ; //((((m_timeDilation + (0.10f * statsUpdateFactor)) /10) / statsUpdateFactor));
  308. sb[1].StatID = (uint) Stats.SimFPS;
  309. sb[1].StatValue = reportedFPS / m_statsUpdateFactor;
  310. sb[2].StatID = (uint) Stats.PhysicsFPS;
  311. sb[2].StatValue = physfps / m_statsUpdateFactor;
  312. sb[3].StatID = (uint) Stats.AgentUpdates;
  313. sb[3].StatValue = (m_agentUpdates / m_statsUpdateFactor);
  314. sb[4].StatID = (uint) Stats.Agents;
  315. sb[4].StatValue = m_rootAgents;
  316. sb[5].StatID = (uint) Stats.ChildAgents;
  317. sb[5].StatValue = m_childAgents;
  318. sb[6].StatID = (uint) Stats.TotalPrim;
  319. sb[6].StatValue = m_numPrim;
  320. sb[7].StatID = (uint) Stats.ActivePrim;
  321. sb[7].StatValue = m_activePrim;
  322. sb[8].StatID = (uint)Stats.FrameMS;
  323. sb[8].StatValue = m_frameMS / framesUpdated;
  324. sb[9].StatID = (uint)Stats.NetMS;
  325. sb[9].StatValue = m_netMS / framesUpdated;
  326. sb[10].StatID = (uint)Stats.PhysicsMS;
  327. sb[10].StatValue = m_physicsMS / framesUpdated;
  328. sb[11].StatID = (uint)Stats.ImageMS ;
  329. sb[11].StatValue = m_imageMS / framesUpdated;
  330. sb[12].StatID = (uint)Stats.OtherMS;
  331. sb[12].StatValue = m_otherMS / framesUpdated;
  332. sb[13].StatID = (uint)Stats.InPacketsPerSecond;
  333. sb[13].StatValue = (m_inPacketsPerSecond / m_statsUpdateFactor);
  334. sb[14].StatID = (uint)Stats.OutPacketsPerSecond;
  335. sb[14].StatValue = (m_outPacketsPerSecond / m_statsUpdateFactor);
  336. sb[15].StatID = (uint)Stats.UnAckedBytes;
  337. sb[15].StatValue = m_unAckedBytes;
  338. sb[16].StatID = (uint)Stats.AgentMS;
  339. sb[16].StatValue = m_agentMS / framesUpdated;
  340. sb[17].StatID = (uint)Stats.PendingDownloads;
  341. sb[17].StatValue = m_pendingDownloads;
  342. sb[18].StatID = (uint)Stats.PendingUploads;
  343. sb[18].StatValue = m_pendingUploads;
  344. sb[19].StatID = (uint)Stats.ActiveScripts;
  345. sb[19].StatValue = m_activeScripts;
  346. sb[20].StatID = (uint)Stats.ScriptLinesPerSecond;
  347. sb[20].StatValue = m_scriptLinesPerSecond / m_statsUpdateFactor;
  348. sb[21].StatID = (uint)Stats.SimSpareMs;
  349. sb[21].StatValue = m_spareMS / framesUpdated;
  350. for (int i = 0; i < 22; i++)
  351. {
  352. lastReportedSimStats[i] = sb[i].StatValue;
  353. }
  354. SimStats simStats
  355. = new SimStats(
  356. ReportingRegion.RegionLocX, ReportingRegion.RegionLocY, regionFlags, (uint)m_objectCapacity,
  357. rb, sb, m_scene.RegionInfo.originRegionID);
  358. handlerSendStatResult = OnSendStatsResult;
  359. if (handlerSendStatResult != null)
  360. {
  361. handlerSendStatResult(simStats);
  362. }
  363. // Extra statistics that aren't currently sent to clients
  364. lock (m_lastReportedExtraSimStats)
  365. {
  366. m_lastReportedExtraSimStats[LastReportedObjectUpdateStatName] = m_objectUpdates / m_statsUpdateFactor;
  367. m_lastReportedExtraSimStats[SlowFramesStat.ShortName] = (float)SlowFramesStat.Value;
  368. Dictionary<string, float> physicsStats = m_scene.PhysicsScene.GetStats();
  369. if (physicsStats != null)
  370. {
  371. foreach (KeyValuePair<string, float> tuple in physicsStats)
  372. {
  373. // FIXME: An extremely dirty hack to divide MS stats per frame rather than per second
  374. // Need to change things so that stats source can indicate whether they are per second or
  375. // per frame.
  376. if (tuple.Key.EndsWith("MS"))
  377. m_lastReportedExtraSimStats[tuple.Key] = tuple.Value / framesUpdated;
  378. else
  379. m_lastReportedExtraSimStats[tuple.Key] = tuple.Value / m_statsUpdateFactor;
  380. }
  381. }
  382. }
  383. ResetValues();
  384. }
  385. }
  386. private void ResetValues()
  387. {
  388. m_timeDilation = 0;
  389. m_fps = 0;
  390. m_pfps = 0;
  391. m_agentUpdates = 0;
  392. m_objectUpdates = 0;
  393. //m_inPacketsPerSecond = 0;
  394. //m_outPacketsPerSecond = 0;
  395. m_unAckedBytes = 0;
  396. m_scriptLinesPerSecond = 0;
  397. m_frameMS = 0;
  398. m_agentMS = 0;
  399. m_netMS = 0;
  400. m_physicsMS = 0;
  401. m_imageMS = 0;
  402. m_otherMS = 0;
  403. m_spareMS = 0;
  404. //Ckrinke This variable is not used, so comment to remove compiler warning until it is used.
  405. //Ckrinke m_scriptMS = 0;
  406. }
  407. # region methods called from Scene
  408. // The majority of these functions are additive
  409. // so that you can easily change the amount of
  410. // seconds in between sim stats updates
  411. public void AddTimeDilation(float td)
  412. {
  413. //float tdsetting = td;
  414. //if (tdsetting > 1.0f)
  415. //tdsetting = (tdsetting - (tdsetting - 0.91f));
  416. //if (tdsetting < 0)
  417. //tdsetting = 0.0f;
  418. m_timeDilation = td;
  419. }
  420. internal void CheckStatSanity()
  421. {
  422. if (m_rootAgents < 0 || m_childAgents < 0)
  423. {
  424. handlerStatsIncorrect = OnStatsIncorrect;
  425. if (handlerStatsIncorrect != null)
  426. {
  427. handlerStatsIncorrect();
  428. }
  429. }
  430. if (m_rootAgents == 0 && m_childAgents == 0)
  431. {
  432. m_unAckedBytes = 0;
  433. }
  434. }
  435. public void AddFPS(int frames)
  436. {
  437. m_fps += frames;
  438. }
  439. public void AddPhysicsFPS(float frames)
  440. {
  441. m_pfps += frames;
  442. }
  443. public void AddObjectUpdates(int numUpdates)
  444. {
  445. m_objectUpdates += numUpdates;
  446. }
  447. public void AddAgentUpdates(int numUpdates)
  448. {
  449. m_agentUpdates += numUpdates;
  450. }
  451. public void AddInPackets(int numPackets)
  452. {
  453. m_inPacketsPerSecond = numPackets;
  454. }
  455. public void AddOutPackets(int numPackets)
  456. {
  457. m_outPacketsPerSecond = numPackets;
  458. }
  459. public void AddunAckedBytes(int numBytes)
  460. {
  461. m_unAckedBytes += numBytes;
  462. if (m_unAckedBytes < 0) m_unAckedBytes = 0;
  463. }
  464. public void addFrameMS(int ms)
  465. {
  466. m_frameMS += ms;
  467. // At the moment, we'll only report if a frame is over 120% of target, since commonly frames are a bit
  468. // longer than ideal due to the inaccuracy of the Sleep in Scene.Update() (which in itself is a concern).
  469. if (ms > SlowFramesStatReportThreshold)
  470. SlowFramesStat.Value++;
  471. }
  472. public void AddSpareMS(int ms)
  473. {
  474. m_spareMS += ms;
  475. }
  476. public void addNetMS(int ms)
  477. {
  478. m_netMS += ms;
  479. }
  480. public void addAgentMS(int ms)
  481. {
  482. m_agentMS += ms;
  483. }
  484. public void addPhysicsMS(int ms)
  485. {
  486. m_physicsMS += ms;
  487. }
  488. public void addImageMS(int ms)
  489. {
  490. m_imageMS += ms;
  491. }
  492. public void addOtherMS(int ms)
  493. {
  494. m_otherMS += ms;
  495. }
  496. public void AddPendingDownloads(int count)
  497. {
  498. m_pendingDownloads += count;
  499. if (m_pendingDownloads < 0)
  500. m_pendingDownloads = 0;
  501. //m_log.InfoFormat("[stats]: Adding {0} to pending downloads to make {1}", count, m_pendingDownloads);
  502. }
  503. public void addScriptLines(int count)
  504. {
  505. m_scriptLinesPerSecond += count;
  506. }
  507. public void AddPacketsStats(int inPackets, int outPackets, int unAckedBytes)
  508. {
  509. AddInPackets(inPackets);
  510. AddOutPackets(outPackets);
  511. AddunAckedBytes(unAckedBytes);
  512. }
  513. #endregion
  514. public Dictionary<string, float> GetExtraSimStats()
  515. {
  516. lock (m_lastReportedExtraSimStats)
  517. return new Dictionary<string, float>(m_lastReportedExtraSimStats);
  518. }
  519. }
  520. }