You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by fi...@apache.org on 2013/02/19 22:51:06 UTC

[1/2] spec commit: start of autobench stuff

start of autobench stuff


Project: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/commit/e1b37768
Tree: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/tree/e1b37768
Diff: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/diff/e1b37768

Branch: refs/heads/autobench
Commit: e1b377681eb2f0c79f25a711acb7b8618ffd1cd8
Parents: d27c80d
Author: Fil Maj <ma...@gmail.com>
Authored: Fri Feb 15 14:53:15 2013 -0800
Committer: Fil Maj <ma...@gmail.com>
Committed: Fri Feb 15 14:53:15 2013 -0800

----------------------------------------------------------------------
 benchmarks/autobench.html |   86 ++++++++++++++++++++++++++++++++++++++++
 benchmarks/index.html     |    1 +
 2 files changed, 87 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/e1b37768/benchmarks/autobench.html
----------------------------------------------------------------------
diff --git a/benchmarks/autobench.html b/benchmarks/autobench.html
new file mode 100644
index 0000000..9ccd281
--- /dev/null
+++ b/benchmarks/autobench.html
@@ -0,0 +1,86 @@
+<!DOCTYPE html>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements.  See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership.  The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied.  See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+
+
+<html>
+  <head>
+    <meta name="viewport" content="width=device-width,height=device-height,user-scalable=no,maximum-scale=1.0,initial-scale=1.0" />
+    <meta http-equiv="Content-type" content="text/html; charset=utf-8"> <!-- ISO-8859-1 -->
+    <title>Cordova Mobile Spec</title>
+    <link rel="stylesheet" href="../master.css" type="text/css" media="screen" title="no title" charset="utf-8">
+    <script type="text/javascript" charset="utf-8" src="../cordova.js"></script>      
+      
+<script>
+    var deviceReady, startTime, firstExec, counter = 0, calls = 0, lastExec;
+    var exec = cordova.require('cordova/exec');
+
+    function bench() {
+        var loop = true, stopped = false;
+        startTime = new Date().getTime();
+        setTimeout(function() {
+            loop = false;
+        }, 3000);
+        while(loop) {
+            counter++;
+            exec('Echo', 'echo', function(str) {
+                if (firstExec === undefined) {
+                    firstExec = new Date().getTime();
+                }
+                if (!loop) {
+                    if (!stopped) {
+                        stopped = true;
+                        calls = counter;
+                    }
+                    counter--;
+                    if (counter === 0) {
+                        lastExec = new Date().getTime();
+                        console.log(calls + ' exec calls in 3000ms. first callback ' + (firstExec - startTime) + 'ms after start, last ' + (lastExec - startTime) + 'ms after start.');
+                    }
+                }
+            }, function(err) {
+            }, []);
+        }
+    }
+
+    document.addEventListener("deviceready", function() {
+        deviceReady = true;
+        setTimeout(bench, 250);
+    }, false);
+
+    window.onload = function() {
+        window.setTimeout(function() {
+            if (!deviceReady) {
+                alert("Error: Cordova did not initialize.  Demo will not run correctly.");
+            }
+        }, 1000);
+    };
+
+</script>
+
+  </head>
+  <body>
+    - bench echo
+      - how many exec calls can we accomplish in 3 seconds
+      - how early the first exec call returns
+      - how long til the last exec call returns
+  </body>
+</html>      

http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/e1b37768/benchmarks/index.html
----------------------------------------------------------------------
diff --git a/benchmarks/index.html b/benchmarks/index.html
index 35c9c36..1d24241 100644
--- a/benchmarks/index.html
+++ b/benchmarks/index.html
@@ -140,6 +140,7 @@
 
   </head>
   <body id="stage" class="theme">
+    <a href="autobench.html" class="btn large">AutoBench</a>
     <a href="arraybuffer.html" class="btn large">ArrayBuffer Benchmark</a>
     <h1>exec() Benchmark</h1>
     Before running on Android, set the following constants in NativeToJsMessagingBridge: