├── .gitattributes
├── .github
└── ISSUE_TEMPLATE
│ ├── bug_report.md
│ └── feature_request.md
├── .gitignore
├── .jsbeautifyrc
├── .jsdoc.json
├── .jshintignore
├── .jshintrc
├── .npmignore
├── .travis.yml
├── CONTRIBUTING.md
├── Gruntfile.js
├── LICENSE
├── NOTICE
├── README.md
├── benchmark
├── autobench.js
├── benchmarks.js
├── express.js
├── fail.html
├── gamingbench.js
├── index.css
├── index.html
├── index.js
├── pass.html
└── tools.js
├── dist
├── .gitignore
└── .npmignore
├── examples
└── basic
│ ├── demo.css
│ ├── demo.details
│ ├── demo.html
│ ├── demo.js
│ └── offline.html
├── fft-white.png
├── js
├── .jshintrc
├── CanvasInput.js
├── ColorMap.js
├── common.js
├── license.js
├── m.js
├── mx.dommenu.js
├── mx.js
├── plugins.js
├── sigplot.accordion.js
├── sigplot.annotations.js
├── sigplot.boxes.js
├── sigplot.js
├── sigplot.layer1d.js
├── sigplot.layer2d.js
├── sigplot.playback.js
├── sigplot.plugin.js
└── sigplot.slider.js
├── karma.conf.js
├── package-lock.json
├── package.json
├── support
└── google-closure-compiler
│ └── build
│ ├── COPYING
│ ├── README
│ └── compiler.jar
└── test
├── dat
├── info.png
├── keyword_test_file.tmp
├── lots_of_keywords.tmp
├── penny.prm
├── pulse_cx.tmp
├── ramp.tmp
├── raster.tmp
├── scalarpacked.tmp
├── sin.mat
└── sin.tmp
├── penny.prm
├── test.html
└── tests.js
/.gitattributes:
--------------------------------------------------------------------------------
1 | core.autocrlf=false
2 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/bug_report.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Bug report
3 | about: Describe a problem with SigPlot
4 |
5 | ---
6 |
7 | **Describe the bug**
8 | A clear and concise description of what the bug is.
9 |
10 | **To Reproduce**
11 |
12 | Steps to reproduce the behavior:
13 | 1. Go to '...'
14 | 2. Click on '....'
15 | 3. Scroll down to '....'
16 | 4. See error
17 |
18 | **Expected behavior**
19 | A clear and concise description of what you expected to happen.
20 |
21 | **jsFiddle**
22 |
23 | If possible, demonstrate the issue by forking [this jsFiddle](https://jsfiddle.net/ha09baqu/#fork) and providing a link to your jsFiddle in the bug report.
24 |
25 | **Screenshots**
26 | If applicable, add screenshots to help explain your problem.
27 |
28 | **Desktop (please complete the following information):**
29 | - OS: [e.g. iOS]
30 | - Browser [e.g. chrome, safari]
31 | - Version [e.g. 22]
32 |
33 | **Smartphone (please complete the following information):**
34 | - Device: [e.g. iPhone6]
35 | - OS: [e.g. iOS8.1]
36 | - Browser [e.g. stock browser, safari]
37 | - Version [e.g. 22]
38 |
39 | **Additional context**
40 | Add any other context about the problem here.
41 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/feature_request.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Feature request
3 | about: Suggest an idea for SigPlot
4 |
5 | ---
6 |
7 | **Is your feature request related to a problem? Please describe.**
8 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
9 |
10 | **Describe the solution you'd like**
11 | A clear and concise description of what you want to happen.
12 |
13 | **Describe alternatives you've considered**
14 | A clear and concise description of any alternative solutions or features you've considered.
15 |
16 | **Additional context**
17 | Add any other context or screenshots about the feature request here.
18 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | *.o
2 | *.so
3 | *.exe
4 | .DS_Store
5 | *~
6 | *.gitignore
7 | Git_History
8 | node_modules
9 | /C:\nppdf32Log\debuglog.txt
10 | .DS_Store
11 | doc/
12 | .idea/
13 |
--------------------------------------------------------------------------------
/.jsbeautifyrc:
--------------------------------------------------------------------------------
1 | {
2 | "indentSize": 4,
3 | "indentWithTabs": false,
4 | "wrapLineLength": 0,
5 | "eol": "\n"
6 | }
7 |
--------------------------------------------------------------------------------
/.jsdoc.json:
--------------------------------------------------------------------------------
1 | {
2 | "tags": {
3 | "allowUnknownTags": true,
4 | "dictionaries": ["jsdoc"]
5 | },
6 | "source": {
7 | "include": ["js", "package.json", "README.md"],
8 | "includePattern": ".js$",
9 | "excludePattern": "(node_modules/|doc)"
10 | },
11 | "plugins": [
12 | "plugins/markdown"
13 | ],
14 | "opts": {
15 | "destination": "./doc",
16 | "encoding": "utf8",
17 | "private": true,
18 | "recurse": true,
19 | "template": "./node_modules/minami"
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/.jshintignore:
--------------------------------------------------------------------------------
1 | js/typedarray.js
2 | js/CanvasInput.js
3 | js/spin.js
4 | js/tinycolor.js
5 | js/loglevel.js
6 | js/slider.js
7 |
--------------------------------------------------------------------------------
/.jshintrc:
--------------------------------------------------------------------------------
1 | {
2 | "curly": true,
3 | "eqeqeq": true,
4 | "immed": true,
5 | "latedef": true,
6 | "newcap": true,
7 | "noarg": true,
8 | "sub": true,
9 | "undef": true,
10 | "unused": true,
11 | "boss": true,
12 | "eqnull": true,
13 | "node": true
14 | }
15 |
--------------------------------------------------------------------------------
/.npmignore:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LGSInnovations/sigplot/480cec393280a41359924383d06bb6849eeab879/.npmignore
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: node_js
2 | node_js:
3 | - "10.15.1"
4 |
5 | services:
6 | - docker
7 |
8 | before_install:
9 | - rm -rf dist/*
10 | - npm install -g grunt
11 | - npm install -q
12 | script:
13 | - grunt dist
14 |
15 | notifications:
16 | email:
17 | on_success: never
18 |
19 |
--------------------------------------------------------------------------------
/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | # Contributing to SigPlot
2 |
3 | ## Preparing Development Environment
4 |
5 | Using Grunt
6 | -------------
7 | Building SigPlot requires that you have Node.js and the Node Package Manager
8 | (npm) installed.
9 |
10 | Node.js can be installed using the [official source](https://nodejs.org/en/),
11 | using your operating-systems package manager, or by using
12 | [nvm](https://github.com/creationix/nvm).
13 |
14 | Once you have `npm` working, install [Grunt](http://gruntjs.com) with the
15 | command `npm install -g grunt-cli`.
16 |
17 | ```
18 | # Install NVM
19 | curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | bash
20 |
21 | # Install stable Node.js
22 | nvm install stable
23 |
24 | # Use stable Node.js
25 | nvm use stable
26 |
27 | # Install Grunt
28 | npm install -g grunt-cli grunt
29 | ```
30 |
31 | ## Getting started
32 |
33 | 1. Fork the SigPlot repository on GitHub.
34 | 2. Clone the repostory that you have just forked.
35 | 3. Create a branch with a meaningful name: `git checkout -b fix-some-issue`.
36 | 4. Run `npm install` to fetch all of the required SigPlot dependencies.
37 | 5. Run `grunt test` to ensure that your branch builds and passes all of the tests.
38 |
39 | ## Writing code
40 |
41 | All code for SigPlot is found within the `js` folder. Coding style is enforced
42 | using jsbeautifier during the build process. Prior to commiting your code you
43 | should cleanup your code using `grunt prep`. This will reformat your
44 | code and make it consistent with the SigPlot coding standards.
45 |
46 | Please use semantic commit messages following this format:
47 |
48 | ```
49 | commit-type: commit summary
50 |
51 | Commit details as necessary...
52 | ```
53 |
54 | The following commit-type values should be used:
55 | * feat (new feature)
56 | * fix (bug fix)
57 | * docs (changes to documentation)
58 | * style (formatting, missing semi colons, etc; no code change)
59 | * refactor (refactoring production code)
60 | * test (adding missing tests, refactoring tests; no production code change)
61 | * chore (updating grunt tasks etc; no production code change)
62 |
63 | ## Running test suite
64 |
65 | SigPlot includes an extensive set of unittests found in the `test/tests.js`
66 | file. There are two broad categories of test: those that exeucte without user
67 | interaction and those that require user interaction to confirm proper behavior.
68 |
69 | Non-interactive tests can be executed by simply running `grunt test`.
70 | Interactive tests can be executed by running `grunt web_server` and then
71 | opening your webrowser to http://localhost:1337/test/test.html.
72 |
73 | ## Preparing your code for submission
74 |
75 | Prior to submitting a pull request, the following steps are recommended to
76 | prepare your branch:
77 |
78 | 1. Fetch the latest code from the repository: `git fetch origin`
79 | 2. Rebase your branch against master `git rebase origin/master`
80 | 3. Run the build and test with `grunt test`. This must pass without the use of --force.
81 |
82 | Using Make
83 | -------------
84 | Although Grunt is the canonical build system, a basic Makefile is provided for
85 | environment where Grunt cannot be used. You will need the following:
86 |
87 | * GNU Make
88 | * Java version 1.7+
89 |
90 | If you wish to build the SigPlot API documention, you will need
91 | [jsdoc](https://github.com/jsdoc3/jsdoc) installed.
92 |
93 | ## Contributions
94 |
95 | All code in this repository is under the [Apache License, version 2.0](https://www.apache.org/licenses/LICENSE-2.0).
96 |
97 | SigPlot welcomes contributions from everyone. You will need to agree to the
98 | [LGS Contributor License Agreement](https://cla-assistant.lgsinnovations.com/LGSInnovations/) before
99 | your contributions can be incorporated into SigPlot.
100 |
101 | Contributions to SigPlot should be made in the form of GitHub pull requests.
102 | Each pull request will be reviewed by a core contributor and either included in
103 | the main tree or given feedback for changes that would be required.
104 |
--------------------------------------------------------------------------------
/Gruntfile.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | module.exports = function (grunt) {
4 |
5 | // Project configuration.
6 | grunt.initConfig({
7 | // Metadata.
8 | pkg: grunt.file.readJSON('package.json'),
9 | jshint: {
10 | options: {
11 | jshintrc: '.jshintrc'
12 | },
13 | gruntfile: {
14 | src: 'Gruntfile.js'
15 | },
16 | js: {
17 | options: {
18 | jshintrc: 'js/.jshintrc'
19 | },
20 | src: ['js/**/*.js', 'test/tests.js']
21 | },
22 | },
23 | qunit: {
24 | options: { '--web-security': 'no', '--local-to-remote-url-access': 'yes' },
25 | all: ['test/test.html']
26 | },
27 | 'closure-compiler': {
28 | sigplot_debug: {
29 | closurePath: 'support/google-closure-compiler',
30 | js: 'dist/sigplot.js',
31 | maxBuffer: 500,
32 | jsOutputFile: 'dist/sigplot-debug.js',
33 | options: {
34 | formatting: 'PRETTY_PRINT',
35 | compilation_level: 'WHITESPACE_ONLY',
36 | }
37 | },
38 | sigplot_plugins_debug: {
39 | closurePath: 'support/google-closure-compiler',
40 | js: 'dist/sigplot.plugins.js',
41 | maxBuffer: 500,
42 | jsOutputFile: 'dist/sigplot.plugins-debug.js',
43 | options: {
44 | formatting: 'PRETTY_PRINT',
45 | compilation_level: 'WHITESPACE_ONLY'
46 | }
47 | },
48 | sigplot_minimized: {
49 | closurePath: 'support/google-closure-compiler',
50 | js: 'dist/sigplot.js',
51 | maxBuffer: 500,
52 | jsOutputFile: 'dist/sigplot-minimized.js',
53 | options: {
54 | compilation_level: 'SIMPLE_OPTIMIZATIONS'
55 | }
56 | },
57 | sigplot_plugins_minimized: {
58 | closurePath: 'support/google-closure-compiler',
59 | js: 'dist/sigplot.plugins.js',
60 | maxBuffer: 500,
61 | jsOutputFile: 'dist/sigplot.plugins-minimized.js',
62 | options: {
63 | compilation_level: 'SIMPLE_OPTIMIZATIONS'
64 | }
65 | }
66 | },
67 | jsdoc: {
68 | sigplot: {
69 | src: ['js/*.js'],
70 | options: {
71 | destination: 'doc',
72 | template: './node_modules/minami/',
73 | configure: '.jsdoc.json'
74 | }
75 | }
76 | },
77 | clean: {
78 | build: ["dist/**/*", "!dist/*.zip"],
79 | doc: ["doc/**/*"]
80 | },
81 | compress: {
82 | main: {
83 | options: {
84 | archive: "dist/sigplot-<%= pkg.version %>-<%= grunt.template.today('yyyy-mm-dd') %>.zip",
85 | },
86 | files: [
87 | {expand: true, cwd: 'dist/', src: ['*-debug.js'], dest: 'sigplot-<%= pkg.version %>'},
88 | {expand: true, cwd: 'dist/', src: ['*-minimized.js'], dest: 'sigplot-<%= pkg.version %>'},
89 | {src: ['doc/**/*'], dest: 'sigplot-<%= pkg.version %>'}
90 | ]
91 | }
92 | },
93 | githash: {
94 | main: {
95 | options: {}
96 | }
97 | },
98 | replace: {
99 | version: {
100 | src: ["dist/*.js"],
101 | overwrite: true,
102 | replacements: [{
103 | from: /version-PLACEHOLDER/g,
104 | to: "<%= pkg.version %>-<%= githash.main.short %>",
105 | }],
106 | }
107 | },
108 | 'http-server': {
109 | 'test': {
110 | cache: 0,
111 | port: 1337
112 | },
113 | },
114 | jsbeautifier: {
115 | check: {
116 | // Only check a subset of the files
117 | src: [
118 | 'js/m.js',
119 | 'js/mx.js',
120 | 'js/sigplot.layer1d.js',
121 | 'js/sigplot.layer2d.js',
122 | 'js/sigplot.js',
123 | 'js/sigplot.annotations.js',
124 | 'js/sigplot.slider.js',
125 | 'js/sigplot.accordion.js',
126 | 'js/sigplot.boxes.js',
127 | 'js/sigplot.playback.js',
128 | 'js/sigplot.plugin.js',
129 | 'test/tests.js'
130 | ],
131 | options: {
132 | mode: "VERIFY_ONLY",
133 | config: ".jsbeautifyrc"
134 | }
135 | },
136 | cleanup: {
137 | // Only cleanup a subset of the files
138 | src: [
139 | 'js/m.js',
140 | 'js/mx.js',
141 | 'js/sigplot.layer1d.js',
142 | 'js/sigplot.layer2d.js',
143 | 'js/sigplot.js',
144 | 'js/sigplot.annotations.js',
145 | 'js/sigplot.slider.js',
146 | 'js/sigplot.accordion.js',
147 | 'js/sigplot.boxes.js',
148 | 'js/sigplot.playback.js',
149 | 'js/sigplot.plugin.js',
150 | 'test/tests.js'
151 | ],
152 | options: {
153 | config: ".jsbeautifyrc"
154 | }
155 | }
156 | },
157 | express: {
158 | test: {
159 | options: {
160 | script: 'benchmark/express.js'
161 | }
162 | }
163 | },
164 | karma: {
165 | bench: {
166 | configFile: 'karma.conf.js'
167 | }
168 | },
169 | browserify: {
170 | sigplot: {
171 | src: 'js/sigplot.js',
172 | dest: 'dist/sigplot.js',
173 | options: {
174 | browserifyOptions: {
175 | standalone: 'sigplot'
176 | },
177 | transform: [
178 | [
179 | 'babelify', {
180 | "presets": ["@babel/preset-env"]
181 | }
182 | ]
183 | ]
184 | }
185 | },
186 | plugins: {
187 | src: [ 'js/plugins.js' ],
188 | dest: 'dist/sigplot.plugins.js',
189 | options: {
190 | browserifyOptions: {
191 | standalone: 'sigplot_plugins'
192 | },
193 | transform: [
194 | [
195 | 'babelify', {
196 | "presets": ["@babel/preset-env"]
197 | }
198 | ]
199 | ]
200 | }
201 | }
202 | }
203 | });
204 |
205 | // These plugins provide necessary tasks.
206 | grunt.loadNpmTasks('grunt-closure-compiler');
207 | grunt.loadNpmTasks('grunt-contrib-jshint');
208 | grunt.loadNpmTasks('grunt-contrib-qunit');
209 | grunt.loadNpmTasks('grunt-jsdoc');
210 | grunt.loadNpmTasks('grunt-contrib-clean');
211 | grunt.loadNpmTasks('grunt-contrib-compress');
212 | grunt.loadNpmTasks('grunt-http-server');
213 | grunt.loadNpmTasks('grunt-jsbeautifier');
214 | grunt.loadNpmTasks('grunt-karma');
215 | grunt.loadNpmTasks('grunt-express-server');
216 | grunt.loadNpmTasks('grunt-browserify');
217 | grunt.loadNpmTasks('grunt-text-replace');
218 | grunt.loadNpmTasks('grunt-githash');
219 |
220 | grunt.registerTask('build', ['jsbeautifier:check', 'jshint', 'browserify', 'githash', 'replace']);
221 |
222 | // Check everything is good
223 | grunt.registerTask('test', ['build', 'qunit']);
224 |
225 | // Beautify the code
226 | grunt.registerTask('prep', ['jsbeautifier:cleanup']);
227 |
228 | // Generate documentation
229 | grunt.registerTask('generate-docs', ['jsdoc']);
230 |
231 | // Build a distributable release
232 | grunt.registerTask('dist', ['clean', 'test', 'closure-compiler', 'jsdoc', 'compress']);
233 |
234 | // Default task.
235 | grunt.registerTask('default', 'test');
236 |
237 | // Benchmark in browsers.
238 | grunt.registerTask('benchtest', ['express:test', 'karma:bench']);
239 | grunt.registerTask('build_and_test', ['build', 'benchtest']);
240 |
241 | // for compatibility with the old grunt commands
242 | grunt.registerTask('web_server', 'http-server');
243 |
244 | };
245 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 |
2 | Apache License
3 | Version 2.0, January 2004
4 | http://www.apache.org/licenses/
5 |
6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7 |
8 | 1. Definitions.
9 |
10 | "License" shall mean the terms and conditions for use, reproduction,
11 | and distribution as defined by Sections 1 through 9 of this document.
12 |
13 | "Licensor" shall mean the copyright owner or entity authorized by
14 | the copyright owner that is granting the License.
15 |
16 | "Legal Entity" shall mean the union of the acting entity and all
17 | other entities that control, are controlled by, or are under common
18 | control with that entity. For the purposes of this definition,
19 | "control" means (i) the power, direct or indirect, to cause the
20 | direction or management of such entity, whether by contract or
21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
22 | outstanding shares, or (iii) beneficial ownership of such entity.
23 |
24 | "You" (or "Your") shall mean an individual or Legal Entity
25 | exercising permissions granted by this License.
26 |
27 | "Source" form shall mean the preferred form for making modifications,
28 | including but not limited to software source code, documentation
29 | source, and configuration files.
30 |
31 | "Object" form shall mean any form resulting from mechanical
32 | transformation or translation of a Source form, including but
33 | not limited to compiled object code, generated documentation,
34 | and conversions to other media types.
35 |
36 | "Work" shall mean the work of authorship, whether in Source or
37 | Object form, made available under the License, as indicated by a
38 | copyright notice that is included in or attached to the work
39 | (an example is provided in the Appendix below).
40 |
41 | "Derivative Works" shall mean any work, whether in Source or Object
42 | form, that is based on (or derived from) the Work and for which the
43 | editorial revisions, annotations, elaborations, or other modifications
44 | represent, as a whole, an original work of authorship. For the purposes
45 | of this License, Derivative Works shall not include works that remain
46 | separable from, or merely link (or bind by name) to the interfaces of,
47 | the Work and Derivative Works thereof.
48 |
49 | "Contribution" shall mean any work of authorship, including
50 | the original version of the Work and any modifications or additions
51 | to that Work or Derivative Works thereof, that is intentionally
52 | submitted to Licensor for inclusion in the Work by the copyright owner
53 | or by an individual or Legal Entity authorized to submit on behalf of
54 | the copyright owner. For the purposes of this definition, "submitted"
55 | means any form of electronic, verbal, or written communication sent
56 | to the Licensor or its representatives, including but not limited to
57 | communication on electronic mailing lists, source code control systems,
58 | and issue tracking systems that are managed by, or on behalf of, the
59 | Licensor for the purpose of discussing and improving the Work, but
60 | excluding communication that is conspicuously marked or otherwise
61 | designated in writing by the copyright owner as "Not a Contribution."
62 |
63 | "Contributor" shall mean Licensor and any individual or Legal Entity
64 | on behalf of whom a Contribution has been received by Licensor and
65 | subsequently incorporated within the Work.
66 |
67 | 2. Grant of Copyright License. Subject to the terms and conditions of
68 | this License, each Contributor hereby grants to You a perpetual,
69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70 | copyright license to reproduce, prepare Derivative Works of,
71 | publicly display, publicly perform, sublicense, and distribute the
72 | Work and such Derivative Works in Source or Object form.
73 |
74 | 3. Grant of Patent License. Subject to the terms and conditions of
75 | this License, each Contributor hereby grants to You a perpetual,
76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77 | (except as stated in this section) patent license to make, have made,
78 | use, offer to sell, sell, import, and otherwise transfer the Work,
79 | where such license applies only to those patent claims licensable
80 | by such Contributor that are necessarily infringed by their
81 | Contribution(s) alone or by combination of their Contribution(s)
82 | with the Work to which such Contribution(s) was submitted. If You
83 | institute patent litigation against any entity (including a
84 | cross-claim or counterclaim in a lawsuit) alleging that the Work
85 | or a Contribution incorporated within the Work constitutes direct
86 | or contributory patent infringement, then any patent licenses
87 | granted to You under this License for that Work shall terminate
88 | as of the date such litigation is filed.
89 |
90 | 4. Redistribution. You may reproduce and distribute copies of the
91 | Work or Derivative Works thereof in any medium, with or without
92 | modifications, and in Source or Object form, provided that You
93 | meet the following conditions:
94 |
95 | (a) You must give any other recipients of the Work or
96 | Derivative Works a copy of this License; and
97 |
98 | (b) You must cause any modified files to carry prominent notices
99 | stating that You changed the files; and
100 |
101 | (c) You must retain, in the Source form of any Derivative Works
102 | that You distribute, all copyright, patent, trademark, and
103 | attribution notices from the Source form of the Work,
104 | excluding those notices that do not pertain to any part of
105 | the Derivative Works; and
106 |
107 | (d) If the Work includes a "NOTICE" text file as part of its
108 | distribution, then any Derivative Works that You distribute must
109 | include a readable copy of the attribution notices contained
110 | within such NOTICE file, excluding those notices that do not
111 | pertain to any part of the Derivative Works, in at least one
112 | of the following places: within a NOTICE text file distributed
113 | as part of the Derivative Works; within the Source form or
114 | documentation, if provided along with the Derivative Works; or,
115 | within a display generated by the Derivative Works, if and
116 | wherever such third-party notices normally appear. The contents
117 | of the NOTICE file are for informational purposes only and
118 | do not modify the License. You may add Your own attribution
119 | notices within Derivative Works that You distribute, alongside
120 | or as an addendum to the NOTICE text from the Work, provided
121 | that such additional attribution notices cannot be construed
122 | as modifying the License.
123 |
124 | You may add Your own copyright statement to Your modifications and
125 | may provide additional or different license terms and conditions
126 | for use, reproduction, or distribution of Your modifications, or
127 | for any such Derivative Works as a whole, provided Your use,
128 | reproduction, and distribution of the Work otherwise complies with
129 | the conditions stated in this License.
130 |
131 | 5. Submission of Contributions. Unless You explicitly state otherwise,
132 | any Contribution intentionally submitted for inclusion in the Work
133 | by You to the Licensor shall be under the terms and conditions of
134 | this License, without any additional terms or conditions.
135 | Notwithstanding the above, nothing herein shall supersede or modify
136 | the terms of any separate license agreement you may have executed
137 | with Licensor regarding such Contributions.
138 |
139 | 6. Trademarks. This License does not grant permission to use the trade
140 | names, trademarks, service marks, or product names of the Licensor,
141 | except as required for reasonable and customary use in describing the
142 | origin of the Work and reproducing the content of the NOTICE file.
143 |
144 | 7. Disclaimer of Warranty. Unless required by applicable law or
145 | agreed to in writing, Licensor provides the Work (and each
146 | Contributor provides its Contributions) on an "AS IS" BASIS,
147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148 | implied, including, without limitation, any warranties or conditions
149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150 | PARTICULAR PURPOSE. You are solely responsible for determining the
151 | appropriateness of using or redistributing the Work and assume any
152 | risks associated with Your exercise of permissions under this License.
153 |
154 | 8. Limitation of Liability. In no event and under no legal theory,
155 | whether in tort (including negligence), contract, or otherwise,
156 | unless required by applicable law (such as deliberate and grossly
157 | negligent acts) or agreed to in writing, shall any Contributor be
158 | liable to You for damages, including any direct, indirect, special,
159 | incidental, or consequential damages of any character arising as a
160 | result of this License or out of the use or inability to use the
161 | Work (including but not limited to damages for loss of goodwill,
162 | work stoppage, computer failure or malfunction, or any and all
163 | other commercial damages or losses), even if such Contributor
164 | has been advised of the possibility of such damages.
165 |
166 | 9. Accepting Warranty or Additional Liability. While redistributing
167 | the Work or Derivative Works thereof, You may choose to offer,
168 | and charge a fee for, acceptance of support, warranty, indemnity,
169 | or other liability obligations and/or rights consistent with this
170 | License. However, in accepting such obligations, You may act only
171 | on Your own behalf and on Your sole responsibility, not on behalf
172 | of any other Contributor, and only if You agree to indemnify,
173 | defend, and hold each Contributor harmless for any liability
174 | incurred by, or claims asserted against, such Contributor by reason
175 | of your accepting any such warranty or additional liability.
176 |
177 | END OF TERMS AND CONDITIONS
178 |
179 | APPENDIX: How to apply the Apache License to your work.
180 |
181 | To apply the Apache License to your work, attach the following
182 | boilerplate notice, with the fields enclosed by brackets "[]"
183 | replaced with your own identifying information. (Don't include
184 | the brackets!) The text should be enclosed in the appropriate
185 | comment syntax for the file format. We also recommend that a
186 | file or class name and description of purpose be included on the
187 | same "printed page" as the copyright notice for easier
188 | identification within third-party archives.
189 |
190 | Copyright [yyyy] [name of copyright owner]
191 |
192 | Licensed under the Apache License, Version 2.0 (the "License");
193 | you may not use this file except in compliance with the License.
194 | You may obtain a copy of the License at
195 |
196 | http://www.apache.org/licenses/LICENSE-2.0
197 |
198 | Unless required by applicable law or agreed to in writing, software
199 | distributed under the License is distributed on an "AS IS" BASIS,
200 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201 | See the License for the specific language governing permissions and
202 | limitations under the License.
--------------------------------------------------------------------------------
/NOTICE:
--------------------------------------------------------------------------------
1 | LGS SigPlot
2 | Copyright [2012-2017] LGS Innovations
3 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | [SigPlot](http://sigplot.lgsinnovations.com)
2 | =======
3 |
4 | [](https://opensource.org/licenses/Apache-2.0) [](https://travis-ci.org/LGSInnovations/sigplot) [](.github/CONTRIBUTING.md#pull-requests) [](https://badge.fury.io/js/sigplot)
5 |
6 | SigPlot provides fast, interactive plotting for software defined radio
7 | applications using HTML5.
8 |
9 | 
10 |
11 | Getting Started
12 | =================
13 | ```html
14 |
15 |
16 | SigPlot Standalone
17 |
23 |
24 |
25 |
26 |
27 |
31 |
32 |
33 | ```
34 |
35 | See [this jsFiddle](https://jsfiddle.net/ha09baqu/) as an example. Additional
36 | [examples and demos](http://sigplot.lgsinnovations.com/).
37 |
38 |
39 | WebPack Quick Start
40 | ================================
41 |
42 | These instructions assume you have Node.js/NPM correctly installed on your
43 | system.
44 |
45 | First install webpack:
46 |
47 | ```
48 | npm install webpack -g
49 | ```
50 |
51 | Then create a project for the SigPlot demo and install sigplot.
52 |
53 | ```bash
54 | mkdir sigplot-webpack
55 | cd sigplot-webpack
56 | npm install sigplot
57 | ```
58 |
59 | Next, create a file called `demo.js` with the following contents:
60 |
61 | ```javascript
62 | let sigplot = require("sigplot");
63 | let options = {};
64 | let plot = new sigplot.Plot(document.getElementById('plot'), options);
65 | ```
66 |
67 | Then, create a file called `index.html` with the following contents:
68 |
69 | ```html
70 |
71 |
72 | SigPlot Webpack
73 |
79 |
80 |
81 |
82 |
83 |
84 |
85 | ```
86 |
87 | Use webpack to compile the bundle:
88 |
89 | ```bash
90 | webpack ./demo.js bundle.js
91 | ```
92 |
93 | Then open index.html in your webbrowser.
94 |
95 | Help
96 | =============
97 | Join the discussion on [Slack](https://join.slack.com/t/sigplot/shared_invite/zt-34gdt6eb-c1vAwXR48B9YvDZvT7i1DQ).
98 |
99 | Contributing
100 | =====================
101 | See [CONTRIBUTING.md](CONTRIBUTING.md).
102 |
103 | License
104 | =====================
105 | Licensed to the LGS Innovations (LGS) under one
106 | or more contributor license agreements. See the NOTICE file
107 | distributed with this work for additional information
108 | regarding copyright ownership. LGS licenses this file
109 | to you under the Apache License, Version 2.0 (the
110 | "License"); you may not use this file except in compliance
111 | with the License. You may obtain a copy of the License at
112 |
113 | http://www.apache.org/licenses/LICENSE-2.0
114 |
115 | Unless required by applicable law or agreed to in writing,
116 | software distributed under the License is distributed on an
117 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
118 | KIND, either express or implied. See the License for the
119 | specific language governing permissions and limitations
120 | under the License.
121 |
--------------------------------------------------------------------------------
/benchmark/autobench.js:
--------------------------------------------------------------------------------
1 | QUnit.test( 'sigplot benchmark test', function(assert) {
2 | var countDone = assert.async();
3 | var inner = document.createElement('iframe');
4 | inner.name = 'innerframe';
5 | inner.height = "600px";
6 | inner.width = "1000px";
7 |
8 | // Ask server how many scores are already in file for current browser
9 | inner.src = 'http://localhost:3000/countscores?browser=' + trimBrowser();
10 | document.body.appendChild(inner);
11 | var numRuns = 1;
12 | var runNum = 1;
13 | var done = null;
14 | var countRuns = function() {
15 | var location = inner.contentWindow.location;
16 | if (location == null || location.href == undefined) {
17 | // Wait another half-second for redirect from server
18 | setTimeout(countRuns, 500);
19 | } else {
20 | var currentHref = location.href;
21 | // Server sends back number of runs to do as query parameter in redirect
22 | var index = currentHref.lastIndexOf('autolaunch=');
23 | if (index != -1) {
24 | numRuns = Number(currentHref.substring(index + 11));
25 | }
26 | // Now that we know now many runs, expect that many async calls
27 | done = assert.async(numRuns);
28 | // And schedule the first benchmark run
29 | setTimeout(runBenches, 100);
30 | countDone();
31 | }
32 | }
33 |
34 | var runBenches = function() {
35 | console.log("Starting benchmark run " + runNum + " of " + numRuns);
36 | // Click on the "launch" link to start the run
37 | inner.contentWindow.document.getElementById("home-launch").click();
38 | var tofunc = function() {
39 | var doc = inner.contentWindow.document;
40 | var score = doc.getElementById("score-footer-text").innerHTML;
41 | if (score == "") {
42 | // Run not finished yet, wait another 5 seconds and check again
43 | setTimeout(tofunc, 5000);
44 | } else {
45 | sendScoreToServer(inner, score, function(status) {
46 | assert.ok(status, "Finished benchmark run " + runNum + " of " + numRuns);
47 | if (runNum < numRuns) {
48 | // Still have more runs to do, schedule the next one
49 | ++runNum;
50 | inner.src = 'http://localhost:9876/base/benchmark/index.html';
51 | setTimeout(runBenches, 1000);
52 | }
53 | done();
54 | });
55 | }
56 | };
57 | // Wait at least 10 seconds before checking to see if run is finished
58 | setTimeout(tofunc, 10000);
59 | }
60 |
61 | setTimeout(countRuns, 500);
62 | });
63 |
64 | // Takes an HTMLCollection object and returns an array of its contents.
65 | function collectionToArray( collection ) {
66 | var size = collection.length;
67 | var arr = [];
68 | for (index = 0; index < size; ++index) {
69 | var bench = makeBenchObject(collection[index]);
70 | if (bench != null) {
71 | arr.push(bench);
72 | }
73 | }
74 | return arr;
75 | }
76 |
77 | // Takes a score-entry-block HTMLDivElement object and returns an object with:
78 | // "benchName", "benchScore", and "benchFPS" attributes
79 | function makeBenchObject( element ) {
80 | var ret = {};
81 | var anchors = element.getElementsByTagName("a");
82 | var len = anchors.length;
83 | if (len < 1) {
84 | return null;
85 | }
86 | var divs = element.getElementsByTagName("div");
87 | ret.benchName = anchors[0].innerHTML;
88 | var bScore = Number(divs[0].innerHTML);
89 | if (isNaN(bScore)) {
90 | ret.benchScore = 0;
91 | } else {
92 | ret.benchScore = bScore;
93 | }
94 | var fps = Number(anchors[1].innerHTML);
95 | if (isNaN(fps)) {
96 | ret.benchFPS = 0;
97 | } else {
98 | ret.benchFPS = fps;
99 | }
100 | return ret;
101 | }
102 |
103 | // Creates and submits a form containing the scores of the latest benchmark run.
104 | function sendScoreToServer( inner, score, cb ) {
105 | var doc = inner.contentWindow.document;
106 | var benches = collectionToArray(doc.getElementsByClassName("score-entry-block"));
107 | var scoreForm = doc.createElement('form');
108 | scoreForm.action = "http://localhost:3000/savescore";
109 | scoreForm.method = "post";
110 | scoreForm.name = "sendscore";
111 | scoreForm.enctype = "application/x-www-form-urlencoded";
112 | scoreForm.appendChild(hiddenInput(doc, "finalscore", score));
113 | scoreForm.appendChild(hiddenInput(doc, "browser", trimBrowser()));
114 | scoreForm.appendChild(hiddenInput(doc, "benches", JSON.stringify(benches, null, 2)));
115 | doc.body.appendChild(scoreForm);
116 | scoreForm.submit();
117 |
118 | var finishFunc = function() {
119 | var innerLoc = document.getElementsByTagName("iframe")[0].contentWindow.location;
120 | if (innerLoc.href.lastIndexOf("pass.html") != -1) {
121 | cb(true);
122 | } else {
123 | cb(false);
124 | }
125 | };
126 | setTimeout(finishFunc, 1000);
127 | }
128 |
129 | // Creates a hidden input element to be added to a form in an HTML DOM document.
130 | function hiddenInput( doc, name, value ) {
131 | var input = doc.createElement('input');
132 | input.type = "hidden";
133 | input.name = name;
134 | input.value = value;
135 | return input;
136 | }
137 |
138 | // Returns an abbreviated form of the browser type.
139 | function trimBrowser() {
140 | var agent = navigator.userAgent;
141 | if (agent.lastIndexOf('Firefox') != -1) {
142 | return 'Firefox';
143 | } else if (agent.lastIndexOf('Chrome') != -1) {
144 | return 'Chrome';
145 | } else {
146 | return 'Other';
147 | }
148 | }
149 |
--------------------------------------------------------------------------------
/benchmark/benchmarks.js:
--------------------------------------------------------------------------------
1 | /*jslint nomen: true, browser: true, devel: true */
2 |
3 | (function () {
4 | /* global POTATOES */
5 | /* global sigplot */
6 |
7 | var plot = null;
8 | var container = null;
9 | var data = null;
10 | var render;
11 |
12 | var init = function (workbench, width, height) {
13 | // Getting container and context
14 | container = document.createElement('div');
15 | workbench.appendChild(container);
16 |
17 |
18 | // Setting hardware scaling
19 | container.width = width;
20 | container.style.width = width+'px';
21 | container.height = height;
22 | container.style.height = height+'px';
23 |
24 | // Position
25 | container.style.position = "absolute";
26 | container.style.left = (workbench.clientWidth - width) / 2 + "px";
27 | container.style.top = (workbench.clientHeight - height) / 2 + "px";
28 | };
29 |
30 | var refreshLoop = function() {
31 | plot._refresh();
32 | if (render) { // Run again
33 | POTATOES.Tools.queueNewFrame(refreshLoop);
34 | } else { // Cleanup
35 | plot = null;
36 | data = null;
37 | }
38 | };
39 |
40 | var reloadLoop = function() {
41 | plot.reload(0, data);
42 | if (render) { // Run again
43 | POTATOES.Tools.queueNewFrame(reloadLoop);
44 | } else { // Cleanup
45 | plot = null;
46 | data = null;
47 | }
48 | };
49 |
50 | var pushLoop = function() {
51 | plot.push(0, data, null, true);
52 | if (render) { // Run again
53 | POTATOES.Tools.queueNewFrame(pushLoop);
54 | } else { // Cleanup
55 | plot = null;
56 | data = null;
57 | }
58 | };
59 |
60 | var emptyBench = new POTATOES.GamingBench.Bench("Empty SigPlot", "http://sigplot.lgsinnovations.com/sigplot",
61 | function (workbench) { // Init
62 | init(workbench, 600, 400);
63 | plot = new sigplot.Plot(container, {all: true, expand: true});
64 | this.onInitCompleted();
65 | }, function () { // Run
66 | render = true;
67 | POTATOES.Tools.queueNewFrame(refreshLoop);
68 | }, function () { // End
69 | render = false;
70 | });
71 |
72 | POTATOES.GamingBench.registerBench(emptyBench);
73 |
74 | var Layer1DSmallBench = new POTATOES.GamingBench.Bench("Layer 1D (1k points)", "http://sigplot.lgsinnovations.com/sigplot",
75 | function (workbench) { // Init
76 | init(workbench, 600, 400);
77 | plot = new sigplot.Plot(container, {all: true, expand: true});
78 | data = [];
79 | for (var i = 0; i < 1024; i++) {
80 | data.push(i);
81 | }
82 | plot.overlay_array(data, {
83 | file_name: "data"
84 | });
85 | this.onInitCompleted();
86 | }, function () { // Run
87 | render = true;
88 | POTATOES.Tools.queueNewFrame(refreshLoop);
89 | }, function () { // End
90 | render = false;
91 | });
92 |
93 | POTATOES.GamingBench.registerBench(Layer1DSmallBench);
94 |
95 | var Layer1DLargeBench = new POTATOES.GamingBench.Bench("Layer 1D (1M points)", "http://sigplot.lgsinnovations.com/sigplot",
96 | function (workbench) { // Init
97 | init(workbench, 600, 400);
98 | plot = new sigplot.Plot(container, {all: true, expand: true});
99 | data = [];
100 | for (var i = 0; i < 1048576; i++) {
101 | data.push(i);
102 | }
103 | plot.overlay_array(data, {
104 | file_name: "data"
105 | });
106 | this.onInitCompleted();
107 | }, function () { // Run
108 | render = true;
109 | POTATOES.Tools.queueNewFrame(refreshLoop);
110 | }, function () { // End
111 | render = false;
112 | });
113 |
114 | POTATOES.GamingBench.registerBench(Layer1DLargeBench);
115 |
116 | var Layer1DSmallReloadBench = new POTATOES.GamingBench.Bench("Layer 1D Reload (1k points)", "http://sigplot.lgsinnovations.com/sigplot",
117 | function (workbench) { // Init
118 | init(workbench, 600, 400);
119 | plot = new sigplot.Plot(container, {all: true, expand: true});
120 | data = [];
121 | for (var i = 0; i < 1024; i++) {
122 | data.push(i);
123 | }
124 | plot.overlay_array(data, {
125 | file_name: "data"
126 | });
127 | this.onInitCompleted();
128 | }, function () { // Run
129 | render = true;
130 | POTATOES.Tools.queueNewFrame(reloadLoop);
131 | }, function () { // End
132 | render = false;
133 | });
134 |
135 | POTATOES.GamingBench.registerBench(Layer1DSmallReloadBench);
136 |
137 | var Layer1DLargeReloadBench = new POTATOES.GamingBench.Bench("Layer 1D Reload (1M points)", "http://sigplot.lgsinnovations.com/sigplot",
138 | function (workbench) { // Init
139 | init(workbench, 600, 400);
140 | plot = new sigplot.Plot(container, {all: true, expand: true});
141 | data = [];
142 | for (var i = 0; i < 1048576; i++) {
143 | data.push(i);
144 | }
145 | plot.overlay_array(data, {
146 | file_name: "data"
147 | });
148 | this.onInitCompleted();
149 | }, function () { // Run
150 | render = true;
151 | POTATOES.Tools.queueNewFrame(reloadLoop);
152 | }, function () { // End
153 | render = false;
154 | });
155 |
156 | POTATOES.GamingBench.registerBench(Layer1DLargeReloadBench);
157 |
158 |
159 | var Layer2DSmallPushBench = new POTATOES.GamingBench.Bench("Streaming 2D (1k points)", "http://sigplot.lgsinnovations.com/sigplot",
160 | function (workbench) { // Init
161 | init(workbench, 600, 400);
162 | plot = new sigplot.Plot(container, {all: true, expand: true});
163 |
164 | plot.change_settings({
165 | autol: 5,
166 | });
167 |
168 | var framesize = 1024;
169 | data = [];
170 | for (var i = 0; i < framesize; i += 1) {
171 | data.push(i + 1);
172 | }
173 | plot.overlay_pipe({
174 | type: 2000,
175 | subsize: framesize,
176 | file_name: "data"
177 | });
178 | this.onInitCompleted();
179 | }, function () { // Run
180 | render = true;
181 | POTATOES.Tools.queueNewFrame(pushLoop);
182 | }, function () { // End
183 | render = false;
184 | });
185 |
186 | POTATOES.GamingBench.registerBench(Layer2DSmallPushBench);
187 |
188 | var Layer2DMediumPushBench = new POTATOES.GamingBench.Bench("Streaming 2D (64k points)", "http://sigplot.lgsinnovations.com/sigplot",
189 | function (workbench) { // Init
190 | init(workbench, 600, 400);
191 | plot = new sigplot.Plot(container, {all: true, expand: true});
192 |
193 | plot.change_settings({
194 | autol: 5,
195 | });
196 |
197 | var framesize = 64*1024;
198 | data = [];
199 | for (var i = 0; i < framesize; i += 1) {
200 | data.push(i + 1);
201 | }
202 | plot.overlay_pipe({
203 | type: 2000,
204 | subsize: framesize,
205 | file_name: "data"
206 | });
207 | this.onInitCompleted();
208 | }, function () { // Run
209 | render = true;
210 | POTATOES.Tools.queueNewFrame(pushLoop);
211 | }, function () { // End
212 | render = false;
213 | });
214 |
215 | POTATOES.GamingBench.registerBench(Layer2DMediumPushBench);
216 |
217 | var Layer2DLargePushBench = new POTATOES.GamingBench.Bench("Streaming 2D (256k points)", "http://sigplot.lgsinnovations.com/sigplot",
218 | function (workbench) { // Init
219 | init(workbench, 600, 400);
220 | plot = new sigplot.Plot(container, {all: true, expand: true});
221 | plot._refresh(); // refresh now so that it displays while we wait for the initial data to be created
222 |
223 | plot.change_settings({
224 | autol: 5,
225 | });
226 |
227 | var framesize = 256*1024;
228 | data = [];
229 | for (var i = 0; i < framesize; i += 1) {
230 | data.push(i + 1);
231 | }
232 | plot.overlay_pipe({
233 | type: 2000,
234 | subsize: framesize,
235 | file_name: "data"
236 | });
237 | this.onInitCompleted();
238 | }, function () { // Run
239 | render = true;
240 | POTATOES.Tools.queueNewFrame(pushLoop);
241 | }, function () { // End
242 | render = false;
243 | });
244 |
245 | POTATOES.GamingBench.registerBench(Layer2DLargePushBench);
246 |
247 | var Layer2DSmallBench = new POTATOES.GamingBench.Bench("Layer 2D (1k points)", "http://sigplot.lgsinnovations.com/sigplot",
248 | function (workbench) { // Init
249 | init(workbench, 600, 400);
250 | plot = new sigplot.Plot(container, {all: true, expand: true});
251 |
252 | var framesize = 1024;
253 | var height = 1024;
254 | data = [];
255 | for (var j = 0; j < height; j += 1) {
256 | for (var i = 0; i < framesize; i += 1) {
257 | data.push(i + 1);
258 | }
259 | }
260 | plot.overlay_array(data, {
261 | type: 2000,
262 | subsize: framesize,
263 | file_name: "data"
264 | });
265 | this.onInitCompleted();
266 | }, function () { // Run
267 | render = true;
268 | POTATOES.Tools.queueNewFrame(refreshLoop);
269 | }, function () { // End
270 | render = false;
271 | });
272 |
273 | POTATOES.GamingBench.registerBench(Layer2DSmallBench);
274 |
275 | var Layer2DLargeBench = new POTATOES.GamingBench.Bench("Layer 2D (64k points)", "http://sigplot.lgsinnovations.com/sigplot",
276 | function (workbench) { // Init
277 | init(workbench, 600, 400);
278 | plot = new sigplot.Plot(container, {all: true, expand: true});
279 | plot._refresh(); // refresh now so that it displays while we wait for the initial data to be created
280 |
281 | var framesize = 65536;
282 | var height = 1024;
283 | data = [];
284 | for (var j = 0; j < height; j += 1) {
285 | for (var i = 0; i < framesize; i += 1) {
286 | data.push(i + 1);
287 | }
288 | }
289 | plot.overlay_array(data, {
290 | type: 2000,
291 | subsize: framesize,
292 | file_name: "data"
293 | });
294 | this.onInitCompleted();
295 | }, function () { // Run
296 | render = true;
297 | POTATOES.Tools.queueNewFrame(refreshLoop);
298 | }, function () { // End
299 | render = false;
300 | });
301 |
302 | POTATOES.GamingBench.registerBench(Layer2DLargeBench);
303 |
304 | })();
305 |
--------------------------------------------------------------------------------
/benchmark/express.js:
--------------------------------------------------------------------------------
1 | var express = require('express');
2 | var app = express();
3 | var bodyParser = require('body-parser');
4 | app.use(bodyParser.urlencoded({ extended: true }));
5 |
6 | app.post('/savescore', function (req, res) {
7 | // Client finished run, check score to see if it passes regression threshold
8 | var contents = req.body;
9 | var score = contents;
10 | var benches = JSON.parse(contents.benches);
11 | contents.finalscore = Number(contents.finalscore);
12 | contents.benches = benches;
13 | contents.timestamp = new Date();
14 | var browser = contents.browser;
15 | writeScoreToFile(score, browser, function (passed) {
16 | // Use redirect to tell client whether run passed or failed
17 | if (passed) {
18 | res.redirect('http://localhost:9876/base/benchmark/pass.html?score=' + score.finalscore);
19 | } else {
20 | res.redirect('http://localhost:9876/base/benchmark/fail.html?score=' + score.finalscore);
21 | }
22 | });
23 | });
24 |
25 | app.get('/countscores', function (req, res) {
26 | // Client asking how many benchmark runs to do, check number of scores in existing file
27 | var browser = req.query.browser;
28 | countScores(browser, function(numRuns) {
29 | // Redirect client to HTML5 Potatoes test page with # runs to do as query parameter
30 | res.redirect('http://localhost:9876/base/benchmark/index.html?autolaunch=' + numRuns);
31 | });
32 | });
33 |
34 | app.listen(3000, function () {
35 | console.log('Benchmark score reader/writer listening on port 3000!');
36 | });
37 |
38 | // Determine how many benchmark runs client needs to do to populate scores file for browser
39 | function countScores( browser, cb ) {
40 | var fs = require("fs");
41 | if (!fs.existsSync("benchmark/json")) {
42 | fs.mkdirSync("benchmark/json");
43 | }
44 | var numRuns = 10;
45 | var fileName = "benchmark/json/Scores_" + browser + ".json";
46 | if (fs.existsSync(fileName)) {
47 | var fileData = fs.readFileSync(fileName);
48 | var JSONdata = JSON.parse(fileData);
49 | var scoreData = JSONdata.scores;
50 | var numScores = scoreData.length;
51 | numRuns = 10 - numScores;
52 | }
53 | if (numRuns < 1) {
54 | // Already 10+ scores for comparison, so just do 1 run to check against them
55 | numRuns = 1;
56 | }
57 | cb(numRuns);
58 | }
59 |
60 | // Return false if final score lower than mean of last 10 successful runs by > 1 sigma
61 | function scorePasses( score, prevScores ) {
62 | testBenchScores(score, prevScores);
63 | var mean = getMean(prevScores);
64 | var stdDev = getStdDev(prevScores, mean);
65 | console.log("Mean: " + mean + " Sigma: " + stdDev + " Score: " + score.finalscore);
66 | var currentDiff = mean - score.finalscore;
67 | if (currentDiff > stdDev) {
68 | return false;
69 | } else {
70 | return true;
71 | }
72 | }
73 |
74 | // Attach "failed" attribute to any specific benchmark in run that shows regression
75 | function testBenchScores( score, prevScores ) {
76 | var benches = score.benches;
77 | var numBenches = benches.length;
78 | for (var benchIndex = 0; benchIndex < numBenches; ++benchIndex) {
79 | var bench = benches[benchIndex];
80 | if (!benchScorePassesByIndex(score, prevScores, benchIndex)) {
81 | bench.failed = true;
82 | }
83 | }
84 | }
85 |
86 | // Return mean of last 10 successful runs' final scores
87 | function getMean( scoreArray ) {
88 | if (!Array.isArray(scoreArray)) {
89 | return 0;
90 | }
91 | var numValues = scoreArray.length;
92 | if (numValues == 0) {
93 | return 0;
94 | }
95 | var sum = 0;
96 | for (var index = 0; index < numValues; ++index) {
97 | sum += scoreArray[index].finalscore;
98 | }
99 | return sum / numValues;
100 | }
101 |
102 | // Return standard deviation (sigma) of last 10 successful runs' final scores
103 | function getStdDev( scoreArray, mean ) {
104 | if (!Array.isArray(scoreArray)) {
105 | return 0;
106 | }
107 | var numValues = scoreArray.length;
108 | if (numValues == 0) {
109 | return 0;
110 | }
111 | var totalDev = 0;
112 | for (var index = 0; index < numValues; ++index) {
113 | var diff = scoreArray[index].finalscore - mean;
114 | totalDev += (diff * diff);
115 | }
116 | var variance = totalDev / numValues;
117 | return Math.sqrt(variance);
118 | }
119 |
120 | // Get score of specific benchmark from results submitted by client
121 | function getBenchScore( score, benchName ) {
122 | var benches = score.benches;
123 | var numBenches = benches.length;
124 | for (var benchIndex = 0; benchIndex < numBenches; ++benchIndex) {
125 | var bench = benches[benchIndex];
126 | if (bench.benchName == benchName) {
127 | return bench.benchScore;
128 | }
129 | }
130 | return 0;
131 | }
132 |
133 | // Get index of specific benchmark in score array
134 | function getBenchIndex( score, benchName ) {
135 | var benches = score.benches;
136 | var numBenches = benches.length;
137 | for (var benchIndex = 0; benchIndex < numBenches; ++benchIndex) {
138 | var bench = benches[benchIndex];
139 | if (bench.benchName == benchName) {
140 | return benchIndex;
141 | }
142 | }
143 | return -1;
144 | }
145 |
146 | // Return false if benchmark score lower than mean of last 10 successful runs by > 1 sigma
147 | function benchScorePasses( score, prevScores, benchName ) {
148 | var mean = getBenchMean(prevScores, benchName);
149 | var stdDev = getBenchStdDev(prevScores, benchName, mean);
150 | var currentDiff = mean - getBenchScore(score, benchName);
151 | if (currentDiff > stdDev) {
152 | return false;
153 | } else {
154 | return true;
155 | }
156 | }
157 |
158 | // Return mean score for specific benchmark for last 10 successful runs
159 | function getBenchMean( scoreArray, benchName ) {
160 | if (!Array.isArray(scoreArray)) {
161 | return 0;
162 | }
163 | var numValues = scoreArray.length;
164 | if (numValues == 0) {
165 | return 0;
166 | }
167 | var sum = 0;
168 | for (var index = 0; index < numValues; ++index) {
169 | sum += getBenchScore(scoreArray[index], benchName);
170 | }
171 | return sum / numValues;
172 | }
173 |
174 | // Return standard deviation of score for specific benchmark for last 10 successful runs
175 | function getBenchStdDev( scoreArray, benchName, mean ) {
176 | if (!Array.isArray(scoreArray)) {
177 | return 0;
178 | }
179 | var numValues = scoreArray.length;
180 | if (numValues == 0) {
181 | return 0;
182 | }
183 | var totalDev = 0;
184 | for (var index = 0; index < numValues; ++index) {
185 | var benchScore = getBenchScore(scoreArray[index], benchName);
186 | var diff = benchScore - mean;
187 | totalDev += (diff * diff);
188 | }
189 | var variance = totalDev / numValues;
190 | return Math.sqrt(variance);
191 | }
192 |
193 | // Index-based version of benchScorePasses() to improve efficiency
194 | function benchScorePassesByIndex( score, prevScores, benchIndex ) {
195 | var mean = getBenchMeanByIndex(prevScores, benchIndex);
196 | var stdDev = getBenchStdDevByIndex(prevScores, benchIndex, mean);
197 | var currentDiff = mean - score.benches[benchIndex].benchScore;
198 | if (currentDiff > stdDev) {
199 | return false;
200 | } else {
201 | return true;
202 | }
203 | }
204 |
205 | // Index-based version of getBenchMean() to improve efficiency
206 | function getBenchMeanByIndex( scoreArray, benchIndex ) {
207 | if (!Array.isArray(scoreArray)) {
208 | return 0;
209 | }
210 | var numValues = scoreArray.length;
211 | if (numValues == 0) {
212 | return 0;
213 | }
214 | var sum = 0;
215 | for (var index = 0; index < numValues; ++index) {
216 | sum += scoreArray[index].benches[benchIndex].benchScore;
217 | }
218 | return sum / numValues;
219 | }
220 |
221 | // Index-based version of getBenchStdDev() to improve efficiency
222 | function getBenchStdDevByIndex( scoreArray, benchIndex, mean ) {
223 | if (!Array.isArray(scoreArray)) {
224 | return 0;
225 | }
226 | var numValues = scoreArray.length;
227 | if (numValues == 0) {
228 | return 0;
229 | }
230 | var totalDev = 0;
231 | for (var index = 0; index < numValues; ++index) {
232 | var benchScore = scoreArray[index].benches[benchIndex].benchScore;
233 | var diff = benchScore - mean;
234 | totalDev += (diff * diff);
235 | }
236 | var variance = totalDev / numValues;
237 | return Math.sqrt(variance);
238 | }
239 |
240 | // Test last score against 10 previous successful ones, and add to appropriate file
241 | function writeScoreToFile( score, browser, cb) {
242 | var fs = require("fs");
243 | if (!fs.existsSync("benchmark/json")) {
244 | fs.mkdirSync("benchmark/json");
245 | }
246 | var fileName = "benchmark/json/Scores_" + browser + ".json";
247 | var fileData = "{\n\t\"scores\": []\n}";
248 | if (fs.existsSync(fileName)) {
249 | fileData = fs.readFileSync(fileName);
250 | }
251 | var JSONdata = JSON.parse(fileData);
252 | var scoreData = JSONdata.scores;
253 | var numScores = scoreData.length;
254 | if (numScores < 10) {
255 | // Too few scores to do analysis yet, just add last run to browser's score file
256 | scoreData.push(score);
257 | cb(true);
258 | } else if (scorePasses(score, scoreData)) {
259 | // Add last run to browser's score file, and remove oldest one
260 | scoreData.push(score);
261 | scoreData.shift();
262 | cb(true);
263 | } else {
264 | // Store last run in the list of failures
265 | fileName = "benchmark/json/FailedScores.json";
266 | fileData = "{ \"failedScores\": [] }"
267 | if (fs.existsSync(fileName)) {
268 | fileData = fs.readFileSync(fileName);
269 | }
270 | JSONdata = JSON.parse(fileData);
271 | JSONdata.failedScores.push(score);
272 | cb(false);
273 | }
274 | fs.writeFileSync(fileName, JSON.stringify(JSONdata, null, 4));
275 | }
276 |
--------------------------------------------------------------------------------
/benchmark/fail.html:
--------------------------------------------------------------------------------
1 | Benchmark failed!
2 |
--------------------------------------------------------------------------------
/benchmark/gamingbench.js:
--------------------------------------------------------------------------------
1 | var POTATOES = POTATOES || {};
2 |
3 | (function () {
4 | // Internals
5 | var currentBenchIndex = -1;
6 | var currentBench = null;
7 |
8 |
9 | var state;
10 |
11 | var fpsDiv;
12 | var progress;
13 | var progressText;
14 | var benchName;
15 | var benchTitle;
16 | var benchTitleBackground;
17 | var workbench;
18 |
19 | var progressInteval;
20 | var durationTimeout;
21 |
22 | var startTime;
23 |
24 | var fpsFrame = 20; // fps window frame
25 | var fpsCap = 60;
26 | var previousFramesDuration = [];
27 |
28 | var handleMetrics = function () {
29 | if (!currentBench) {
30 | return;
31 | }
32 |
33 | currentBench.score++;
34 |
35 | previousFramesDuration.push(Date.now());
36 |
37 | if (previousFramesDuration.length >= fpsFrame) {
38 |
39 | if (previousFramesDuration.length > fpsFrame) {
40 | previousFramesDuration.splice(0, 1);
41 | }
42 |
43 | var avg = 0;
44 | for (var id = 0; id < fpsFrame - 1; id++) {
45 | avg += previousFramesDuration[id + 1] - previousFramesDuration[id];
46 | }
47 | avg /= fpsFrame - 1;
48 |
49 | POTATOES.GamingBench.currentFPS = Math.min(fpsCap, 1000.0 / (previousFramesDuration[fpsFrame - 1] - previousFramesDuration[fpsFrame - 2]));
50 | POTATOES.GamingBench.averageFPS = Math.min(fpsCap, 1000.0 / avg);
51 |
52 | if (state === "running" && isFinite(POTATOES.GamingBench.currentFPS)) {
53 | fpsDiv.innerHTML = POTATOES.GamingBench.currentFPS.toFixed() + " fps";
54 |
55 | if (currentBench.stats.length == 0) {
56 | startTime = Date.now();
57 | }
58 |
59 | currentBench.stats.push({ x: (Date.now() - startTime) / 1000, y: POTATOES.GamingBench.averageFPS });
60 | }
61 | }
62 |
63 | if (state === "running") {
64 | POTATOES.Tools.queueNewFrame(handleMetrics);
65 | }
66 | };
67 |
68 | var updateProgress = function () {
69 | if (progress.value > 100)
70 | return;
71 |
72 | progress.value += 5;
73 | progressText.innerHTML = progress.value + "%";
74 | };
75 |
76 | var stopCurrentBench = function (stop) {
77 | state = "stopped";
78 | clearInterval(progressInteval);
79 |
80 | benchTitle.removeEventListener("animationend", onAnimationEnd);
81 | benchTitle.removeEventListener("webkitAnimationEnd", onAnimationEnd);
82 |
83 | // Stopping
84 | if (currentBench) {
85 | currentBench.onInitCompleted = function () { };
86 | currentBench.stop(workbench);
87 |
88 | // Removing all children
89 | while (workbench.childNodes.length) {
90 | workbench.removeChild(workbench.childNodes[0]);
91 | }
92 | }
93 |
94 | // Running next one
95 | if (!stop) {
96 | runBench(currentBenchIndex + 1);
97 | } else {
98 | currentBench = null;
99 | }
100 | };
101 |
102 | // When animations end
103 | var onAnimationEnd = function () {
104 | POTATOES.Tools.removeClass(benchTitle, "animate-bench-title");
105 | POTATOES.Tools.removeClass(benchTitleBackground, "animate-bench-title-background");
106 |
107 | benchTitle.removeEventListener("animationend", onAnimationEnd);
108 | benchTitle.removeEventListener("webkitAnimationEnd", onAnimationEnd);
109 |
110 | if (!currentBench) {
111 | return;
112 | }
113 |
114 | // Bench initialization
115 | benchName.innerHTML = currentBench.name;
116 |
117 | // On init completed
118 | currentBench.onInitCompleted = function () {
119 | // Set duration check
120 | durationTimeout = setTimeout(stopCurrentBench, currentBench.stepDuration);
121 | progressInteval = setInterval(updateProgress, currentBench.stepDuration / 20);
122 |
123 | // Launch bench
124 | if (currentBench.isSupported()) {
125 | state = "running";
126 | currentBench.run();
127 |
128 | // Preparing framework
129 | previousFramesDuration = [];
130 | POTATOES.Tools.queueNewFrame(handleMetrics);
131 | } else {
132 | stopCurrentBench(false);
133 | }
134 | };
135 |
136 | // Launch bench initialization
137 | currentBench.init(workbench);
138 | };
139 |
140 | // Launch bench
141 | var runBench = function (index) {
142 | if (index >= POTATOES.GamingBench.benches.length) {
143 | currentBench = null;
144 | if (POTATOES.GamingBench.onprocessended) {
145 | POTATOES.GamingBench.onprocessended();
146 | }
147 | return;
148 | }
149 |
150 | currentBenchIndex = index;
151 | currentBench = POTATOES.GamingBench.benches[index];
152 | currentBench.score = 0;
153 | currentBench.stats = [];
154 |
155 | fpsDiv.innerHTML = "";
156 | previousFramesDuration = [];
157 | progress.value = 0;
158 | progressText.innerHTML = "0%";
159 | benchName.innerHTML = "";
160 | benchTitle.innerHTML = currentBench.name;
161 |
162 | if (benchTitle.style.webkitAnimationName !== undefined || benchTitle.style.animationName !== undefined) {
163 | benchTitle.addEventListener("animationend", onAnimationEnd, false);
164 | benchTitle.addEventListener("webkitAnimationEnd", onAnimationEnd, false);
165 |
166 | // Launching animations
167 | POTATOES.Tools.addClass(benchTitle, "animate-bench-title");
168 | POTATOES.Tools.addClass(benchTitleBackground, "animate-bench-title-background");
169 | } else {
170 | // No animations
171 | onAnimationEnd();
172 | }
173 | };
174 |
175 | // Gaming Bench engine
176 | POTATOES.GamingBench = {
177 | onprocessended: null,
178 | benches: [],
179 | currentFPS: 0
180 | };
181 |
182 | POTATOES.GamingBench.Bench = function (name, url, onInit, onRun, onStop, isSupported) {
183 | return {
184 | run: onRun,
185 | init: onInit,
186 | stop: onStop,
187 | name: name,
188 | url: url,
189 | score: 0,
190 | stats: [],
191 | isSupported: function () {
192 | if (isSupported) {
193 | return isSupported();
194 | }
195 | return true;
196 | },
197 | stepDuration: 20000,
198 | onInitCompleted: null
199 | };
200 | };
201 |
202 | POTATOES.GamingBench.registerBench = function (bench) {
203 | POTATOES.GamingBench.benches.push(bench);
204 | };
205 |
206 | POTATOES.GamingBench.cancel = function () {
207 | POTATOES.Tools.removeClass(benchTitle, "animate-bench-title");
208 | POTATOES.Tools.removeClass(benchTitleBackground, "animate-bench-title-background");
209 | clearTimeout(durationTimeout);
210 | previousFramesDuration = [];
211 |
212 | if (currentBench) {
213 | stopCurrentBench(true);
214 | }
215 | };
216 |
217 | POTATOES.GamingBench.skipCurrent = function () {
218 | clearTimeout(durationTimeout);
219 | previousFramesDuration = [];
220 |
221 | if (currentBench) {
222 | stopCurrentBench();
223 | }
224 | };
225 |
226 | POTATOES.GamingBench.start = function () {
227 | // Getting fps display zone and progress indicator
228 | fpsDiv = document.getElementById("bench-fps");
229 | progress = document.getElementById("bench-status-progress");
230 | progressText = document.getElementById("bench-status-progress-text");
231 | benchName = document.getElementById("bench-name");
232 | benchTitle = document.getElementById("bench-title");
233 | benchTitleBackground = document.getElementById("bench-title-background");
234 | workbench = document.getElementById("bench-work");
235 |
236 | // Preparing animations
237 | POTATOES.Tools.removeClass(benchTitle, "animate-bench-title");
238 | POTATOES.Tools.removeClass(benchTitleBackground, "animate-bench-title-background");
239 |
240 | // Launch first bench
241 | runBench(0);
242 | };
243 | })();
--------------------------------------------------------------------------------
/benchmark/index.css:
--------------------------------------------------------------------------------
1 | * {
2 | font-family: Tahoma;
3 | cursor: default;
4 | }
5 |
6 | html, body {
7 | width: 100%;
8 | height: 100%;
9 | margin: 0;
10 | padding: 0;
11 | overflow: hidden;
12 | }
13 |
14 | a {
15 | text-decoration: none;
16 | color: white;
17 | }
18 |
19 | a:visited {
20 | color: white;
21 | }
22 |
23 | .screen {
24 | position: absolute;
25 | width: 100%;
26 | height: 100%;
27 | margin: 0;
28 | padding: 0;
29 | background-color: black;
30 | z-index: 1;
31 | transition: opacity 0.5s linear;
32 | -webkit-transition: opacity 0.5s linear;
33 | }
34 |
35 | .hidden {
36 | opacity: 0;
37 | z-index: -10 !important;
38 | }
39 |
40 | .buttonLink {
41 | font-size: 50px;
42 | font-weight: bold;
43 | color: white;
44 | position: absolute;
45 | text-decoration: none;
46 | }
47 |
48 | .buttonLink:hover {
49 | opacity: 0.8;
50 | }
51 |
52 | .small-button {
53 | font-size: 20px;
54 | color: white;
55 | width: 150px;
56 | height: 50px;
57 | }
58 |
59 | .button:hover {
60 | opacity: 0.8;
61 | }
62 |
63 | .green {
64 | color: white;
65 | border: 1px solid #005500;
66 | background-color: green;
67 | }
68 |
69 | .orange {
70 | color: white;
71 | border: 1px solid #FFFF85;
72 | background-color: orange;
73 | }
74 |
75 | .red {
76 | background-color: red;
77 | border: 1px solid #550000;
78 | }
79 |
80 | /*HOME*/
81 | #home {
82 | background-color: white;
83 | }
84 |
85 | #home-top {
86 | position: absolute;
87 | width: 100%;
88 | height: 40%;
89 | margin-bottom: 5%;
90 | margin-top: 20px;
91 | }
92 |
93 | #home-logo {
94 | position: absolute;
95 | width: 100%;
96 | height: 100%;
97 | }
98 |
99 | #home-controls {
100 | position: absolute;
101 | width: 100%;
102 | height: 50%;
103 | top: 50%;
104 | text-align: center;
105 | background-color: black;
106 | z-index: 1;
107 | }
108 |
109 | #home-nohtml5 {
110 | position: absolute;
111 | width: 100%;
112 | height: 50%;
113 | top: 50%;
114 | text-align: center;
115 | background-color: black;
116 | color: white;
117 | font-size: 50px;
118 | font-weight: bold;
119 | }
120 |
121 | #home-version {
122 | position: absolute;
123 | bottom: 10px;
124 | right: 10px;
125 | font-size: 15px;
126 | color: #cccccc;
127 | }
128 |
129 | #home-brand {
130 | position: absolute;
131 | bottom: 10px;
132 | width: 100%;
133 | text-align: center;
134 | font-size: 12px;
135 | color: #cccccc;
136 | font-style: italic;
137 | }
138 |
139 | #home-launch {
140 | top: 50%;
141 | margin-top: -50px;
142 | height: 100px;
143 | right: 50%;
144 | margin-right: 20px;
145 | cursor: pointer;
146 | }
147 |
148 | #home-launch-mobile {
149 | top: 50%;
150 | margin-top: -50px;
151 | height: 100px;
152 | left: 50%;
153 | margin-left: 20px;
154 | cursor: pointer;
155 | }
156 |
157 |
158 | /*BENCH*/
159 | #bench-header {
160 | position: absolute;
161 | width: 100%;
162 | height: 80px;
163 | z-index: 1;
164 | background-color: black;
165 | }
166 |
167 | #bench-work {
168 | position: absolute;
169 | width: 100%;
170 | top: 80px;
171 | bottom: 80px;
172 | background-color: #222222;
173 | }
174 |
175 | #bench-menu {
176 | position: absolute;
177 | width: 100%;
178 | height: 80px;
179 | bottom: 0px;
180 | z-index: 1;
181 | background-color: black;
182 | }
183 |
184 | #bench-cancel {
185 | position: absolute;
186 | top: 15px;
187 | right: 20px;
188 | }
189 |
190 | #bench-skip {
191 | position: absolute;
192 | top: 15px;
193 | right: 180px;
194 | }
195 |
196 | #bench-fps {
197 | font-size: 30px;
198 | color: white;
199 | position: absolute;
200 | top: 20px;
201 | right: 20px;
202 | }
203 |
204 | #bench-name {
205 | font-size: 30px;
206 | font-weight: bold;
207 | color: white;
208 | position: absolute;
209 | top: 20px;
210 | left: 20px;
211 | }
212 |
213 | #bench-title-background {
214 | position: absolute;
215 | background-color: white;
216 | top: 50%;
217 | margin-top: -75px;
218 | height: 150px;
219 | width: 100%;
220 | transform: translateX(-100%);
221 | opacity: 0;
222 | }
223 |
224 | #bench-title {
225 | font-size: 50px;
226 | font-weight: bold;
227 | text-align: center;
228 | position: absolute;
229 | color: black;
230 | top: 50%;
231 | margin-top: -40px;
232 | height: 50px;
233 | width: 100%;
234 | transform: translateX(100%);
235 | opacity: 0;
236 | }
237 |
238 | #bench-status {
239 | position: absolute;
240 | top: 30px;
241 | left: 10px;
242 | color: white;
243 | }
244 |
245 | #bench-status-progress {
246 | color: green;
247 | }
248 |
249 | @keyframes move-bench-title-background {
250 | 0% {
251 | transform: translateX(-100%);
252 | opacity: 1;
253 | }
254 |
255 | 10% {
256 | animation-timing-function: ease-in-out;
257 | transform: translateX(0);
258 | opacity: 1;
259 | }
260 |
261 | 90% {
262 | transform: translateX(0);
263 | opacity: 1;
264 | }
265 |
266 | 100% {
267 | animation-timing-function: ease-in-out;
268 | transform: translateX(-100%);
269 | opacity: 0;
270 | }
271 | }
272 |
273 | @keyframes move-bench-title {
274 | 0% {
275 | transform: translateX(100%);
276 | opacity: 1;
277 | }
278 |
279 | 10% {
280 | animation-timing-function: ease-in-out;
281 | transform: translateX(0);
282 | opacity: 1;
283 | }
284 |
285 | 90% {
286 | transform: translateX(0);
287 | opacity: 1;
288 | }
289 |
290 | 100% {
291 | animation-timing-function: ease-in-out;
292 | transform: translateX(100%);
293 | opacity: 0;
294 | }
295 | }
296 |
297 | @-webkit-keyframes move-bench-title-background {
298 | 0% {
299 | -webkit-transform: translateX(-100%);
300 | opacity: 1;
301 | }
302 |
303 | 10% {
304 | -webkit-animation-timing-function: ease-in-out;
305 | -webkit-transform: translateX(0);
306 | opacity: 1;
307 | }
308 |
309 | 90% {
310 | -webkit-transform: translateX(0);
311 | opacity: 1;
312 | }
313 |
314 | 100% {
315 | -webkit-animation-timing-function: ease-in-out;
316 | -webkit-transform: translateX(-100%);
317 | opacity: 0;
318 | }
319 | }
320 |
321 | @-webkit-keyframes move-bench-title {
322 | 0% {
323 | -webkit-transform: translateX(100%);
324 | opacity: 1;
325 | }
326 |
327 | 10% {
328 | -webkit-animation-timing-function: ease-in-out;
329 | -webkit-transform: translateX(0);
330 | opacity: 1;
331 | }
332 |
333 | 90% {
334 | -webkit-transform: translateX(0);
335 | opacity: 1;
336 | }
337 |
338 | 100% {
339 | -webkit-animation-timing-function: ease-in-out;
340 | -webkit-transform: translateX(100%);
341 | opacity: 0;
342 | }
343 | }
344 |
345 | .animate-bench-title {
346 | animation-delay: 0.5s;
347 | animation-duration: 3s;
348 | animation-iteration-count: 1;
349 | animation-name: move-bench-title;
350 | -webkit-animation-delay: 0.5s;
351 | -webkit-animation-duration: 3s;
352 | -webkit-animation-iteration-count: 1;
353 | -webkit-animation-name: move-bench-title;
354 | }
355 |
356 | .animate-bench-title-background {
357 | animation-delay: 0.5s;
358 | animation-duration: 3s;
359 | animation-iteration-count: 1;
360 | animation-name: move-bench-title-background;
361 | -webkit-animation-delay: 0.5s;
362 | -webkit-animation-duration: 3s;
363 | -webkit-animation-iteration-count: 1;
364 | -webkit-animation-name: move-bench-title-background;
365 | }
366 |
367 |
368 | /*SCORE*/
369 | #score-header {
370 | position: absolute;
371 | width: 100%;
372 | height: 150px;
373 | }
374 |
375 | #score-footer {
376 | position: absolute;
377 | width: 100%;
378 | height: 150px;
379 | bottom: 0;
380 | }
381 |
382 | #score-footer-text {
383 | position: absolute;
384 | bottom: -5px;
385 | font-size: 100px;
386 | color: white;
387 | width: 100%;
388 | text-align: center;
389 | }
390 |
391 | #score-header-title {
392 | position: absolute;
393 | top: 10px;
394 | font-size: 120px;
395 | color: white;
396 | width: 100%;
397 | text-align: center;
398 | }
399 |
400 | #score-list-background {
401 | position: absolute;
402 | width: 100%;
403 | top: 150px;
404 | bottom: 100px;
405 | background-color: white;
406 | }
407 |
408 | #score-list {
409 | width: 80%;
410 | top: 200px;
411 | height: auto;
412 | bottom: 150px;
413 | margin-left: 10%;
414 | margin-right: 10%;
415 | background-color: #dedede;
416 | overflow: auto;
417 | padding: 10px;
418 | border: 1px solid #999999;
419 | }
420 |
421 | #score-stats {
422 | position: absolute;
423 | width: 100%;
424 | top: 150px;
425 | height: auto;
426 | bottom: 100px;
427 | text-align: center;
428 | background-color: white;
429 | }
430 |
431 | #score-footer-back {
432 | position: absolute;
433 | bottom: 25px;
434 | right: 20px;
435 | }
436 |
437 | .score-entry-block {
438 | width: 100%;
439 | height: 50px;
440 | }
441 |
442 | .score-entry {
443 | float: left;
444 | font-size: 30px;
445 | color: black;
446 | }
447 |
448 | .score-entry:hover {
449 | opacity: 0.7;
450 | }
451 |
452 | .score-entry:visited {
453 | color: black;
454 | }
455 |
456 | .score-entry-link {
457 | text-decoration: underline;
458 | color: #550000;
459 | font-size: 30px;
460 | float: right;
461 | width: 150px;
462 | text-align: right;
463 | cursor: pointer;
464 | }
465 |
466 | .score-entry-link:visited {
467 | text-decoration: underline;
468 | color: #550000;
469 | font-size: 30px;
470 | }
471 |
472 | .score-entry-score {
473 | width: 100px;
474 | text-align: right;
475 | color: #00CC00;
476 | font-size: 30px;
477 | float: right;
478 | }
479 |
480 | .score-entry-header-fps {
481 | width: 150px;
482 | text-align: right;
483 | color: black;
484 | font-size: 30px;
485 | float: right;
486 | }
487 |
488 | .score-entry-header-score {
489 | width: 100px;
490 | text-align: right;
491 | color: black;
492 | font-size: 30px;
493 | float: right;
494 | }
495 |
496 |
497 | /*Stats*/
498 | .axis path,
499 | .axis line {
500 | fill: none;
501 | stroke: #000;
502 | shape-rendering: crispEdges;
503 | }
504 |
505 | .line {
506 | fill: none;
507 | stroke: steelblue;
508 | stroke-width: 1.5px;
509 | }
510 |
511 | #score-stats-graph {
512 | position: absolute;
513 | width: 100%;
514 | top: 0px;
515 | bottom: 100px;
516 | height: auto;
517 | }
518 |
519 | .score-stats-graph-svg {
520 | width: 100%;
521 | height: 100%;
522 | }
523 |
524 | #score-stats-title {
525 | position: absolute;
526 | width: 100%;
527 | height: 100px;
528 | bottom: 0px;
529 | text-align: center;
530 | color: black;
531 | font-size: 40px;
532 | }
533 |
--------------------------------------------------------------------------------
/benchmark/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | HTML5 Potatoes - Gaming Bench
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |