SimStatsReporter.cs 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638
  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. if (!m_scene.Active)
  252. return;
  253. SimStatsPacket.StatBlock[] sb = new SimStatsPacket.StatBlock[22];
  254. SimStatsPacket.RegionBlock rb = new SimStatsPacket.RegionBlock();
  255. // Know what's not thread safe in Mono... modifying timers.
  256. // m_log.Debug("Firing Stats Heart Beat");
  257. lock (m_report)
  258. {
  259. uint regionFlags = 0;
  260. try
  261. {
  262. if (estateModule == null)
  263. estateModule = m_scene.RequestModuleInterface<IEstateModule>();
  264. regionFlags = estateModule != null ? estateModule.GetRegionFlags() : (uint) 0;
  265. }
  266. catch (Exception)
  267. {
  268. // leave region flags at 0
  269. }
  270. #region various statistic googly moogly
  271. // We're going to lie about the FPS because we've been lying since 2008. The actual FPS is currently
  272. // locked at a maximum of 11. Maybe at some point this can change so that we're not lying.
  273. int reportedFPS = (int)(m_fps * m_reportedFpsCorrectionFactor);
  274. // save the reported value so there is something available for llGetRegionFPS
  275. lastReportedSimFPS = reportedFPS / m_statsUpdateFactor;
  276. float physfps = ((m_pfps / 1000));
  277. //if (physfps > 600)
  278. //physfps = physfps - (physfps - 600);
  279. if (physfps < 0)
  280. physfps = 0;
  281. #endregion
  282. m_rootAgents = m_scene.SceneGraph.GetRootAgentCount();
  283. m_childAgents = m_scene.SceneGraph.GetChildAgentCount();
  284. m_numPrim = m_scene.SceneGraph.GetTotalObjectsCount();
  285. m_activePrim = m_scene.SceneGraph.GetActiveObjectsCount();
  286. m_activeScripts = m_scene.SceneGraph.GetActiveScriptsCount();
  287. // FIXME: Checking for stat sanity is a complex approach. What we really need to do is fix the code
  288. // so that stat numbers are always consistent.
  289. CheckStatSanity();
  290. //Our time dilation is 0.91 when we're running a full speed,
  291. // therefore to make sure we get an appropriate range,
  292. // we have to factor in our error. (0.10f * statsUpdateFactor)
  293. // multiplies the fix for the error times the amount of times it'll occur a second
  294. // / 10 divides the value by the number of times the sim heartbeat runs (10fps)
  295. // Then we divide the whole amount by the amount of seconds pass in between stats updates.
  296. // 'statsUpdateFactor' is how often stats packets are sent in seconds. Used below to change
  297. // values to X-per-second values.
  298. uint thisFrame = m_scene.Frame;
  299. float framesUpdated = (float)(thisFrame - m_lastUpdateFrame) * m_reportedFpsCorrectionFactor;
  300. m_lastUpdateFrame = thisFrame;
  301. // Avoid div-by-zero if somehow we've not updated any frames.
  302. if (framesUpdated == 0)
  303. framesUpdated = 1;
  304. for (int i = 0; i < 22; i++)
  305. {
  306. sb[i] = new SimStatsPacket.StatBlock();
  307. }
  308. sb[0].StatID = (uint) Stats.TimeDilation;
  309. sb[0].StatValue = (Single.IsNaN(m_timeDilation)) ? 0.1f : m_timeDilation ; //((((m_timeDilation + (0.10f * statsUpdateFactor)) /10) / statsUpdateFactor));
  310. sb[1].StatID = (uint) Stats.SimFPS;
  311. sb[1].StatValue = reportedFPS / m_statsUpdateFactor;
  312. sb[2].StatID = (uint) Stats.PhysicsFPS;
  313. sb[2].StatValue = physfps / m_statsUpdateFactor;
  314. sb[3].StatID = (uint) Stats.AgentUpdates;
  315. sb[3].StatValue = (m_agentUpdates / m_statsUpdateFactor);
  316. sb[4].StatID = (uint) Stats.Agents;
  317. sb[4].StatValue = m_rootAgents;
  318. sb[5].StatID = (uint) Stats.ChildAgents;
  319. sb[5].StatValue = m_childAgents;
  320. sb[6].StatID = (uint) Stats.TotalPrim;
  321. sb[6].StatValue = m_numPrim;
  322. sb[7].StatID = (uint) Stats.ActivePrim;
  323. sb[7].StatValue = m_activePrim;
  324. sb[8].StatID = (uint)Stats.FrameMS;
  325. sb[8].StatValue = m_frameMS / framesUpdated;
  326. sb[9].StatID = (uint)Stats.NetMS;
  327. sb[9].StatValue = m_netMS / framesUpdated;
  328. sb[10].StatID = (uint)Stats.PhysicsMS;
  329. sb[10].StatValue = m_physicsMS / framesUpdated;
  330. sb[11].StatID = (uint)Stats.ImageMS ;
  331. sb[11].StatValue = m_imageMS / framesUpdated;
  332. sb[12].StatID = (uint)Stats.OtherMS;
  333. sb[12].StatValue = m_otherMS / framesUpdated;
  334. sb[13].StatID = (uint)Stats.InPacketsPerSecond;
  335. sb[13].StatValue = (m_inPacketsPerSecond / m_statsUpdateFactor);
  336. sb[14].StatID = (uint)Stats.OutPacketsPerSecond;
  337. sb[14].StatValue = (m_outPacketsPerSecond / m_statsUpdateFactor);
  338. sb[15].StatID = (uint)Stats.UnAckedBytes;
  339. sb[15].StatValue = m_unAckedBytes;
  340. sb[16].StatID = (uint)Stats.AgentMS;
  341. sb[16].StatValue = m_agentMS / framesUpdated;
  342. sb[17].StatID = (uint)Stats.PendingDownloads;
  343. sb[17].StatValue = m_pendingDownloads;
  344. sb[18].StatID = (uint)Stats.PendingUploads;
  345. sb[18].StatValue = m_pendingUploads;
  346. sb[19].StatID = (uint)Stats.ActiveScripts;
  347. sb[19].StatValue = m_activeScripts;
  348. sb[20].StatID = (uint)Stats.ScriptLinesPerSecond;
  349. sb[20].StatValue = m_scriptLinesPerSecond / m_statsUpdateFactor;
  350. sb[21].StatID = (uint)Stats.SimSpareMs;
  351. sb[21].StatValue = m_spareMS / framesUpdated;
  352. for (int i = 0; i < 22; i++)
  353. {
  354. lastReportedSimStats[i] = sb[i].StatValue;
  355. }
  356. SimStats simStats
  357. = new SimStats(
  358. ReportingRegion.RegionLocX, ReportingRegion.RegionLocY, regionFlags, (uint)m_objectCapacity,
  359. rb, sb, m_scene.RegionInfo.originRegionID);
  360. handlerSendStatResult = OnSendStatsResult;
  361. if (handlerSendStatResult != null)
  362. {
  363. handlerSendStatResult(simStats);
  364. }
  365. // Extra statistics that aren't currently sent to clients
  366. lock (m_lastReportedExtraSimStats)
  367. {
  368. m_lastReportedExtraSimStats[LastReportedObjectUpdateStatName] = m_objectUpdates / m_statsUpdateFactor;
  369. m_lastReportedExtraSimStats[SlowFramesStat.ShortName] = (float)SlowFramesStat.Value;
  370. Dictionary<string, float> physicsStats = m_scene.PhysicsScene.GetStats();
  371. if (physicsStats != null)
  372. {
  373. foreach (KeyValuePair<string, float> tuple in physicsStats)
  374. {
  375. // FIXME: An extremely dirty hack to divide MS stats per frame rather than per second
  376. // Need to change things so that stats source can indicate whether they are per second or
  377. // per frame.
  378. if (tuple.Key.EndsWith("MS"))
  379. m_lastReportedExtraSimStats[tuple.Key] = tuple.Value / framesUpdated;
  380. else
  381. m_lastReportedExtraSimStats[tuple.Key] = tuple.Value / m_statsUpdateFactor;
  382. }
  383. }
  384. }
  385. ResetValues();
  386. }
  387. }
  388. private void ResetValues()
  389. {
  390. m_timeDilation = 0;
  391. m_fps = 0;
  392. m_pfps = 0;
  393. m_agentUpdates = 0;
  394. m_objectUpdates = 0;
  395. //m_inPacketsPerSecond = 0;
  396. //m_outPacketsPerSecond = 0;
  397. m_unAckedBytes = 0;
  398. m_scriptLinesPerSecond = 0;
  399. m_frameMS = 0;
  400. m_agentMS = 0;
  401. m_netMS = 0;
  402. m_physicsMS = 0;
  403. m_imageMS = 0;
  404. m_otherMS = 0;
  405. m_spareMS = 0;
  406. //Ckrinke This variable is not used, so comment to remove compiler warning until it is used.
  407. //Ckrinke m_scriptMS = 0;
  408. }
  409. # region methods called from Scene
  410. // The majority of these functions are additive
  411. // so that you can easily change the amount of
  412. // seconds in between sim stats updates
  413. public void AddTimeDilation(float td)
  414. {
  415. //float tdsetting = td;
  416. //if (tdsetting > 1.0f)
  417. //tdsetting = (tdsetting - (tdsetting - 0.91f));
  418. //if (tdsetting < 0)
  419. //tdsetting = 0.0f;
  420. m_timeDilation = td;
  421. }
  422. internal void CheckStatSanity()
  423. {
  424. if (m_rootAgents < 0 || m_childAgents < 0)
  425. {
  426. handlerStatsIncorrect = OnStatsIncorrect;
  427. if (handlerStatsIncorrect != null)
  428. {
  429. handlerStatsIncorrect();
  430. }
  431. }
  432. if (m_rootAgents == 0 && m_childAgents == 0)
  433. {
  434. m_unAckedBytes = 0;
  435. }
  436. }
  437. public void AddFPS(int frames)
  438. {
  439. m_fps += frames;
  440. }
  441. public void AddPhysicsFPS(float frames)
  442. {
  443. m_pfps += frames;
  444. }
  445. public void AddObjectUpdates(int numUpdates)
  446. {
  447. m_objectUpdates += numUpdates;
  448. }
  449. public void AddAgentUpdates(int numUpdates)
  450. {
  451. m_agentUpdates += numUpdates;
  452. }
  453. public void AddInPackets(int numPackets)
  454. {
  455. m_inPacketsPerSecond = numPackets;
  456. }
  457. public void AddOutPackets(int numPackets)
  458. {
  459. m_outPacketsPerSecond = numPackets;
  460. }
  461. public void AddunAckedBytes(int numBytes)
  462. {
  463. m_unAckedBytes += numBytes;
  464. if (m_unAckedBytes < 0) m_unAckedBytes = 0;
  465. }
  466. public void addFrameMS(int ms)
  467. {
  468. m_frameMS += ms;
  469. // At the moment, we'll only report if a frame is over 120% of target, since commonly frames are a bit
  470. // longer than ideal due to the inaccuracy of the Sleep in Scene.Update() (which in itself is a concern).
  471. if (ms > SlowFramesStatReportThreshold)
  472. SlowFramesStat.Value++;
  473. }
  474. public void AddSpareMS(int ms)
  475. {
  476. m_spareMS += ms;
  477. }
  478. public void addNetMS(int ms)
  479. {
  480. m_netMS += ms;
  481. }
  482. public void addAgentMS(int ms)
  483. {
  484. m_agentMS += ms;
  485. }
  486. public void addPhysicsMS(int ms)
  487. {
  488. m_physicsMS += ms;
  489. }
  490. public void addImageMS(int ms)
  491. {
  492. m_imageMS += ms;
  493. }
  494. public void addOtherMS(int ms)
  495. {
  496. m_otherMS += ms;
  497. }
  498. public void AddPendingDownloads(int count)
  499. {
  500. m_pendingDownloads += count;
  501. if (m_pendingDownloads < 0)
  502. m_pendingDownloads = 0;
  503. //m_log.InfoFormat("[stats]: Adding {0} to pending downloads to make {1}", count, m_pendingDownloads);
  504. }
  505. public void addScriptLines(int count)
  506. {
  507. m_scriptLinesPerSecond += count;
  508. }
  509. public void AddPacketsStats(int inPackets, int outPackets, int unAckedBytes)
  510. {
  511. AddInPackets(inPackets);
  512. AddOutPackets(outPackets);
  513. AddunAckedBytes(unAckedBytes);
  514. }
  515. #endregion
  516. public Dictionary<string, float> GetExtraSimStats()
  517. {
  518. lock (m_lastReportedExtraSimStats)
  519. return new Dictionary<string, float>(m_lastReportedExtraSimStats);
  520. }
  521. }
  522. }