/
perftest-jmol.html
131 lines (106 loc) · 4.75 KB
/
perftest-jmol.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
<!DOCTYPE html>
<html>
<head>
<title>Jmol Speed Test</title>
<link rel="stylesheet" href="qunit.css">
<style>
html body { padding: 0; margin: 0 }
</style>
<!-- <script src="../build/-min.js"></script>
<script src="glmol/GLmol.js"></script> -->
<script src="jsmol/jsmol/JSmol.min.js"></script>
<script src="qunit.js"></script>
<script src="qunit-once.js"></script>
<script src="qunit-reporter-junit.js"></script>
<script>
var viewer;
var testSuite = 'jmol';
var resultTimes = {
"initialization": -1,
"stick render" : -1,
"line render" : -1,
"sphere render" : -1,
"cross render" : -1,
"cartoon render" : -1
};
//Don't start tests until everything is setup
QUnit.config.autostart = false;
//Add profile option to QUnit header
QUnit.config.urlConfig.push({
id: "jmolmode",
label: "mode",
value: ["Jmol", "JSmol"],
tooltip: "Choose between Jmol (with Java) and JSmol (pure JavaScript)"
});
//QUnit-reporter hook to output test results in XML format
QUnit.jUnitReport = function(data) {
var resultXML = $.parseXML(data.xml);
//Wrap XML result in JQuery object; parse and setup output string
var result = $(resultXML);
var resultStr = "Viewer Performance Tests: Calicivirus Capsid, 12,362 atoms (3M8L)\n";
var runTime = result.find("testsuites").attr("time");
var runDate = result.find("testsuites").attr("timestamp");
resultStr += "Total Test Time: " + runTime + " s\n";
resultStr += "Date: " + runDate + "\n\n";
result.find("testsuite").each(function(){
var moduleName = $(this).attr("name");
var moduleTime = $(this).attr("time");
resultStr += "\n" + moduleName;
//alert(moduleName);
$(this).find("testcase").each(function() {
var testName = $(this).attr("name");
var testTime = resultTimes[testName] / 1000;
var testTimeTot = $(this).attr("time");
resultStr += "\n\t" + testName + ": " + testTime + " s" + " (" + testTimeTot + "s)";
//alert(testName);
});
resultStr += "\n\tTotal: " + moduleTime + " s\n";
});
//Set up a link to download test results
$("#qunit-testresult").append("<br><a id='download'>Download</a>");
var url = "data:text/plain;charset=utf-8," + encodeURIComponent(resultStr);
$("#download").attr("download", "webgltest.log");
$("#download").attr("href", url);
//alert(resultStr);
};
//Jmol initialization stuff
var mode = QUnit.urlParams.jmolmode;
mode = (mode !== "JSmol") ? "JAVA" : "HTML5";
var start, end;
var jmol_isReady = function(applet) {
//applet.scriptWait("wireframe -0.1; set cartoonFancy true;");
QUnit.start();
};
//var glviewer = null;
Info = {
width: '100%',
height: '100%',
debug: false,
color: "0xFFFFFF",
use: mode, // JAVA HTML5 WEBGL are all options
j2sPath: "./jsmol/jsmol/j2s", // this needs to point to where the j2s directory is.
jarPath: "./jsmol/jsmol/java",// this needs to point to where the java directory is.
jarFile: "JmolAppletSigned.jar",
isSigned: true,
readyFunction: jmol_isReady,
disableJ2SLoadMonitor: true,
disableInitialConsole: true,
allowJavaScript: true,
console: "none" // default will be jmolApplet0_infodiv, but you can designate another div here or "none"
};
$(document).ready(function() {
start = new Date();
$("#viewerdiv").html(Jmol.getAppletHtml("viewer", Info));
console.log("Starting tests");
});
</script>
<script src="perftest.js"></script>
</head>
<body>
<div id="viewerdiv" style="width: 600px; height: 600px; display: inline-block;"></div>
<div style="display: inline-block; vertical-align: top; max-width: 50%;">
<div id="qunit"></div>
<div id="qunit-fixture"></div>
</div>
</body>
</html>