sim.html 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  2. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml">
  4. <head>
  5. <title>Simulator statistics</title>
  6. <link rel="stylesheet" href="sim.css" type="text/css"/>
  7. <!-- <script type="text/javascript" src="jquery.js"></script> -->
  8. <!-- <script type="text/javascript" src="https://code.jquery.com/jquery-1.9.0.min.js"></script> -->
  9. <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
  10. <!-- <script type="text/javascript" src="https://ajax.aspnetcdn.com/ajax/libs/jQuery/jquery-1.9.0.min.js"></script> -->
  11. <noscript>
  12. <p color="red">
  13. Your browser does not support Javascript. This won't work for you.
  14. </p>
  15. </noscript>
  16. <script type="text/javascript">
  17. $(document).ready(function() {
  18. // Major divisions in the content accordioning
  19. $('.SimSection').show('slow');
  20. $('.SimSectionHeader').click(function() {
  21. $(this).next().slideToggle('slow');
  22. return false;
  23. });
  24. // Start the timed functions
  25. TimerDataStuff();
  26. });
  27. // One of the sections is viewer statistics. Poll for the data.
  28. var statTimerHandle;
  29. var graphFPS;
  30. var lastFPS = 10;
  31. var xxThru = 0;
  32. function TimerDataStuff() {
  33. statTimerHandle = setInterval('TimerStatDisplay()', 5000);
  34. }
  35. // called by timer to fetch and display statistic information
  36. var doingStatDisplay = false;
  37. function TimerStatDisplay() {
  38. if (doingStatDisplay) return;
  39. doingStatDisplay = true;
  40. if ($('#SimSimStats').is(':visible')) {
  41. DisplaySimStats();
  42. }
  43. if ($('#SimRegionStats').is(':visible')) {
  44. DisplayPerRegionStats();
  45. }
  46. if ($('#SimSessionStats').is(':visible')) {
  47. DisplaySessionStats();
  48. }
  49. if ($('#SimLogFile').is(':visible')) {
  50. DisplayLogFile();
  51. }
  52. doingStatDisplay = false;
  53. }
  54. var simName = "127.0.0.1";
  55. var simPort = "9000";
  56. function DisplaySimStats() {
  57. var statURL = "http://" + simName + ":" + simPort + "/SStats/?json=1";
  58. $.ajax({
  59. type: "GET",
  60. url: statURL,
  61. dataType: 'json',
  62. timeout: 1000,
  63. success: function(data, status) {
  64. if (status == 'success') {
  65. DisplaySimStatDetails(data);
  66. }
  67. },
  68. error: function(xmlHTTPRequest, errorType) {
  69. // DebugLog('Failed fetch');
  70. }
  71. });
  72. }
  73. function DisplayPerRegionStats() {
  74. var statURL = "http://" + simName + ":" + simPort + "/SStats/simstatsajax.html?json=1";
  75. $.ajax({
  76. type: "GET",
  77. url: statURL,
  78. dataType: 'json',
  79. timeout: 1000,
  80. success: function(data, status) {
  81. if (status == 'success') {
  82. DisplayRegionStatDetails(data);
  83. }
  84. },
  85. error: function(xmlHTTPRequest, errorType) {
  86. // DebugLog('Failed fetch');
  87. }
  88. });
  89. };
  90. function DisplayLogFile() {
  91. var statURL = "http://" + simName + ":" + simPort + "/SStats/activelogajax.html?json=1";
  92. $.ajax({
  93. type: "GET",
  94. url: statURL,
  95. dataType: 'json',
  96. timeout: 1000,
  97. success: function(data, status) {
  98. if (status == 'success') {
  99. DisplayLogFileDetails(data);
  100. }
  101. },
  102. error: function(xmlHTTPRequest, errorType) {
  103. // DebugLog('Failed fetch');
  104. }
  105. });
  106. };
  107. function DisplaySessionStats() {
  108. var statURL = "http://" + simName + ":" + simPort + "/SStats/activeconnectionsajax.html?json=1";
  109. $.ajax({
  110. type: "GET",
  111. url: statURL,
  112. dataType: 'json',
  113. timeout: 1000,
  114. success: function(data, status) {
  115. if (status == 'success') {
  116. DisplaySessionStatsDetails(data);
  117. }
  118. },
  119. error: function(xmlHTTPRequest, errorType) {
  120. // DebugLog('Failed fetch');
  121. }
  122. });
  123. };
  124. function DisplaySimStatDetails(data) {
  125. var simInfo = new StringBuffer();
  126. simInfo.append('<table id="RegionStatsTable">');
  127. simInfo.append('<tr>');
  128. simInfo.append('<th>Total Users</th>');
  129. simInfo.append('<th>Total Sessions</th>');
  130. simInfo.append('<th>Avg client FPS</th>');
  131. simInfo.append('<th>Avg client Mem</th>');
  132. simInfo.append('<th>Avg ping time</th>');
  133. simInfo.append('<th>KB out</th>');
  134. simInfo.append('<th>KB in</th>');
  135. simInfo.append('</tr>');
  136. simInfo.append('<tr>');
  137. simInfo.append('<td>' + data.totalUsers + '</td>');
  138. simInfo.append('<td>' + data.totalSessions + '</td>');
  139. simInfo.append('<td>' + data.averageClientFPS + '</td>');
  140. simInfo.append('<td>' + data.averageClientMem + '</td>');
  141. simInfo.append('<td>' + data.averagePingTime + '</td>');
  142. simInfo.append('<td>' + data.totalKBOut + '</td>');
  143. simInfo.append('<td>' + data.totalKBIn + '</td>');
  144. simInfo.append('</tr>');
  145. simInfo.append('</table>');
  146. $('#SimSimStats').empty();
  147. $('#SimSimStats').append(simInfo.toString());
  148. }
  149. function DisplayRegionStatDetails(data) {
  150. var regionInfo = new StringBuffer();
  151. regionInfo.append('<table id="RegionStatsTable">');
  152. regionInfo.append('<tr>');
  153. regionInfo.append('<th>Region</th>');
  154. regionInfo.append('<th>Agents</th>');
  155. regionInfo.append('<th>Child</th>');
  156. regionInfo.append('<th>FPS</th>');
  157. regionInfo.append('<th>Frame Time</th>');
  158. regionInfo.append('<th>Phys Time</th>');
  159. regionInfo.append('<th>Prims</th>');
  160. regionInfo.append('</tr>');
  161. for (region in data) {
  162. regionInfo.append('<tr>');
  163. regionInfo.append('<td>' + data[region].region + '</td>');
  164. regionInfo.append('<td>' + data[region].rootAgents + '</td>');
  165. regionInfo.append('<td>' + data[region].childAgents + '</td>');
  166. regionInfo.append('<td>' + data[region].simFPS + '</td>');
  167. regionInfo.append('<td>' + data[region].totalFrameTime + '</td>');
  168. regionInfo.append('<td>' + data[region].physicsFrameTime + '</td>');
  169. regionInfo.append('<td>' + data[region].totalPrims + '</td>');
  170. regionInfo.append('</tr>');
  171. }
  172. regionInfo.append('</table>');
  173. $('#SimRegionStats').empty();
  174. $('#SimRegionStats').append(regionInfo.toString());
  175. }
  176. function DisplayLogFileDetails(data) {
  177. var logInfo = new StringBuffer();
  178. var logPattern = /^(.+),\d\d\d .* \[(.+)\]: (.+)$/;
  179. for (logLine in data['logLines']) {
  180. logInfo.append('<div>');
  181. var logPieces = logPattern.exec(data['logLines'][logLine]);
  182. if (logPieces) {
  183. logInfo.append(logPieces[1] + ' [' + logPieces[2]
  184. + '] ' + logPieces[3]);
  185. }
  186. else {
  187. logInfo.append(data['logLines'][logLine]);
  188. }
  189. logInfo.append('</div>');
  190. }
  191. $('#SimLogFile').empty();
  192. $('#SimLogFile').append(logInfo.toString());
  193. }
  194. function DisplaySessionStatsDetails(data) {
  195. var userInfo = new StringBuffer();
  196. userInfo.append('<table>');
  197. userInfo.append('<tr>');
  198. userInfo.append('<th>region</th>');
  199. userInfo.append('<th>user</th>');
  200. userInfo.append('<th></th>');
  201. userInfo.append('<th>position</th>');
  202. userInfo.append('</tr>');
  203. for (region in data) {
  204. for (user in data[region]) {
  205. if (user != 'queues') {
  206. userInfo.append('<tr>');
  207. userInfo.append('<td>' + region + '</td>');
  208. userInfo.append('<td>' + data[region][user].Name + '</td>');
  209. if (data[region][user].isRoot == 'true') {
  210. userInfo.append('<td>root</td>');
  211. }
  212. else {
  213. userInfo.append('<td>child</td>');
  214. }
  215. userInfo.append('<td>' + data[region][user].position + '</td>');
  216. userInfo.append('</tr>');
  217. }
  218. }
  219. }
  220. userInfo.append('</table>');
  221. $('#SimSessionStats').empty();
  222. $('#SimSessionStats').append(userInfo.toString());
  223. }
  224. function DebugLog(msg) {
  225. $("#DEBUG").append('<div>' + msg + '</div>');
  226. $("#DEBUG").show();
  227. }
  228. function StringBuffer() {
  229. this.__strings__ = new Array;
  230. }
  231. StringBuffer.prototype.append = function(str) {
  232. this.__strings__.push(str);
  233. }
  234. StringBuffer.prototype.toString = function() {
  235. return this.__strings__.join("");
  236. }
  237. </script>
  238. </head>
  239. <body id="SimBody">
  240. <div id="SimHeader"></div>
  241. <div id="SimContent">
  242. <!-- ============================================== -->
  243. <div class="SimSectionContainer">
  244. <a class="SimSectionHeader" href="#">Simulator Stats</a>
  245. <div id="SimSimStats" class="SimSection">
  246. </div> <!-- SimSimStats -->
  247. </div> <!-- SimSectionContainer -->
  248. <!-- ============================================== -->
  249. <div class="SimSectionContainer">
  250. <a class="SimSectionHeader" href="#">Region Stats</a>
  251. <div id="SimRegionStats" class="SimSection">
  252. </div> <!-- SimRegionStats -->
  253. </div> <!-- SimSectionContainer -->
  254. <!-- ============================================== -->
  255. <div class="SimSectionContainer">
  256. <a class="SimSectionHeader" href="#">Sessions</a>
  257. <div id="SimSessionStats" class="SimSection">
  258. </div> <!-- SimSessionStats -->
  259. </div> <!-- SimSectionContainer -->
  260. <!-- ============================================== -->
  261. <div class="SimSectionContainer">
  262. <a class="SimSectionHeader" href="#">Log File</a>
  263. <div id="SimLogFile" class="SimSection">
  264. </div> <!-- SimLogFile -->
  265. </div> <!-- SimSectionContainer -->
  266. <!-- ============================================== -->
  267. </div> <!-- SimContent -->
  268. <div id="DEBUG"></div>
  269. <div id="SimFooter"></div>
  270. </body>
  271. </html>