diff --git a/CMakeLists.txt b/CMakeLists.txt
index bf8b19ae..378a7535 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -420,6 +420,8 @@ add_custom_command(
# editor
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_BINARY_DIR}/programs/editor ${WEBODFZIPDIR}/editor
COMMAND ${CMAKE_COMMAND} -E remove_directory ${WEBODFZIPDIR}/editor/dojo-deps
+ # benchmark
+ COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_BINARY_DIR}/programs/benchmark ${WEBODFZIPDIR}/benchmark
# wordpressplugin
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/programs/wordpressplugin/readme.txt ${WEBODFZIPDIR}/wordpressplugin-readme.txt
COMMAND ${CMAKE_COMMAND} -E copy ${WORDPRESSZIP} ${WEBODFZIPDIR}
@@ -436,6 +438,7 @@ add_custom_command(
webodf-debug.js-target
webodf.js-target
editor-compiled.js-target
+ html-benchmark
viewer-minimized.js-target
firefoxextension-target
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
diff --git a/programs/CMakeLists.txt b/programs/CMakeLists.txt
index bd6f0348..ab9ef4c4 100644
--- a/programs/CMakeLists.txt
+++ b/programs/CMakeLists.txt
@@ -12,6 +12,7 @@ add_subdirectory(firefoxextension)
add_subdirectory(touchui)
add_subdirectory(playbook)
+add_subdirectory(benchmark)
add_subdirectory(editor)
add_subdirectory(viewer)
add_subdirectory(wordpressplugin)
diff --git a/programs/benchmarking/1000pages.odt b/programs/benchmark/1000pages.odt
similarity index 100%
rename from programs/benchmarking/1000pages.odt
rename to programs/benchmark/1000pages.odt
diff --git a/programs/benchmarking/100pages.odt b/programs/benchmark/100pages.odt
similarity index 100%
rename from programs/benchmarking/100pages.odt
rename to programs/benchmark/100pages.odt
diff --git a/programs/benchmarking/10pages.odt b/programs/benchmark/10pages.odt
similarity index 100%
rename from programs/benchmarking/10pages.odt
rename to programs/benchmark/10pages.odt
diff --git a/programs/benchmarking/1page.odt b/programs/benchmark/1page.odt
similarity index 100%
rename from programs/benchmarking/1page.odt
rename to programs/benchmark/1page.odt
diff --git a/programs/benchmark/CMakeLists.txt b/programs/benchmark/CMakeLists.txt
new file mode 100644
index 00000000..cc8ff76e
--- /dev/null
+++ b/programs/benchmark/CMakeLists.txt
@@ -0,0 +1,37 @@
+COPY_FILES(BENCHMARK_HTML ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}
+ 1page.odt
+ 10pages.odt
+ 100pages.odt
+ 1000pages.odt
+ index.html
+)
+
+FILE(GLOB BENCHMARK_JS "${CMAKE_CURRENT_SOURCE_DIR}/js/*.js")
+
+FOREACH(JSFILE ${BENCHMARK_JS})
+ set(BENCHMARK_CLOSURE_ARGS ${BENCHMARK_CLOSURE_ARGS} --js ${JSFILE})
+ENDFOREACH(JSFILE)
+
+add_custom_command(
+ OUTPUT benchmark.js-target
+
+ # from webodf.js target (DEPENDS webodf.js)
+ COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/webodf/webodf.js ${CMAKE_CURRENT_BINARY_DIR}
+
+ COMMAND ${Java_JAVA_EXECUTABLE}
+ ARGS -jar ${CLOSURE_JAR}
+ ${BENCHMARK_CLOSURE_ARGS}
+ --transform_amd_modules
+ --process_common_js_modules
+ --common_js_entry_module HTMLBenchmark.js
+ --common_js_module_path_prefix ${CMAKE_CURRENT_SOURCE_DIR}/js
+ --compilation_level SIMPLE_OPTIMIZATIONS
+ --formatting PRETTY_PRINT
+ --js_output_file "benchmark.js-"
+
+ COMMAND ${CMAKE_COMMAND} ARGS -E rename "benchmark.js-" "benchmark.js"
+
+ DEPENDS ClosureCompiler webodf.js-target
+)
+
+add_custom_target(html-benchmark DEPENDS benchmark.js-target ${BENCHMARK_HTML})
\ No newline at end of file
diff --git a/programs/benchmark/index.html b/programs/benchmark/index.html
new file mode 100644
index 00000000..29952cc5
--- /dev/null
+++ b/programs/benchmark/index.html
@@ -0,0 +1,121 @@
+
+
+
+ WebODF performance and benchmarking tool
+
+
+
+
+
+
+
+
+
+
Loading required files. This may take a while.
+
+
+
Benchmark results
+
+
+
+ Action |
+ Status |
+ Elapsed time (ms) |
+
+
+
+
+
+
+
Interaction required:
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/programs/benchmarking/js/Benchmark.js b/programs/benchmark/js/Benchmark.js
similarity index 100%
rename from programs/benchmarking/js/Benchmark.js
rename to programs/benchmark/js/Benchmark.js
diff --git a/programs/benchmarking/js/BenchmarkAction.js b/programs/benchmark/js/BenchmarkAction.js
similarity index 100%
rename from programs/benchmarking/js/BenchmarkAction.js
rename to programs/benchmark/js/BenchmarkAction.js
diff --git a/programs/benchmarking/js/EnterEditMode.js b/programs/benchmark/js/EnterEditMode.js
similarity index 100%
rename from programs/benchmarking/js/EnterEditMode.js
rename to programs/benchmark/js/EnterEditMode.js
diff --git a/programs/benchmarking/js/main.js b/programs/benchmark/js/HTMLBenchmark.js
similarity index 69%
rename from programs/benchmarking/js/main.js
rename to programs/benchmark/js/HTMLBenchmark.js
index dc83f115..74e1833b 100644
--- a/programs/benchmarking/js/main.js
+++ b/programs/benchmark/js/HTMLBenchmark.js
@@ -36,7 +36,7 @@
* @source: https://github.com/kogmbh/WebODF/
*/
-require([
+define([
"Benchmark",
"HTMLResultsRenderer",
"LoadDocument",
@@ -51,25 +51,33 @@ require([
LoadDocument, EnterEditMode, MoveCursorToEndDirect,InsertLetterA, Remove1Position, MoveCursor1StepLeft,
SelectEntireDocument, RemoveCurrentSelection) {
"use strict";
- var loadingScreen = document.getElementById('loadingScreen'),
- fileUrl = window.location.hash.substr(1) || "100pages.odt",
- benchmark = new Benchmark();
- new HTMLResultsRenderer(benchmark);
+ /**
+ * @constructor
+ */
+ function HTMLBenchmark() {
+ var loadingScreen = document.getElementById('loadingScreen'),
+ fileUrl = window.location.hash.substr(1) || "100pages.odt",
+ benchmark = new Benchmark();
- loadingScreen.style.display = "none";
+ new HTMLResultsRenderer(benchmark);
- benchmark.actions.push(new LoadDocument(fileUrl));
- benchmark.actions.push(new EnterEditMode());
- // TODO currently times out
- // benchmark.addAction(new MoveCursorToEndViaCtrlEnd());
- benchmark.actions.push(new MoveCursorToEndDirect());
- benchmark.actions.push(new InsertLetterA());
- benchmark.actions.push(new Remove1Position(true));
- benchmark.actions.push(new MoveCursor1StepLeft());
- benchmark.actions.push(new Remove1Position(false));
- benchmark.actions.push(new SelectEntireDocument());
- benchmark.actions.push(new RemoveCurrentSelection());
+ loadingScreen.style.display = "none";
- benchmark.start();
+ benchmark.actions.push(new LoadDocument(fileUrl));
+ benchmark.actions.push(new EnterEditMode());
+ // TODO currently times out
+ // benchmark.addAction(new MoveCursorToEndViaCtrlEnd());
+ benchmark.actions.push(new MoveCursorToEndDirect());
+ benchmark.actions.push(new InsertLetterA());
+ benchmark.actions.push(new Remove1Position(true));
+ benchmark.actions.push(new MoveCursor1StepLeft());
+ benchmark.actions.push(new Remove1Position(false));
+ benchmark.actions.push(new SelectEntireDocument());
+ benchmark.actions.push(new RemoveCurrentSelection());
+
+ this.start = benchmark.start;
+ }
+
+ return HTMLBenchmark;
});
diff --git a/programs/benchmarking/js/HTMLResultsRenderer.js b/programs/benchmark/js/HTMLResultsRenderer.js
similarity index 100%
rename from programs/benchmarking/js/HTMLResultsRenderer.js
rename to programs/benchmark/js/HTMLResultsRenderer.js
diff --git a/programs/benchmarking/js/InsertLetterA.js b/programs/benchmark/js/InsertLetterA.js
similarity index 100%
rename from programs/benchmarking/js/InsertLetterA.js
rename to programs/benchmark/js/InsertLetterA.js
diff --git a/programs/benchmarking/js/LoadDocument.js b/programs/benchmark/js/LoadDocument.js
similarity index 100%
rename from programs/benchmarking/js/LoadDocument.js
rename to programs/benchmark/js/LoadDocument.js
diff --git a/programs/benchmarking/js/ManualStep.js b/programs/benchmark/js/ManualStep.js
similarity index 98%
rename from programs/benchmarking/js/ManualStep.js
rename to programs/benchmark/js/ManualStep.js
index 8069d902..c99f7ec4 100644
--- a/programs/benchmarking/js/ManualStep.js
+++ b/programs/benchmark/js/ManualStep.js
@@ -39,6 +39,9 @@
define(function() {
"use strict";
+ /**
+ * @constructor
+ */
function ManualStep() {
var wizardContainer = document.getElementById("wizardPrompt"),
messageContainer = document.getElementById("wizardMessage"),
diff --git a/programs/benchmarking/js/MoveCursor1StepLeft.js b/programs/benchmark/js/MoveCursor1StepLeft.js
similarity index 100%
rename from programs/benchmarking/js/MoveCursor1StepLeft.js
rename to programs/benchmark/js/MoveCursor1StepLeft.js
diff --git a/programs/benchmarking/js/MoveCursorToEndDirect.js b/programs/benchmark/js/MoveCursorToEndDirect.js
similarity index 100%
rename from programs/benchmarking/js/MoveCursorToEndDirect.js
rename to programs/benchmark/js/MoveCursorToEndDirect.js
diff --git a/programs/benchmarking/js/MoveCursorToEndViaCtrlEnd.js b/programs/benchmark/js/MoveCursorToEndViaCtrlEnd.js
similarity index 100%
rename from programs/benchmarking/js/MoveCursorToEndViaCtrlEnd.js
rename to programs/benchmark/js/MoveCursorToEndViaCtrlEnd.js
diff --git a/programs/benchmarking/js/Remove1Position.js b/programs/benchmark/js/Remove1Position.js
similarity index 100%
rename from programs/benchmarking/js/Remove1Position.js
rename to programs/benchmark/js/Remove1Position.js
diff --git a/programs/benchmarking/js/RemoveCurrentSelection.js b/programs/benchmark/js/RemoveCurrentSelection.js
similarity index 100%
rename from programs/benchmarking/js/RemoveCurrentSelection.js
rename to programs/benchmark/js/RemoveCurrentSelection.js
diff --git a/programs/benchmarking/js/SelectEntireDocument.js b/programs/benchmark/js/SelectEntireDocument.js
similarity index 100%
rename from programs/benchmarking/js/SelectEntireDocument.js
rename to programs/benchmark/js/SelectEntireDocument.js
diff --git a/programs/benchmarking/js/require.js b/programs/benchmark/require.js
similarity index 100%
rename from programs/benchmarking/js/require.js
rename to programs/benchmark/require.js
diff --git a/programs/benchmarking/src-index.html b/programs/benchmark/src-index.html
similarity index 93%
rename from programs/benchmarking/src-index.html
rename to programs/benchmark/src-index.html
index 84343c30..6a45afbe 100644
--- a/programs/benchmarking/src-index.html
+++ b/programs/benchmark/src-index.html
@@ -86,9 +86,10 @@
];
};
-
+
diff --git a/programs/benchmarking/webodf.js b/programs/benchmark/webodf.js
similarity index 100%
rename from programs/benchmarking/webodf.js
rename to programs/benchmark/webodf.js