aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/bin
diff options
context:
space:
mode:
authorRobert Adams2013-01-24 10:44:57 -0800
committerRobert Adams2013-01-24 10:44:57 -0800
commit427ab219b8ecf7f039d03ed3067e183db1434fb2 (patch)
tree520cdf2f0afb00fe8dbb28801d4fbf98902788dd /bin
parent* Added in the manifold point dept on collision desc. In BulletSim engine Bul... (diff)
downloadopensim-SC_OLD-427ab219b8ecf7f039d03ed3067e183db1434fb2.zip
opensim-SC_OLD-427ab219b8ecf7f039d03ed3067e183db1434fb2.tar.gz
opensim-SC_OLD-427ab219b8ecf7f039d03ed3067e183db1434fb2.tar.bz2
opensim-SC_OLD-427ab219b8ecf7f039d03ed3067e183db1434fb2.tar.xz
Add JSONification of WebStats module. Adds a '?json' query parameter
to the fetch URL to return the data in JSON format. Also adds a simple 'sim.html' that uses JavaScript to display the JSON data. Not pretty but an example.
Diffstat (limited to 'bin')
-rw-r--r--bin/data/LICENSE-README-IMPORTANT.txt2
-rw-r--r--bin/data/sim.css85
-rw-r--r--bin/data/sim.html291
3 files changed, 377 insertions, 1 deletions
diff --git a/bin/data/LICENSE-README-IMPORTANT.txt b/bin/data/LICENSE-README-IMPORTANT.txt
index 86e401f..a1ac20c 100644
--- a/bin/data/LICENSE-README-IMPORTANT.txt
+++ b/bin/data/LICENSE-README-IMPORTANT.txt
@@ -2,4 +2,4 @@ Not all of the files in this directory are licensed under the BSD license. Some
2 2
3These files are: 3These files are:
4 4
5- avataranimations.xml (Derivative work of viewerart.ini, Creative Commons Attribution+Share-Alike v2.5 License) \ No newline at end of file 5- avataranimations.xml (Derivative work of viewerart.ini, Creative Commons Attribution+Share-Alike v2.5 License)
diff --git a/bin/data/sim.css b/bin/data/sim.css
new file mode 100644
index 0000000..e584a1a
--- /dev/null
+++ b/bin/data/sim.css
@@ -0,0 +1,85 @@
1body {
2 font-family: Veranda,Arial,Helvetica,sans-serif;
3 font-size: 12px;
4 background: #4A5F6D;
5 color: #EEEAD6;
6 padding: 0px;
7 margin: 0px;
8}
9.footer {
10 font-family: Veranda,Arial,Helvetica,sans-serif;
11 font-size: 10px;
12}
13td {
14 font-family: Veranda,Arial,Helvetica,sans-serif;
15 font-size: 12px;
16 padding: 4px;
17 margin: 4px;
18}
19blockquote {
20 font-family: Veranda,Arial,Helvetica,sans-serif;
21 font-style: italic;
22 font-size: 12px;
23}
24pre {
25 padding: 5px;
26 background-color: #8080B0;
27 color: #000000;
28 margin-left: 20px;
29 font-size: 11px;
30}
31:link {
32 color: #ffffff;
33}
34:visited {
35 color: #d0d0d0;
36}
37.SimSectionHeader {
38 font-size: 120%;
39}
40div.SimSectionContainer {
41 padding: 10px 0px 0px 20px;
42}
43/* SimStats ===================================== */
44#SimSimStats div {
45 margin-left: 20px;
46 background: #3A4F5D;
47}
48#SimSimStats table td {
49 text-align: right;
50 padding: 0px 0px 0px 5px;
51 margin: 0px 0px 0px 0px;
52}
53/* Region Stats ===================================== */
54#SimRegionStats div {
55 margin-left: 20px;
56 background: #3A4F5D;
57}
58#SimRegionStats table {
59 border: 1px;
60 border-style: solid;
61}
62#SimRegionStats table td {
63 text-align: right;
64 padding: 0px 0px 0px 5px;
65 margin: 0px 0px 0px 0px;
66}
67/* Session Stats ===================================== */
68#SimSessionStats div {
69 margin-left: 20px;
70 background: #3A4F5D;
71}
72#SimSessionStats table td {
73 text-align: right;
74 padding: 0px 0px 0px 5px;
75 margin: 0px 0px 0px 0px;
76}
77/* LogFile ===================================== */
78#SimLogFile div {
79 margin-left: 20px;
80}
81#SimLogFile table td {
82 text-align: right;
83 padding: 0px 0px 0px 5px;
84 margin: 0px 0px 0px 0px;
85}
diff --git a/bin/data/sim.html b/bin/data/sim.html
new file mode 100644
index 0000000..82d4789
--- /dev/null
+++ b/bin/data/sim.html
@@ -0,0 +1,291 @@
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">
13Your 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
25 // Start the timed functions
26 TimerDataStuff();
27});
28
29// One of the sections is viewer statistics. Poll for the data.
30var statTimerHandle;
31var graphFPS;
32var lastFPS = 10;
33var xxThru = 0;
34function TimerDataStuff() {
35 statTimerHandle = setInterval('TimerStatDisplay()', 5000);
36}
37
38// called by timer to fetch and display statistic information
39var doingStatDisplay = false;
40function TimerStatDisplay() {
41 if (doingStatDisplay) return;
42 doingStatDisplay = true;
43 if ($('#SimSimStats').is(':visible')) {
44 DisplaySimStats();
45 }
46 if ($('#SimRegionStats').is(':visible')) {
47 DisplayPerRegionStats();
48 }
49 if ($('#SimSessionStats').is(':visible')) {
50 DisplaySessionStats();
51 }
52 if ($('#SimLogFile').is(':visible')) {
53 DisplayLogFile();
54 }
55 doingStatDisplay = false;
56}
57
58var simName = "127.0.0.1";
59var simPort = "9000";
60function DisplaySimStats() {
61 var statURL = "http://" + simName + ":" + simPort + "/SStats/?json=1";
62 $.ajax({
63 type: "GET",
64 url: statURL,
65 dataType: 'json',
66 timeout: 1000,
67 success: function(data, status) {
68 if (status == 'success') {
69 DisplaySimStatDetails(data);
70 }
71 },
72 error: function(xmlHTTPRequest, errorType) {
73 // DebugLog('Failed fetch');
74 }
75 });
76}
77
78function DisplayPerRegionStats() {
79 var statURL = "http://" + simName + ":" + simPort + "/SStats/simstatsajax.html?json=1";
80 $.ajax({
81 type: "GET",
82 url: statURL,
83 dataType: 'json',
84 timeout: 1000,
85 success: function(data, status) {
86 if (status == 'success') {
87 DisplayRegionStatDetails(data);
88 }
89 },
90 error: function(xmlHTTPRequest, errorType) {
91 // DebugLog('Failed fetch');
92 }
93 });
94};
95
96function DisplayLogFile() {
97 var statURL = "http://" + simName + ":" + simPort + "/SStats/activelogajax.html?json=1";
98 $.ajax({
99 type: "GET",
100 url: statURL,
101 dataType: 'json',
102 timeout: 1000,
103 success: function(data, status) {
104 if (status == 'success') {
105 DisplayLogFileDetails(data);
106 }
107 },
108 error: function(xmlHTTPRequest, errorType) {
109 // DebugLog('Failed fetch');
110 }
111 });
112};
113
114function DisplaySessionStats() {
115 var statURL = "http://" + simName + ":" + simPort + "/SStats/activeconnectionsajax.html?json=1";
116 $.ajax({
117 type: "GET",
118 url: statURL,
119 dataType: 'json',
120 timeout: 1000,
121 success: function(data, status) {
122 if (status == 'success') {
123 DisplaySessionStatsDetails(data);
124 }
125 },
126 error: function(xmlHTTPRequest, errorType) {
127 // DebugLog('Failed fetch');
128 }
129 });
130};
131
132function DisplaySimStatDetails(data) {
133 var simInfo = new StringBuffer();
134 simInfo.append('<table id="RegionStatsTable">');
135 simInfo.append('<tr>');
136 simInfo.append('<th>Total Users</th>');
137 simInfo.append('<th>Total Sessions</th>');
138 simInfo.append('<th>Avg client FPS</th>');
139 simInfo.append('<th>Avg client Mem</th>');
140 simInfo.append('<th>Avg ping time</th>');
141 simInfo.append('<th>KB out</th>');
142 simInfo.append('<th>KB in</th>');
143 simInfo.append('</tr>');
144 simInfo.append('<tr>');
145 simInfo.append('<td>' + data.totalUsers + '</td>');
146 simInfo.append('<td>' + data.totalSessions + '</td>');
147 simInfo.append('<td>' + data.averageClientFPS + '</td>');
148 simInfo.append('<td>' + data.averageClientMem + '</td>');
149 simInfo.append('<td>' + data.averagePingTime + '</td>');
150 simInfo.append('<td>' + data.totalKBOut + '</td>');
151 simInfo.append('<td>' + data.totalKBIn + '</td>');
152 simInfo.append('</tr>');
153 simInfo.append('</table>');
154 $('#SimSimStats').empty();
155 $('#SimSimStats').append(simInfo.toString());
156}
157
158function DisplayRegionStatDetails(data) {
159 var regionInfo = new StringBuffer();
160 regionInfo.append('<table id="RegionStatsTable">');
161 regionInfo.append('<tr>');
162 regionInfo.append('<th>Region</th>');
163 regionInfo.append('<th>Agents</th>');
164 regionInfo.append('<th>Child</th>');
165 regionInfo.append('<th>FPS</th>');
166 regionInfo.append('<th>Frame Time</th>');
167 regionInfo.append('<th>Phys Time</th>');
168 regionInfo.append('<th>Prims</th>');
169 regionInfo.append('</tr>');
170 for (region in data) {
171 regionInfo.append('<tr>');
172 regionInfo.append('<td>' + data[region].region + '</td>');
173 regionInfo.append('<td>' + data[region].rootAgents + '</td>');
174 regionInfo.append('<td>' + data[region].childAgents + '</td>');
175 regionInfo.append('<td>' + data[region].simFPS + '</td>');
176 regionInfo.append('<td>' + data[region].totalFrameTime + '</td>');
177 regionInfo.append('<td>' + data[region].physicsFrameTime + '</td>');
178 regionInfo.append('<td>' + data[region].totalPrims + '</td>');
179 regionInfo.append('</tr>');
180 }
181 regionInfo.append('</table>');
182 $('#SimRegionStats').empty();
183 $('#SimRegionStats').append(regionInfo.toString());
184}
185
186function DisplayLogFileDetails(data) {
187 var logInfo = new StringBuffer();
188 var logPattern = /^(.+),\d\d\d .* \[(.+)\]: (.+)$/;
189 for (logLine in data['logLines']) {
190 logInfo.append('<div>');
191 var logPieces = logPattern.exec(data['logLines'][logLine]);
192 if (logPieces) {
193 logInfo.append(logPieces[1] + ' [' + logPieces[2]
194 + '] ' + logPieces[3]);
195 }
196 else {
197 logInfo.append(data['logLines'][logLine]);
198 }
199
200 logInfo.append('</div>');
201 }
202 $('#SimLogFile').empty();
203 $('#SimLogFile').append(logInfo.toString());
204}
205
206function DisplaySessionStatsDetails(data) {
207 var userInfo = new StringBuffer();
208 userInfo.append('<table>');
209 userInfo.append('<tr>');
210 userInfo.append('<th>region</th>');
211 userInfo.append('<th>user</th>');
212 userInfo.append('<th></th>');
213 userInfo.append('<th>position</th>');
214 userInfo.append('</tr>');
215 for (region in data) {
216 for (user in data[region]) {
217 if (user != 'queues') {
218 userInfo.append('<tr>');
219 userInfo.append('<td>' + region + '</td>');
220 userInfo.append('<td>' + data[region][user].Name + '</td>');
221 if (data[region][user].isRoot == 'true') {
222 userInfo.append('<td>root</td>');
223 }
224 else {
225 userInfo.append('<td>child</td>');
226 }
227 userInfo.append('<td>' + data[region][user].position + '</td>');
228 userInfo.append('</tr>');
229 }
230 }
231 }
232 userInfo.append('</table>');
233 $('#SimSessionStats').empty();
234 $('#SimSessionStats').append(userInfo.toString());
235}
236
237function DebugLog(msg) {
238 $("#DEBUG").append('<div>' + msg + '</div>');
239 $("#DEBUG").show();
240}
241
242function StringBuffer() {
243 this.__strings__ = new Array;
244}
245StringBuffer.prototype.append = function(str) {
246 this.__strings__.push(str);
247}
248StringBuffer.prototype.toString = function() {
249 return this.__strings__.join("");
250}
251
252</script>
253</head>
254<body id="SimBody">
255<div id="SimHeader"></div>
256<div id="SimContent">
257
258<!-- ============================================== -->
259<div class="SimSectionContainer">
260<a class="SimSectionHeader" href="#">Simulator Stats</a>
261<div id="SimSimStats" class="SimSection">
262</div> <!-- SimSimStats -->
263</div> <!-- SimSectionContainer -->
264
265<!-- ============================================== -->
266<div class="SimSectionContainer">
267<a class="SimSectionHeader" href="#">Region Stats</a>
268<div id="SimRegionStats" class="SimSection">
269</div> <!-- SimRegionStats -->
270</div> <!-- SimSectionContainer -->
271
272<!-- ============================================== -->
273<div class="SimSectionContainer">
274<a class="SimSectionHeader" href="#">Sessions</a>
275<div id="SimSessionStats" class="SimSection">
276</div> <!-- SimSessionStats -->
277</div> <!-- SimSectionContainer -->
278
279<!-- ============================================== -->
280<div class="SimSectionContainer">
281<a class="SimSectionHeader" href="#">Log File</a>
282<div id="SimLogFile" class="SimSection">
283</div> <!-- SimLogFile -->
284</div> <!-- SimSectionContainer -->
285
286<!-- ============================================== -->
287</div> <!-- SimContent -->
288<div id="DEBUG"></div>
289<div id="SimFooter"></div>
290</body>
291</html>