summaryrefslogtreecommitdiff
path: root/misc/openlayers/tests/speed/wmscaps.html
diff options
context:
space:
mode:
authorChris Schlaeger <chris@linux.com>2014-08-12 21:56:44 +0200
committerChris Schlaeger <chris@linux.com>2014-08-12 21:56:44 +0200
commitea346a785dc1b3f7c156f6fc33da634e1f1a627b (patch)
treeaf67530553d20b6e82ad60fd79593e9c4abf5565 /misc/openlayers/tests/speed/wmscaps.html
parent59741cd535c47f25971bf8c32b25da25ceadc6d5 (diff)
downloadpostrunner-ea346a785dc1b3f7c156f6fc33da634e1f1a627b.zip
Adding jquery, flot and openlayers to be included with the GEM.v0.0.4
Diffstat (limited to 'misc/openlayers/tests/speed/wmscaps.html')
-rw-r--r--misc/openlayers/tests/speed/wmscaps.html52
1 files changed, 52 insertions, 0 deletions
diff --git a/misc/openlayers/tests/speed/wmscaps.html b/misc/openlayers/tests/speed/wmscaps.html
new file mode 100644
index 0000000..3cab542
--- /dev/null
+++ b/misc/openlayers/tests/speed/wmscaps.html
@@ -0,0 +1,52 @@
+<html>
+ <head>
+ <title>WMS Capabilities Speed Test</title>
+ <script src="../../lib/OpenLayers.js"></script>
+ <script src="wmscaps.js"></script>
+ <script>
+ var data;
+ var stats = [];
+
+ function parseCaps(id, done) {
+ var format = new OpenLayers.Format.WMSCapabilities();
+ data = format.read(caps);
+ done(id);
+ }
+
+ function run(func, x) {
+ document.getElementById("out").innerHTML = "running ...";
+ var starts = {};
+ var elapsed = 0;
+ completed = 0;
+ function callback(id) {
+ elapsed += new Date() - starts[id];
+ ++completed;
+ if (completed === x) {
+ report(x, elapsed);
+ }
+ }
+ var runner;
+ for (var i=0; i<x; i++) {
+ runner = createRunner(i, starts, func, callback);
+ window.setTimeout(runner, 0);
+ }
+ }
+
+ function createRunner(id, starts, func, done) {
+ return function() {
+ starts[id] = new Date();
+ func(id, done);
+ }
+ }
+
+ function report(x, elapsed) {
+ document.getElementById("out").innerHTML = elapsed + " ms for " + x + " runs (" + elapsed/x + " ms average)";
+ }
+
+ </script>
+ </head>
+ <body>
+ <a onclick="javascript:run(parseCaps, 5); return false" href="#">Run</a>
+ <div id="out"></div>
+ </body>
+</html>