cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fil...@apache.org
Subject [1/2] spec commit: start of autobench stuff
Date Tue, 19 Feb 2013 21:51:06 GMT
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 <maj.fil@gmail.com>
Authored: Fri Feb 15 14:53:15 2013 -0800
Committer: Fil Maj <maj.fil@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:


Mime
View raw message