Debugging: Add code to print backtrace for guest on SIGSEGV
[nativeclient.git] / tests / srpc / srpcperf.html
blob5d9d8583ba96455dd7063d32317eb1d3ab82b708
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3 <html>
4 <!-- Copyright 2008 Google Inc. All rights reserved. -->
5 <head>
6 <title> Simple RPC Performance Tests </title>
7 <script type="application/x-javascript">
8 <!--
9 var ClearCanvas = function() {
10 this.context.fillStyle = 'rgb(0,0,0)';
11 this.context.fillRect(0, 0, this.xsize, this.ysize);
12 this.output.textContent = this.type;
15 var BenchSteps = 50000;
16 var RunBenchmark = function() {
17 var context = this.context;
18 var steps = BenchSteps;
19 var point_function = this.point_function;
20 var output = document.getElementById('LogOutput'); // this.output;
21 var call_time = 0;
22 var worst_time = 0;
23 for (var i = 0; i < steps; i++) {
24 var before_call = new Date();
25 var arr = point_function();
26 var after_call = new Date();
27 var difftime = after_call.getTime() - before_call.getTime();
28 call_time = call_time + difftime;
29 if (difftime > worst_time) {
30 worst_time = difftime
33 output.innerHTML += this.type + ": " + call_time + ' ms (' + (call_time / steps) + ' per call; worst ' + worst_time + ')<BR>\n';
36 var Benchmark = function(type, point_function) {
37 this.type = type;
38 this.point_function = point_function;
39 this.output = document.getElementById(type + 'Output');
40 this.Run = RunBenchmark;
43 var BenchIntTest;
44 var BenchStringTest;
45 var BenchBigStringTest;
46 var BenchNullTest;
47 var BenchNullNpapiTest;
48 var BenchRPC3x;
49 var OneKString =
50 "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef" +
51 "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef" +
52 "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef" +
53 "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef" +
54 "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef" +
55 "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef" +
56 "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef" +
57 "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef" +
58 "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef" +
59 "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef" +
60 "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef" +
61 "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef" +
62 "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef" +
63 "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef" +
64 "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef" +
65 "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef";
67 // Init is called when the document has completed loading. It downloads the
68 // NativeClient module and sets up the two benchmark run methods.
69 var Init = function(boxsize) {
70 var log = document.getElementById('LogOutput');
71 // Remember the element for the Native Client service.
72 native_client_service = document.getElementById('nacl');
73 // Set a banner in the log.
74 log.innerHTML += "Using " + BenchSteps + " iterations for each test<BR>\n";
75 // Create a NativeClient version of the benchmark.
76 var IntTestNativeClient = function() {
77 return native_client_service.int(0);
79 BenchIntTest = new Benchmark('IntTest', IntTestNativeClient);
80 var StringTestNativeClient = function() {
81 return native_client_service.string("hello world");
83 BenchStringTest = new Benchmark('StringTest', StringTestNativeClient);
84 var BigStringTestNativeClient = function() {
85 return native_client_service.string(OneKString);
87 BenchBigStringTest =
88 new Benchmark('BigStringTest', BigStringTestNativeClient);
89 var NullRpcTestNativeClient = function() {
90 return native_client_service.string(OneKString);
92 BenchNullTest = new Benchmark('NullRpcTest', NullRpcTestNativeClient);
93 var NullNpapiTestNativeClient = function() {
94 return native_client_service.__nullNpapiMethod(OneKString);
96 BenchNullNpapiTest =
97 new Benchmark('NullNpapiTest', NullNpapiTestNativeClient);
99 -->
100 </script>
101 </head>
102 <body onload="Init();">
103 <h1> Native Client Simple RPC Performance Tests </h1>
104 <table summary="A collection of buttons to invoke tests">
105 <thead>
106 <tr>
107 <td align=center>
108 <input type="button" onclick="BenchIntTest.Run()"
109 value="IntTest" />
110 </td>
111 <td align=center>
112 <input type="button" onclick="BenchStringTest.Run()"
113 value="StringTest" />
114 </td>
115 <td align=center>
116 <input type="button" onclick="BenchBigStringTest.Run()"
117 value="BigStringTest">
118 </input>
119 </td>
120 <td align=center>
121 <input type="button" onclick="BenchNullTest.Run()"
122 value="NullRpcTest" />
123 </td>
124 <td align=center>
125 <input type="button" onclick="BenchNullNpapiTest.Run()"
126 value="NullNpapiTest" />
127 </td>
128 </thead>
129 </table>
130 <h2>
131 Click any button above to run a benchmark.
132 </h2>
133 <embed type="application/x-nacl-srpc" id="nacl" height="0" width="0"
134 src="srpc_test.nexe" />
135 <table summary="A box containing execution logging output">
136 <tr>
137 <td id="LogOutput" />
138 </tr>
139 </table>
140 </body>
141 </html>